diff options
author | Fabio Berger <me@fabioberger.com> | 2018-05-10 02:36:28 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-05-10 02:36:28 +0800 |
commit | 209266dbed9d7d038c90c2da8d9b99acab77c80c (patch) | |
tree | cfefd5ab15bc237716b15687629e0f41362a8e86 | |
parent | 69a6166b6a1d39afc24b8dd950ec5d8539a03420 (diff) | |
download | dexon-sol-tools-209266dbed9d7d038c90c2da8d9b99acab77c80c.tar.gz dexon-sol-tools-209266dbed9d7d038c90c2da8d9b99acab77c80c.tar.zst dexon-sol-tools-209266dbed9d7d038c90c2da8d9b99acab77c80c.zip |
Split 0x.js into contract-wrappers, order-watcher but keep 0x.js as a unifying library with the same interface
168 files changed, 19671 insertions, 1350 deletions
diff --git a/.gitignore b/.gitignore index 83538fdca..6ed8d7180 100644 --- a/.gitignore +++ b/.gitignore @@ -77,12 +77,16 @@ bin/ packages/sol-cov/test/fixtures/artifacts packages/metacoin/artifacts packages/0x.js/test/artifacts +packages/order-watcher/test/artifacts +packages/contract-wrappers/test/artifacts packages/migrations/src/artifacts # generated contract wrappers packages/0x.js/src/contract_wrappers/generated/ packages/contracts/src/contract_wrappers/generated/ packages/metacoin/src/contract_wrappers +packages/fill-scenarios/src/generated_contract_wrappers/ +packages/order-watcher/src/generated_contract_wrappers/ # solc-bin in deployer packages/deployer/solc_bin/ diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json index bdc575903..41879ade0 100644 --- a/packages/0x.js/CHANGELOG.json +++ b/packages/0x.js/CHANGELOG.json @@ -1,5 +1,15 @@ [ { + "version": "0.38.0", + "changes": [ + { + "note": "Renamed createOrderStateWatcher to createOrderWatcherAsync since it is not async", + "note": + "Renamed ZeroExError to ContractWrappersErrors since they not live in the @0xproject/contract-wrappers subpackage" + } + ] + }, + { "timestamp": 1525477860, "version": "0.37.2", "changes": [ diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index d3cf9ad5f..7940d044f 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -65,15 +65,11 @@ "@0xproject/dev-utils": "^0.4.1", "@0xproject/migrations": "^0.0.5", "@0xproject/monorepo-scripts": "^0.1.19", - "@0xproject/subproviders": "^0.10.1", "@0xproject/tslint-config": "^0.4.17", - "@types/bintrees": "^1.0.2", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", "@types/node": "^8.0.53", - "@types/request": "2.47.0", "@types/sinon": "^2.2.2", - "@types/uuid": "^3.4.2", "awesome-typescript-loader": "^3.1.3", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", @@ -86,35 +82,26 @@ "nyc": "^11.0.1", "opn-cli": "^3.1.0", "prettier": "^1.11.1", - "request": "^2.81.0", "shx": "^0.2.2", "sinon": "^4.0.0", "source-map-support": "^0.5.0", "tslint": "5.8.0", "typedoc": "0xProject/typedoc", "typescript": "2.7.1", - "web3-provider-engine": "^14.0.4", "webpack": "^3.1.0" }, "dependencies": { "@0xproject/assert": "^0.2.9", "@0xproject/base-contract": "^0.3.1", - "@0xproject/json-schemas": "^0.7.23", + "@0xproject/contract-wrappers": "^0.0.1", + "@0xproject/order-watcher": "^0.0.1", "@0xproject/order-utils": "^0.0.4", "@0xproject/types": "^0.6.3", "@0xproject/typescript-typings": "^0.3.1", "@0xproject/utils": "^0.6.1", "@0xproject/web3-wrapper": "^0.6.3", - "bintrees": "^1.0.2", - "bn.js": "^4.11.8", - "ethereumjs-abi": "^0.6.4", - "ethereumjs-blockstream": "^2.0.6", - "ethereumjs-util": "^5.1.1", "ethers": "^3.0.15", - "js-sha3": "^0.7.0", - "lodash": "^4.17.4", - "uuid": "^3.1.0", - "web3": "^0.20.0" + "lodash": "^4.17.4" }, "publishConfig": { "access": "public" diff --git a/packages/0x.js/src/0x.ts b/packages/0x.js/src/0x.ts index 78f9f6beb..e670bd0c5 100644 --- a/packages/0x.js/src/0x.ts +++ b/packages/0x.js/src/0x.ts @@ -1,4 +1,13 @@ -import { schemas, SchemaValidator } from '@0xproject/json-schemas'; +import { assert } from '@0xproject/assert'; +import { + ContractWrappers, + EtherTokenWrapper, + ExchangeWrapper, + TokenRegistryWrapper, + TokenTransferProxyWrapper, + TokenWrapper, + ZeroExContractConfig, +} from '@0xproject/contract-wrappers'; import { generatePseudoRandomSalt, getOrderHashHex, @@ -6,27 +15,13 @@ import { isValidSignature, signOrderHashAsync, } from '@0xproject/order-utils'; +import { OrderWatcher, OrderWatcherConfig } from '@0xproject/order-watcher'; import { ECSignature, Order, Provider, SignedOrder, TransactionReceiptWithDecodedLogs } from '@0xproject/types'; -import { AbiDecoder, BigNumber, intervalUtils } from '@0xproject/utils'; +import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethUtil from 'ethereumjs-util'; import * as _ from 'lodash'; -import { artifacts } from './artifacts'; -import { EtherTokenWrapper } from './contract_wrappers/ether_token_wrapper'; -import { ExchangeWrapper } from './contract_wrappers/exchange_wrapper'; -import { TokenRegistryWrapper } from './contract_wrappers/token_registry_wrapper'; -import { TokenTransferProxyWrapper } from './contract_wrappers/token_transfer_proxy_wrapper'; -import { TokenWrapper } from './contract_wrappers/token_wrapper'; -import { OrderStateWatcher } from './order_watcher/order_state_watcher'; -import { zeroExConfigSchema } from './schemas/zero_ex_config_schema'; -import { zeroExPrivateNetworkConfigSchema } from './schemas/zero_ex_private_network_config_schema'; -import { zeroExPublicNetworkConfigSchema } from './schemas/zero_ex_public_network_config_schema'; -import { OrderStateWatcherConfig, ZeroExConfig, ZeroExError } from './types'; -import { assert } from './utils/assert'; import { constants } from './utils/constants'; -import { decorators } from './utils/decorators'; -import { utils } from './utils/utils'; /** * The ZeroEx class is the single entry-point into the 0x.js library. It contains all of the library's functionality @@ -62,7 +57,7 @@ export class ZeroEx { * tokenTransferProxy smart contract. */ public proxy: TokenTransferProxyWrapper; - private _web3Wrapper: Web3Wrapper; + private _contractWrappers: ContractWrappers; /** * Generates a pseudo-random 256-bit salt. * The salt can be included in a 0x order, ensuring that the order generates a unique orderHash @@ -136,40 +131,15 @@ export class ZeroEx { * @param config The configuration object. Look up the type for the description. * @return An instance of the 0x.js ZeroEx class. */ - constructor(provider: Provider, config: ZeroExConfig) { + constructor(provider: Provider, config: ZeroExContractConfig) { assert.isWeb3Provider('provider', provider); - assert.doesConformToSchema('config', config, zeroExConfigSchema, [ - zeroExPrivateNetworkConfigSchema, - zeroExPublicNetworkConfigSchema, - ]); - const artifactJSONs = _.values(artifacts); - const abiArrays = _.map(artifactJSONs, artifact => artifact.abi); - const defaults = { - gasPrice: config.gasPrice, - }; - this._web3Wrapper = new Web3Wrapper(provider, defaults); - _.forEach(abiArrays, abi => { - this._web3Wrapper.abiDecoder.addABI(abi); - }); - this.proxy = new TokenTransferProxyWrapper( - this._web3Wrapper, - config.networkId, - config.tokenTransferProxyContractAddress, - ); - this.token = new TokenWrapper(this._web3Wrapper, config.networkId, this.proxy); - this.exchange = new ExchangeWrapper( - this._web3Wrapper, - config.networkId, - this.token, - config.exchangeContractAddress, - config.zrxContractAddress, - ); - this.tokenRegistry = new TokenRegistryWrapper( - this._web3Wrapper, - config.networkId, - config.tokenRegistryContractAddress, - ); - this.etherToken = new EtherTokenWrapper(this._web3Wrapper, config.networkId, this.token); + this._contractWrappers = new ContractWrappers(provider, config); + + this.proxy = this._contractWrappers.proxy; + this.token = this._contractWrappers.token; + this.exchange = this._contractWrappers.exchange; + this.tokenRegistry = this._contractWrappers.tokenRegistry; + this.etherToken = this._contractWrappers.etherToken; } /** * Sets a new web3 provider for 0x.js. Updating the provider will stop all @@ -178,31 +148,23 @@ export class ZeroEx { * @param networkId The id of the network your provider is connected to */ public setProvider(provider: Provider, networkId: number): void { - this._web3Wrapper.setProvider(provider); - (this.exchange as any)._invalidateContractInstances(); - (this.exchange as any)._setNetworkId(networkId); - (this.tokenRegistry as any)._invalidateContractInstance(); - (this.tokenRegistry as any)._setNetworkId(networkId); - (this.token as any)._invalidateContractInstances(); - (this.token as any)._setNetworkId(networkId); - (this.proxy as any)._invalidateContractInstance(); - (this.proxy as any)._setNetworkId(networkId); - (this.etherToken as any)._invalidateContractInstance(); - (this.etherToken as any)._setNetworkId(networkId); + this._contractWrappers.setProvider(provider, networkId); } /** * Get the provider instance currently used by 0x.js * @return Web3 provider instance */ public getProvider(): Provider { - return this._web3Wrapper.getProvider(); + return this._contractWrappers.getProvider(); } /** * Get user Ethereum addresses available through the supplied web3 provider available for sending transactions. * @return An array of available user Ethereum addresses. */ public async getAvailableAddressesAsync(): Promise<string[]> { - const availableAddresses = await this._web3Wrapper.getAvailableAddressesAsync(); + // Hack: Get Web3Wrapper from ZeroExContract + const web3Wrapper = (this._contractWrappers as any)._web3Wrapper; + const availableAddresses = await web3Wrapper.getAvailableAddressesAsync(); return availableAddresses; } /** @@ -223,7 +185,7 @@ export class ZeroEx { shouldAddPersonalMessagePrefix: boolean, ): Promise<ECSignature> { return signOrderHashAsync( - this._web3Wrapper.getProvider(), + this._contractWrappers.getProvider(), orderHash, signerAddress, shouldAddPersonalMessagePrefix, @@ -241,7 +203,9 @@ export class ZeroEx { pollingIntervalMs = 1000, timeoutMs?: number, ): Promise<TransactionReceiptWithDecodedLogs> { - const transactionReceiptWithDecodedLogs = await this._web3Wrapper.awaitTransactionMinedAsync( + // Hack: Get Web3Wrapper from ZeroExContract + const web3Wrapper = (this._contractWrappers as any)._web3Wrapper; + const transactionReceiptWithDecodedLogs = await web3Wrapper.awaitTransactionMinedAsync( txHash, pollingIntervalMs, timeoutMs, @@ -249,22 +213,16 @@ export class ZeroEx { return transactionReceiptWithDecodedLogs; } /** - * Instantiates and returns a new OrderStateWatcher instance. + * Instantiates and returns a new OrderWatcher instance. * Defaults to watching the pending state. * @param config The configuration object. Look up the type for the description. - * @return An instance of the 0x.js OrderStateWatcher class. - */ - public createOrderStateWatcher(config?: OrderStateWatcherConfig) { - return new OrderStateWatcher(this._web3Wrapper, this.token, this.exchange, config); - } - /* - * HACK: `TokenWrapper` needs a token transfer proxy address. `TokenTransferProxy` address is fetched from - * an `ExchangeWrapper`. `ExchangeWrapper` needs `TokenWrapper` to validate orders, creating a dependency cycle. - * In order to break this - we create this function here and pass it as a parameter to the `TokenWrapper` - * and `ProxyWrapper`. - */ - private async _getTokenTransferProxyAddressAsync(): Promise<string> { - const tokenTransferProxyAddress = await (this.exchange as any)._getTokenTransferProxyAddressAsync(); - return tokenTransferProxyAddress; + * @return An instance of the 0x.js OrderWatcher class. + */ + public async createOrderWatcherAsync(config?: OrderWatcherConfig) { + // Hack: Get Web3Wrapper from ZeroExContract + const web3Wrapper = (this._contractWrappers as any)._web3Wrapper; + const networkId = web3Wrapper.getNetworkIdAsync(); + const provider = this._contractWrappers.getProvider(); + return new OrderWatcher(provider, networkId, config); } } diff --git a/packages/0x.js/src/artifacts.ts b/packages/0x.js/src/artifacts.ts deleted file mode 100644 index a91d9ae1f..000000000 --- a/packages/0x.js/src/artifacts.ts +++ /dev/null @@ -1,18 +0,0 @@ -import * as DummyTokenArtifact from './compact_artifacts/DummyToken.json'; -import * as EtherTokenArtifact from './compact_artifacts/EtherToken.json'; -import * as ExchangeArtifact from './compact_artifacts/Exchange.json'; -import * as TokenArtifact from './compact_artifacts/Token.json'; -import * as TokenRegistryArtifact from './compact_artifacts/TokenRegistry.json'; -import * as TokenTransferProxyArtifact from './compact_artifacts/TokenTransferProxy.json'; -import * as ZRXArtifact from './compact_artifacts/ZRX.json'; -import { Artifact } from './types'; - -export const artifacts = { - ZRXArtifact: (ZRXArtifact as any) as Artifact, - DummyTokenArtifact: (DummyTokenArtifact as any) as Artifact, - TokenArtifact: (TokenArtifact as any) as Artifact, - ExchangeArtifact: (ExchangeArtifact as any) as Artifact, - EtherTokenArtifact: (EtherTokenArtifact as any) as Artifact, - TokenRegistryArtifact: (TokenRegistryArtifact as any) as Artifact, - TokenTransferProxyArtifact: (TokenTransferProxyArtifact as any) as Artifact, -}; diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index 3b973bd54..e9528d4d1 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -1,61 +1,51 @@ export { ZeroEx } from './0x'; export { - ZeroExError, - EventCallback, - ExchangeContractErrs, - ContractEvent, - Token, - IndexedFilterValues, - BlockRange, - OrderCancellationRequest, - OrderFillRequest, - ContractEventArgs, - ZeroExConfig, - MethodOpts, - OrderTransactionOpts, - TransactionOpts, - LogEvent, - DecodedLogEvent, - EventWatcherCallback, - OnOrderStateChangeCallback, - OrderStateValid, - OrderStateInvalid, - OrderState, -} from './types'; - -export { BlockParamLiteral, FilterObject, BlockParam, ContractEventArg, + ExchangeContractErrs, LogWithDecodedArgs, Order, Provider, SignedOrder, ECSignature, + OrderStateValid, + OrderStateInvalid, + OrderState, + Token, TransactionReceipt, TransactionReceiptWithDecodedLogs, } from '@0xproject/types'; export { + EventCallback, + ContractEvent, + IndexedFilterValues, + BlockRange, + OrderCancellationRequest, + OrderFillRequest, + ContractEventArgs, + MethodOpts, + OrderTransactionOpts, + TransactionOpts, + LogEvent, + DecodedLogEvent, + OnOrderStateChangeCallback, + ContractWrappersError, EtherTokenContractEventArgs, WithdrawalContractEventArgs, DepositContractEventArgs, EtherTokenEvents, -} from './contract_wrappers/generated/ether_token'; - -export { TransferContractEventArgs, ApprovalContractEventArgs, TokenContractEventArgs, TokenEvents, -} from './contract_wrappers/generated/token'; - -export { LogErrorContractEventArgs, LogCancelContractEventArgs, LogFillContractEventArgs, ExchangeContractEventArgs, ExchangeEvents, -} from './contract_wrappers/generated/exchange'; + ZeroExContractConfig, +} from '@0xproject/contract-wrappers'; diff --git a/packages/0x.js/src/types.ts b/packages/0x.js/src/types.ts index ae9f98c5f..516bef8a3 100644 --- a/packages/0x.js/src/types.ts +++ b/packages/0x.js/src/types.ts @@ -1,23 +1,16 @@ -import { BigNumber } from '@0xproject/utils'; - import { BlockParam, BlockParamLiteral, ContractAbi, ContractEventArg, + ExchangeContractErrs, FilterObject, - LogEntryEvent, LogWithDecodedArgs, Order, + OrderState, SignedOrder, } from '@0xproject/types'; -import * as Web3 from 'web3'; - -import { EtherTokenContractEventArgs, EtherTokenEvents } from './contract_wrappers/generated/ether_token'; -import { ExchangeContractEventArgs, ExchangeEvents } from './contract_wrappers/generated/exchange'; -import { TokenContractEventArgs, TokenEvents } from './contract_wrappers/generated/token'; - export enum ZeroExError { ExchangeContractDoesNotExist = 'EXCHANGE_CONTRACT_DOES_NOT_EXIST', ZRXContractDoesNotExist = 'ZRX_CONTRACT_DOES_NOT_EXIST', @@ -45,232 +38,4 @@ export enum InternalZeroExError { WethNotInTokenRegistry = 'WETH_NOT_IN_TOKEN_REGISTRY', } -export type OrderAddresses = [string, string, string, string, string]; - -export type OrderValues = [BigNumber, BigNumber, BigNumber, BigNumber, BigNumber, BigNumber]; - -export type LogEvent = LogEntryEvent; -export interface DecodedLogEvent<ArgsType> { - isRemoved: boolean; - log: LogWithDecodedArgs<ArgsType>; -} - -export type EventCallback<ArgsType> = (err: null | Error, log?: DecodedLogEvent<ArgsType>) => void; -export type EventWatcherCallback = (err: null | Error, log?: LogEvent) => void; - -export enum ExchangeContractErrCodes { - ERROR_FILL_EXPIRED, // Order has already expired - ERROR_FILL_NO_VALUE, // Order has already been fully filled or cancelled - ERROR_FILL_TRUNCATION, // Rounding error too large - ERROR_FILL_BALANCE_ALLOWANCE, // Insufficient balance or allowance for token transfer - ERROR_CANCEL_EXPIRED, // Order has already expired - ERROR_CANCEL_NO_VALUE, // Order has already been fully filled or cancelled -} - -export enum ExchangeContractErrs { - OrderFillExpired = 'ORDER_FILL_EXPIRED', - OrderCancelExpired = 'ORDER_CANCEL_EXPIRED', - OrderCancelAmountZero = 'ORDER_CANCEL_AMOUNT_ZERO', - OrderAlreadyCancelledOrFilled = 'ORDER_ALREADY_CANCELLED_OR_FILLED', - OrderFillAmountZero = 'ORDER_FILL_AMOUNT_ZERO', - OrderRemainingFillAmountZero = 'ORDER_REMAINING_FILL_AMOUNT_ZERO', - OrderFillRoundingError = 'ORDER_FILL_ROUNDING_ERROR', - FillBalanceAllowanceError = 'FILL_BALANCE_ALLOWANCE_ERROR', - InsufficientTakerBalance = 'INSUFFICIENT_TAKER_BALANCE', - InsufficientTakerAllowance = 'INSUFFICIENT_TAKER_ALLOWANCE', - InsufficientMakerBalance = 'INSUFFICIENT_MAKER_BALANCE', - InsufficientMakerAllowance = 'INSUFFICIENT_MAKER_ALLOWANCE', - InsufficientTakerFeeBalance = 'INSUFFICIENT_TAKER_FEE_BALANCE', - InsufficientTakerFeeAllowance = 'INSUFFICIENT_TAKER_FEE_ALLOWANCE', - InsufficientMakerFeeBalance = 'INSUFFICIENT_MAKER_FEE_BALANCE', - InsufficientMakerFeeAllowance = 'INSUFFICIENT_MAKER_FEE_ALLOWANCE', - TransactionSenderIsNotFillOrderTaker = 'TRANSACTION_SENDER_IS_NOT_FILL_ORDER_TAKER', - MultipleMakersInSingleCancelBatchDisallowed = 'MULTIPLE_MAKERS_IN_SINGLE_CANCEL_BATCH_DISALLOWED', - InsufficientRemainingFillAmount = 'INSUFFICIENT_REMAINING_FILL_AMOUNT', - MultipleTakerTokensInFillUpToDisallowed = 'MULTIPLE_TAKER_TOKENS_IN_FILL_UP_TO_DISALLOWED', - BatchOrdersMustHaveSameExchangeAddress = 'BATCH_ORDERS_MUST_HAVE_SAME_EXCHANGE_ADDRESS', - BatchOrdersMustHaveAtLeastOneItem = 'BATCH_ORDERS_MUST_HAVE_AT_LEAST_ONE_ITEM', -} - -export interface ContractEvent { - logIndex: number; - transactionIndex: number; - transactionHash: string; - blockHash: string; - blockNumber: number; - address: string; - type: string; - event: string; - args: ContractEventArgs; -} - -export type ContractEventArgs = ExchangeContractEventArgs | TokenContractEventArgs | EtherTokenContractEventArgs; - -// [address, name, symbol, decimals, ipfsHash, swarmHash] -export type TokenMetadata = [string, string, string, number, string, string]; - -export interface Token { - name: string; - address: string; - symbol: string; - decimals: number; -} - -export interface TxOpts { - from: string; - gas?: number; - value?: BigNumber; - gasPrice?: BigNumber; -} - -export interface TokenAddressBySymbol { - [symbol: string]: string; -} - -export type ContractEvents = TokenEvents | ExchangeEvents | EtherTokenEvents; - -export interface IndexedFilterValues { - [index: string]: ContractEventArg; -} - -export interface BlockRange { - fromBlock: BlockParam; - toBlock: BlockParam; -} - -export type DoneCallback = (err?: Error) => void; - -export interface OrderCancellationRequest { - order: Order | SignedOrder; - takerTokenCancelAmount: BigNumber; -} - -export interface OrderFillRequest { - signedOrder: SignedOrder; - takerTokenFillAmount: BigNumber; -} - -export type AsyncMethod = (...args: any[]) => Promise<any>; -export type SyncMethod = (...args: any[]) => any; - -/** - * orderExpirationCheckingIntervalMs: How often to check for expired orders. Default=50. - * eventPollingIntervalMs: How often to poll the Ethereum node for new events. Default=200. - * expirationMarginMs: Amount of time before order expiry that you'd like to be notified - * of an orders expiration. Default=0. - * cleanupJobIntervalMs: How often to run a cleanup job which revalidates all the orders. Default=1hr. - * stateLayer: Optional blockchain state layer OrderWatcher will monitor for new events. Default=latest. - */ -export interface OrderStateWatcherConfig { - orderExpirationCheckingIntervalMs?: number; - eventPollingIntervalMs?: number; - expirationMarginMs?: number; - cleanupJobIntervalMs?: number; - stateLayer: BlockParamLiteral; -} - -/** - * networkId: The id of the underlying ethereum network your provider is connected to. (1-mainnet, 3-ropsten, 4-rinkeby, 42-kovan, 50-testrpc) - * gasPrice: Gas price to use with every transaction - * exchangeContractAddress: The address of an exchange contract to use - * zrxContractAddress: The address of the ZRX contract to use - * tokenRegistryContractAddress: The address of a token registry contract to use - * tokenTransferProxyContractAddress: The address of the token transfer proxy contract to use - * orderWatcherConfig: All the configs related to the orderWatcher - */ -export interface ZeroExConfig { - networkId: number; - gasPrice?: BigNumber; - exchangeContractAddress?: string; - zrxContractAddress?: string; - tokenRegistryContractAddress?: string; - tokenTransferProxyContractAddress?: string; - orderWatcherConfig?: OrderStateWatcherConfig; -} - -export type ArtifactContractName = 'ZRX' | 'TokenTransferProxy' | 'TokenRegistry' | 'Token' | 'Exchange' | 'EtherToken'; - -export interface Artifact { - contract_name: ArtifactContractName; - abi: ContractAbi; - networks: { - [networkId: number]: { - address: string; - }; - }; -} - -/** - * expectedFillTakerTokenAmount: If specified, the validation method will ensure that the - * supplied order maker has a sufficient allowance/balance to fill this amount of the order's - * takerTokenAmount. If not specified, the validation method ensures that the maker has a sufficient - * allowance/balance to fill the entire remaining order amount. - */ -export interface ValidateOrderFillableOpts { - expectedFillTakerTokenAmount?: BigNumber; -} - -/** - * defaultBlock: The block up to which to query the blockchain state. Setting this to a historical block number - * let's the user query the blockchain's state at an arbitrary point in time. In order for this to work, the - * backing Ethereum node must keep the entire historical state of the chain (e.g setting `--pruning=archive` - * flag when running Parity). - */ -export interface MethodOpts { - defaultBlock?: BlockParam; -} - -/** - * gasPrice: Gas price in Wei to use for a transaction - * gasLimit: The amount of gas to send with a transaction - */ -export interface TransactionOpts { - gasPrice?: BigNumber; - gasLimit?: number; -} - -/** - * shouldValidate: Flag indicating whether the library should make attempts to validate a transaction before - * broadcasting it. For example, order has a valid signature, maker has sufficient funds, etc. Default=true. - */ -export interface OrderTransactionOpts extends TransactionOpts { - shouldValidate?: boolean; -} - -export enum TradeSide { - Maker = 'maker', - Taker = 'taker', -} - -export enum TransferType { - Trade = 'trade', - Fee = 'fee', -} - -export interface OrderRelevantState { - makerBalance: BigNumber; - makerProxyAllowance: BigNumber; - makerFeeBalance: BigNumber; - makerFeeProxyAllowance: BigNumber; - filledTakerTokenAmount: BigNumber; - cancelledTakerTokenAmount: BigNumber; - remainingFillableMakerTokenAmount: BigNumber; - remainingFillableTakerTokenAmount: BigNumber; -} - -export interface OrderStateValid { - isValid: true; - orderHash: string; - orderRelevantState: OrderRelevantState; -} - -export interface OrderStateInvalid { - isValid: false; - orderHash: string; - error: ExchangeContractErrs; -} - -export type OrderState = OrderStateValid | OrderStateInvalid; - -export type OnOrderStateChangeCallback = (err: Error | null, orderState?: OrderState) => void; // tslint:disable:max-file-line-count diff --git a/packages/0x.js/src/utils/constants.ts b/packages/0x.js/src/utils/constants.ts index 07da6745d..7cd5eb574 100644 --- a/packages/0x.js/src/utils/constants.ts +++ b/packages/0x.js/src/utils/constants.ts @@ -3,9 +3,4 @@ import { BigNumber } from '@0xproject/utils'; export const constants = { NULL_ADDRESS: '0x0000000000000000000000000000000000000000', TESTRPC_NETWORK_ID: 50, - INVALID_JUMP_PATTERN: 'invalid JUMP at', - OUT_OF_GAS_PATTERN: 'out of gas', - INVALID_TAKER_FORMAT: 'instance.taker is not of a type(s) string', - UNLIMITED_ALLOWANCE_IN_BASE_UNITS: new BigNumber(2).pow(256).minus(1), - DEFAULT_BLOCK_POLLING_INTERVAL: 1000, }; diff --git a/packages/0x.js/test/0x.js_test.ts b/packages/0x.js/test/0x.js_test.ts index 6dccdaea7..fe5948e00 100644 --- a/packages/0x.js/test/0x.js_test.ts +++ b/packages/0x.js/test/0x.js_test.ts @@ -41,8 +41,8 @@ describe('ZeroEx library', () => { expect((zeroEx.exchange as any)._exchangeContractIfExists).to.be.undefined(); expect((zeroEx.tokenRegistry as any)._tokenRegistryContractIfExists).to.be.undefined(); - // Check that all nested web3 wrapper instances return the updated provider - const nestedWeb3WrapperProvider = (zeroEx as any)._web3Wrapper.getProvider(); + // Check that all nested zeroExContract/web3Wrapper instances return the updated provider + const nestedWeb3WrapperProvider = (zeroEx as any)._contractWrappers.getProvider(); expect(nestedWeb3WrapperProvider.zeroExTestId).to.be.a('number'); const exchangeWeb3WrapperProvider = (zeroEx.exchange as any)._web3Wrapper.getProvider(); expect(exchangeWeb3WrapperProvider.zeroExTestId).to.be.a('number'); diff --git a/packages/0x.js/test/assert_test.ts b/packages/0x.js/test/assert_test.ts deleted file mode 100644 index e69de29bb..000000000 --- a/packages/0x.js/test/assert_test.ts +++ /dev/null diff --git a/packages/0x.js/test/utils/report_callback_errors.ts b/packages/0x.js/test/utils/report_callback_errors.ts deleted file mode 100644 index 27c9745c9..000000000 --- a/packages/0x.js/test/utils/report_callback_errors.ts +++ /dev/null @@ -1,66 +0,0 @@ -import * as chai from 'chai'; -import * as _ from 'lodash'; - -import { DoneCallback } from '../../src/types'; - -const expect = chai.expect; - -export const reportNoErrorCallbackErrors = (done: DoneCallback, expectToBeCalledOnce = true) => { - return <T>(f?: (value: T) => void) => { - const wrapped = (value: T) => { - if (_.isUndefined(f)) { - done(); - return; - } - try { - f(value); - if (expectToBeCalledOnce) { - done(); - } - } catch (err) { - done(err); - } - }; - return wrapped; - }; -}; - -export const reportNodeCallbackErrors = (done: DoneCallback, expectToBeCalledOnce = true) => { - return <T>(f?: (value: T) => void) => { - const wrapped = (error: Error | null, value: T | undefined) => { - if (!_.isNull(error)) { - done(error); - } else { - if (_.isUndefined(f)) { - done(); - return; - } - try { - f(value as T); - if (expectToBeCalledOnce) { - done(); - } - } catch (err) { - done(err); - } - } - }; - return wrapped; - }; -}; - -export const assertNodeCallbackError = (done: DoneCallback, errMsg: string) => { - const wrapped = <T>(error: Error | null, value: T | undefined) => { - if (_.isNull(error)) { - done(new Error('Expected callback to receive an error')); - } else { - try { - expect(error.message).to.be.equal(errMsg); - done(); - } catch (err) { - done(err); - } - } - }; - return wrapped; -}; diff --git a/packages/0x.js/test/utils/token_utils.ts b/packages/0x.js/test/utils/token_utils.ts index d3fc22ff4..fe4886ba4 100644 --- a/packages/0x.js/test/utils/token_utils.ts +++ b/packages/0x.js/test/utils/token_utils.ts @@ -1,6 +1,7 @@ +import { Token } from '@0xproject/types'; import * as _ from 'lodash'; -import { InternalZeroExError, Token } from '../../src/types'; +import { InternalZeroExError } from '../../src/types'; const PROTOCOL_TOKEN_SYMBOL = 'ZRX'; const WETH_TOKEN_SYMBOL = 'WETH'; diff --git a/packages/contract-wrappers/.npmignore b/packages/contract-wrappers/.npmignore new file mode 100644 index 000000000..6a3eb57bd --- /dev/null +++ b/packages/contract-wrappers/.npmignore @@ -0,0 +1,11 @@ +.* +tsconfig.json +webpack.config.js +yarn-error.log +test/ +/src/ +/_bundles/ +/contract_templates/ +/generated_docs/ +/scripts/ +/lib/src/monorepo_scripts/ diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json new file mode 100644 index 000000000..523d370f6 --- /dev/null +++ b/packages/contract-wrappers/CHANGELOG.json @@ -0,0 +1,10 @@ +[ + { + "version": "0.0.1", + "changes": [ + { + "note": "Moved contractWrappers out of 0x.js" + } + ] + } +] diff --git a/packages/contract-wrappers/CHANGELOG.md b/packages/contract-wrappers/CHANGELOG.md new file mode 100644 index 000000000..5565d6210 --- /dev/null +++ b/packages/contract-wrappers/CHANGELOG.md @@ -0,0 +1,6 @@ +<!-- +This file is auto-generated using the monorepo-scripts package. Don't edit directly. +Edit the package's CHANGELOG.json file only. +--> + +CHANGELOG diff --git a/packages/contract-wrappers/README.md b/packages/contract-wrappers/README.md new file mode 100644 index 000000000..0fca4c762 --- /dev/null +++ b/packages/contract-wrappers/README.md @@ -0,0 +1,91 @@ +## @0xproject/contract-wrappers + +Smart TS wrappers for 0x smart contracts. The wrappers have simplified interfaces, perform client-side validation on transactions and throw helpful error messages. + +### Read the [Documentation](https://0xproject.com/docs/0x.js). + +## Installation + +**Install** + +```bash +npm install @0xproject/contract-wrappers --save +``` + +**Import** + +```javascript +import { ContractWrappers } from '@0xproject/contract-wrappers'; +``` + +If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`: + +```json +"compilerOptions": { + "typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"], +} +``` + +## Contributing + +We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository. + +Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started. + +### Install dependencies + +If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them: + +```bash +yarn config set workspaces-experimental true +``` + +Then install dependencies + +```bash +yarn install +``` + +### Build + +If this is your **first** time building this package, you must first build **all** packages within the monorepo. This is because packages that depend on other packages located inside this monorepo are symlinked when run from **within** the monorepo. This allows you to make changes across multiple packages without first publishing dependent packages to NPM. To build all packages, run the following from the monorepo root directory: + +```bash +yarn lerna:rebuild +``` + +Or continuously rebuild on change: + +```bash +yarn dev +``` + +You can also build this specific package by running the following from within its directory: + +```bash +yarn build +``` + +or continuously rebuild on change: + +```bash +yarn build:watch +``` + +### Clean + +```bash +yarn clean +``` + +### Lint + +```bash +yarn lint +``` + +### Run Tests + +```bash +yarn test +``` diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json new file mode 100644 index 000000000..984cbfdbe --- /dev/null +++ b/packages/contract-wrappers/package.json @@ -0,0 +1,95 @@ +{ + "name": "@0xproject/contract-wrappers", + "version": "0.0.1", + "description": "Smart TS wrappers for 0x smart contracts", + "keywords": [ + "0xproject", + "ethereum", + "tokens", + "exchange" + ], + "main": "lib/src/index.js", + "types": "lib/src/index.d.ts", + "scripts": { + "build:watch": "tsc -w", + "prebuild": "run-s clean generate_contract_wrappers", + "generate_contract_wrappers": "node ../abi-gen/lib/index.js --abis 'src/compact_artifacts/@(Exchange|Token|TokenTransferProxy|EtherToken|TokenRegistry|DummyToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers && prettier --write 'src/contract_wrappers/generated/**.ts'", + "lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'", + "test:circleci": "run-s test:coverage", + "test": "run-s clean build run_mocha", + "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", + "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", + "update_artifacts": "for i in ${npm_package_config_contracts}; do copyfiles -u 4 ../migrations/src/artifacts/$i.json test/artifacts; done;", + "clean": "shx rm -rf _bundles lib test_temp scripts", + "build": "tsc && yarn update_artifacts && copyfiles -u 2 './src/compact_artifacts/**/*.json' ./lib/src/compact_artifacts && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "run_mocha": "mocha lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit", + "manual:postpublish": "yarn build; node ./scripts/postpublish.js" + }, + "config": { + "compact_artifacts": "Exchange DummyToken ZRXToken Token EtherToken TokenTransferProxy TokenRegistry", + "contracts": "Exchange DummyToken ZRXToken Token WETH9 TokenTransferProxy MultiSigWallet MultiSigWalletWithTimeLock MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress MaliciousToken TokenRegistry Arbitrage EtherDelta AccountLevels", + "postpublish": { + "assets": [ + "packages/contract-wrappers/_bundles/index.js", + "packages/contract-wrappers/_bundles/index.min.js" + ] + } + }, + "repository": { + "type": "git", + "url": "https://github.com/0xProject/0x-monorepo" + }, + "license": "Apache-2.0", + "engines": { + "node": ">=6.0.0" + }, + "devDependencies": { + "@0xproject/deployer": "^0.4.3", + "@0xproject/dev-utils": "^0.4.1", + "@0xproject/migrations": "^0.0.5", + "@0xproject/monorepo-scripts": "^0.1.19", + "@0xproject/subproviders": "^0.10.1", + "@0xproject/tslint-config": "^0.4.17", + "@types/lodash": "4.14.104", + "@types/mocha": "^2.2.42", + "@types/node": "^8.0.53", + "@types/sinon": "^2.2.2", + "awesome-typescript-loader": "^3.1.3", + "chai": "^4.0.1", + "chai-as-promised": "^7.1.0", + "chai-bignumber": "^2.0.1", + "copyfiles": "^1.2.0", + "dirty-chai": "^2.0.1", + "mocha": "^4.0.1", + "npm-run-all": "^4.1.2", + "nyc": "^11.0.1", + "opn-cli": "^3.1.0", + "prettier": "^1.11.1", + "shx": "^0.2.2", + "sinon": "^4.0.0", + "source-map-support": "^0.5.0", + "tslint": "5.8.0", + "typescript": "2.7.1", + "web3-provider-engine": "^14.0.4" + }, + "dependencies": { + "@0xproject/assert": "^0.2.9", + "@0xproject/base-contract": "^0.3.1", + "@0xproject/fill-scenarios": "^0.0.1", + "@0xproject/json-schemas": "^0.7.23", + "@0xproject/order-utils": "^0.0.4", + "@0xproject/types": "^0.6.3", + "@0xproject/typescript-typings": "^0.3.1", + "@0xproject/utils": "^0.6.1", + "@0xproject/web3-wrapper": "^0.6.3", + "ethereumjs-blockstream": "^2.0.6", + "ethereumjs-util": "^5.1.1", + "ethers": "^3.0.15", + "js-sha3": "^0.7.0", + "lodash": "^4.17.4", + "uuid": "^3.1.0" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/contract-wrappers/src/artifacts.ts b/packages/contract-wrappers/src/artifacts.ts new file mode 100644 index 000000000..13587984c --- /dev/null +++ b/packages/contract-wrappers/src/artifacts.ts @@ -0,0 +1,18 @@ +import { Artifact } from '@0xproject/types'; + +import * as DummyToken from './compact_artifacts/DummyToken.json'; +import * as EtherToken from './compact_artifacts/EtherToken.json'; +import * as Exchange from './compact_artifacts/Exchange.json'; +import * as Token from './compact_artifacts/Token.json'; +import * as TokenRegistry from './compact_artifacts/TokenRegistry.json'; +import * as TokenTransferProxy from './compact_artifacts/TokenTransferProxy.json'; +import * as ZRX from './compact_artifacts/ZRX.json'; +export const artifacts = { + ZRX: (ZRX as any) as Artifact, + DummyToken: (DummyToken as any) as Artifact, + Token: (Token as any) as Artifact, + Exchange: (Exchange as any) as Artifact, + EtherToken: (EtherToken as any) as Artifact, + TokenRegistry: (TokenRegistry as any) as Artifact, + TokenTransferProxy: (TokenTransferProxy as any) as Artifact, +}; diff --git a/packages/contract-wrappers/src/compact_artifacts/DummyToken.json b/packages/contract-wrappers/src/compact_artifacts/DummyToken.json new file mode 100644 index 000000000..f64a8cd3d --- /dev/null +++ b/packages/contract-wrappers/src/compact_artifacts/DummyToken.json @@ -0,0 +1,22 @@ +{ + "contract_name": "DummyToken", + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "_target", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "setBalance", + "outputs": [], + "payable": false, + "type": "function" + } + ] +} diff --git a/packages/contract-wrappers/src/compact_artifacts/EtherToken.json b/packages/contract-wrappers/src/compact_artifacts/EtherToken.json new file mode 100644 index 000000000..26cca57cd --- /dev/null +++ b/packages/contract-wrappers/src/compact_artifacts/EtherToken.json @@ -0,0 +1,287 @@ +{ + "contract_name": "EtherToken", + "abi": [ + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_spender", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "name": "", + "type": "uint8" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "deposit", + "outputs": [], + "payable": true, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "payable": true, + "type": "fallback" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_from", + "type": "address" + }, + { + "indexed": true, + "name": "_to", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "name": "_spender", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Withdrawal", + "type": "event" + } + ], + "networks": { + "1": { + "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" + }, + "3": { + "address": "0xc00fd9820cd2898cc4c054b7bf142de637ad129a" + }, + "4": { + "address": "0xc778417e063141139fce010982780140aa0cd5ab" + }, + "42": { + "address": "0x653e49e301e508a13237c0ddc98ae7d4cd2667a1" + }, + "50": { + "address": "0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c" + } + } +} diff --git a/packages/contract-wrappers/src/compact_artifacts/Exchange.json b/packages/contract-wrappers/src/compact_artifacts/Exchange.json new file mode 100644 index 000000000..af8db7360 --- /dev/null +++ b/packages/contract-wrappers/src/compact_artifacts/Exchange.json @@ -0,0 +1,610 @@ +{ + "contract_name": "Exchange", + "abi": [ + { + "constant": true, + "inputs": [ + { + "name": "numerator", + "type": "uint256" + }, + { + "name": "denominator", + "type": "uint256" + }, + { + "name": "target", + "type": "uint256" + } + ], + "name": "isRoundingError", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "name": "filled", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "name": "cancelled", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5][]" + }, + { + "name": "orderValues", + "type": "uint256[6][]" + }, + { + "name": "fillTakerTokenAmount", + "type": "uint256" + }, + { + "name": "shouldThrowOnInsufficientBalanceOrAllowance", + "type": "bool" + }, + { + "name": "v", + "type": "uint8[]" + }, + { + "name": "r", + "type": "bytes32[]" + }, + { + "name": "s", + "type": "bytes32[]" + } + ], + "name": "fillOrdersUpTo", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5]" + }, + { + "name": "orderValues", + "type": "uint256[6]" + }, + { + "name": "cancelTakerTokenAmount", + "type": "uint256" + } + ], + "name": "cancelOrder", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "ZRX_TOKEN_CONTRACT", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5][]" + }, + { + "name": "orderValues", + "type": "uint256[6][]" + }, + { + "name": "fillTakerTokenAmounts", + "type": "uint256[]" + }, + { + "name": "v", + "type": "uint8[]" + }, + { + "name": "r", + "type": "bytes32[]" + }, + { + "name": "s", + "type": "bytes32[]" + } + ], + "name": "batchFillOrKillOrders", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5]" + }, + { + "name": "orderValues", + "type": "uint256[6]" + }, + { + "name": "fillTakerTokenAmount", + "type": "uint256" + }, + { + "name": "v", + "type": "uint8" + }, + { + "name": "r", + "type": "bytes32" + }, + { + "name": "s", + "type": "bytes32" + } + ], + "name": "fillOrKillOrder", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "getUnavailableTakerTokenAmount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "signer", + "type": "address" + }, + { + "name": "hash", + "type": "bytes32" + }, + { + "name": "v", + "type": "uint8" + }, + { + "name": "r", + "type": "bytes32" + }, + { + "name": "s", + "type": "bytes32" + } + ], + "name": "isValidSignature", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "numerator", + "type": "uint256" + }, + { + "name": "denominator", + "type": "uint256" + }, + { + "name": "target", + "type": "uint256" + } + ], + "name": "getPartialAmount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "TOKEN_TRANSFER_PROXY_CONTRACT", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5][]" + }, + { + "name": "orderValues", + "type": "uint256[6][]" + }, + { + "name": "fillTakerTokenAmounts", + "type": "uint256[]" + }, + { + "name": "shouldThrowOnInsufficientBalanceOrAllowance", + "type": "bool" + }, + { + "name": "v", + "type": "uint8[]" + }, + { + "name": "r", + "type": "bytes32[]" + }, + { + "name": "s", + "type": "bytes32[]" + } + ], + "name": "batchFillOrders", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5][]" + }, + { + "name": "orderValues", + "type": "uint256[6][]" + }, + { + "name": "cancelTakerTokenAmounts", + "type": "uint256[]" + } + ], + "name": "batchCancelOrders", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5]" + }, + { + "name": "orderValues", + "type": "uint256[6]" + }, + { + "name": "fillTakerTokenAmount", + "type": "uint256" + }, + { + "name": "shouldThrowOnInsufficientBalanceOrAllowance", + "type": "bool" + }, + { + "name": "v", + "type": "uint8" + }, + { + "name": "r", + "type": "bytes32" + }, + { + "name": "s", + "type": "bytes32" + } + ], + "name": "fillOrder", + "outputs": [ + { + "name": "filledTakerTokenAmount", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5]" + }, + { + "name": "orderValues", + "type": "uint256[6]" + } + ], + "name": "getOrderHash", + "outputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "EXTERNAL_QUERY_GAS_LIMIT", + "outputs": [ + { + "name": "", + "type": "uint16" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "VERSION", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "type": "function" + }, + { + "inputs": [ + { + "name": "_zrxToken", + "type": "address" + }, + { + "name": "_tokenTransferProxy", + "type": "address" + } + ], + "payable": false, + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "maker", + "type": "address" + }, + { + "indexed": false, + "name": "taker", + "type": "address" + }, + { + "indexed": true, + "name": "feeRecipient", + "type": "address" + }, + { + "indexed": false, + "name": "makerToken", + "type": "address" + }, + { + "indexed": false, + "name": "takerToken", + "type": "address" + }, + { + "indexed": false, + "name": "filledMakerTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "name": "filledTakerTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "name": "paidMakerFee", + "type": "uint256" + }, + { + "indexed": false, + "name": "paidTakerFee", + "type": "uint256" + }, + { + "indexed": true, + "name": "tokens", + "type": "bytes32" + }, + { + "indexed": false, + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "LogFill", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "maker", + "type": "address" + }, + { + "indexed": true, + "name": "feeRecipient", + "type": "address" + }, + { + "indexed": false, + "name": "makerToken", + "type": "address" + }, + { + "indexed": false, + "name": "takerToken", + "type": "address" + }, + { + "indexed": false, + "name": "cancelledMakerTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "name": "cancelledTakerTokenAmount", + "type": "uint256" + }, + { + "indexed": true, + "name": "tokens", + "type": "bytes32" + }, + { + "indexed": false, + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "LogCancel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "errorId", + "type": "uint8" + }, + { + "indexed": true, + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "LogError", + "type": "event" + } + ], + "networks": { + "1": { + "address": "0x12459c951127e0c374ff9105dda097662a027093" + }, + "3": { + "address": "0x479cc461fecd078f766ecc58533d6f69580cf3ac" + }, + "4": { + "address": "0x1d16ef40fac01cec8adac2ac49427b9384192c05" + }, + "42": { + "address": "0x90fe2af704b34e0224bf2299c838e04d4dcf1364" + }, + "50": { + "address": "0x48bacb9266a570d521063ef5dd96e61686dbe788" + } + } +} diff --git a/packages/contract-wrappers/src/compact_artifacts/Token.json b/packages/contract-wrappers/src/compact_artifacts/Token.json new file mode 100644 index 000000000..3b5a86ae0 --- /dev/null +++ b/packages/contract-wrappers/src/compact_artifacts/Token.json @@ -0,0 +1,172 @@ +{ + "contract_name": "Token", + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "_spender", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "name": "success", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "name": "supply", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "success", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "balance", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "name": "success", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "name": "remaining", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_from", + "type": "address" + }, + { + "indexed": true, + "name": "_to", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "name": "_spender", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + } + ] +} diff --git a/packages/contract-wrappers/src/compact_artifacts/TokenRegistry.json b/packages/contract-wrappers/src/compact_artifacts/TokenRegistry.json new file mode 100644 index 000000000..0f583628c --- /dev/null +++ b/packages/contract-wrappers/src/compact_artifacts/TokenRegistry.json @@ -0,0 +1,547 @@ +{ + "contract_name": "TokenRegistry", + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_index", + "type": "uint256" + } + ], + "name": "removeToken", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_name", + "type": "string" + } + ], + "name": "getTokenAddressByName", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_symbol", + "type": "string" + } + ], + "name": "getTokenAddressBySymbol", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_swarmHash", + "type": "bytes" + } + ], + "name": "setTokenSwarmHash", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_token", + "type": "address" + } + ], + "name": "getTokenMetaData", + "outputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "uint8" + }, + { + "name": "", + "type": "bytes" + }, + { + "name": "", + "type": "bytes" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_name", + "type": "string" + }, + { + "name": "_symbol", + "type": "string" + }, + { + "name": "_decimals", + "type": "uint8" + }, + { + "name": "_ipfsHash", + "type": "bytes" + }, + { + "name": "_swarmHash", + "type": "bytes" + } + ], + "name": "addToken", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_name", + "type": "string" + } + ], + "name": "setTokenName", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "tokens", + "outputs": [ + { + "name": "token", + "type": "address" + }, + { + "name": "name", + "type": "string" + }, + { + "name": "symbol", + "type": "string" + }, + { + "name": "decimals", + "type": "uint8" + }, + { + "name": "ipfsHash", + "type": "bytes" + }, + { + "name": "swarmHash", + "type": "bytes" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "tokenAddresses", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_name", + "type": "string" + } + ], + "name": "getTokenByName", + "outputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "uint8" + }, + { + "name": "", + "type": "bytes" + }, + { + "name": "", + "type": "bytes" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getTokenAddresses", + "outputs": [ + { + "name": "", + "type": "address[]" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_ipfsHash", + "type": "bytes" + } + ], + "name": "setTokenIpfsHash", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_symbol", + "type": "string" + } + ], + "name": "getTokenBySymbol", + "outputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "uint8" + }, + { + "name": "", + "type": "bytes" + }, + { + "name": "", + "type": "bytes" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_symbol", + "type": "string" + } + ], + "name": "setTokenSymbol", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "name", + "type": "string" + }, + { + "indexed": false, + "name": "symbol", + "type": "string" + }, + { + "indexed": false, + "name": "decimals", + "type": "uint8" + }, + { + "indexed": false, + "name": "ipfsHash", + "type": "bytes" + }, + { + "indexed": false, + "name": "swarmHash", + "type": "bytes" + } + ], + "name": "LogAddToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "name", + "type": "string" + }, + { + "indexed": false, + "name": "symbol", + "type": "string" + }, + { + "indexed": false, + "name": "decimals", + "type": "uint8" + }, + { + "indexed": false, + "name": "ipfsHash", + "type": "bytes" + }, + { + "indexed": false, + "name": "swarmHash", + "type": "bytes" + } + ], + "name": "LogRemoveToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "oldName", + "type": "string" + }, + { + "indexed": false, + "name": "newName", + "type": "string" + } + ], + "name": "LogTokenNameChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "oldSymbol", + "type": "string" + }, + { + "indexed": false, + "name": "newSymbol", + "type": "string" + } + ], + "name": "LogTokenSymbolChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "oldIpfsHash", + "type": "bytes" + }, + { + "indexed": false, + "name": "newIpfsHash", + "type": "bytes" + } + ], + "name": "LogTokenIpfsHashChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "oldSwarmHash", + "type": "bytes" + }, + { + "indexed": false, + "name": "newSwarmHash", + "type": "bytes" + } + ], + "name": "LogTokenSwarmHashChange", + "type": "event" + } + ], + "networks": { + "1": { + "address": "0x926a74c5c36adf004c87399e65f75628b0f98d2c" + }, + "3": { + "address": "0x6b1a50f0bb5a7995444bd3877b22dc89c62843ed" + }, + "4": { + "address": "0x4e9aad8184de8833365fea970cd9149372fdf1e6" + }, + "42": { + "address": "0xf18e504561f4347bea557f3d4558f559dddbae7f" + }, + "50": { + "address": "0x0b1ba0af832d7c05fd64161e0db78e85978e8082" + } + } +} diff --git a/packages/contract-wrappers/src/compact_artifacts/TokenTransferProxy.json b/packages/contract-wrappers/src/compact_artifacts/TokenTransferProxy.json new file mode 100644 index 000000000..8cf551ddb --- /dev/null +++ b/packages/contract-wrappers/src/compact_artifacts/TokenTransferProxy.json @@ -0,0 +1,187 @@ +{ + "contract_name": "TokenTransferProxy", + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "token", + "type": "address" + }, + { + "name": "from", + "type": "address" + }, + { + "name": "to", + "type": "address" + }, + { + "name": "value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "target", + "type": "address" + } + ], + "name": "addAuthorizedAddress", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "authorities", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "target", + "type": "address" + } + ], + "name": "removeAuthorizedAddress", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "authorized", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getAuthorizedAddresses", + "outputs": [ + { + "name": "", + "type": "address[]" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "target", + "type": "address" + }, + { + "indexed": true, + "name": "caller", + "type": "address" + } + ], + "name": "LogAuthorizedAddressAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "target", + "type": "address" + }, + { + "indexed": true, + "name": "caller", + "type": "address" + } + ], + "name": "LogAuthorizedAddressRemoved", + "type": "event" + } + ], + "networks": { + "1": { + "address": "0x8da0d80f5007ef1e431dd2127178d224e32c2ef4" + }, + "3": { + "address": "0x4e9aad8184de8833365fea970cd9149372fdf1e6" + }, + "4": { + "address": "0xa8e9fa8f91e5ae138c74648c9c304f1c75003a8d" + }, + "42": { + "address": "0x087eed4bc1ee3de49befbd66c662b434b15d49d4" + }, + "50": { + "address": "0x1dc4c1cefef38a777b15aa20260a54e584b16c48" + } + } +} diff --git a/packages/contract-wrappers/src/compact_artifacts/ZRX.json b/packages/contract-wrappers/src/compact_artifacts/ZRX.json new file mode 100644 index 000000000..e40b8f268 --- /dev/null +++ b/packages/contract-wrappers/src/compact_artifacts/ZRX.json @@ -0,0 +1,20 @@ +{ + "contract_name": "ZRX", + "networks": { + "1": { + "address": "0xe41d2489571d322189246dafa5ebde1f4699f498" + }, + "3": { + "address": "0xa8e9fa8f91e5ae138c74648c9c304f1c75003a8d" + }, + "4": { + "address": "0x00f58d6d585f84b2d7267940cede30ce2fe6eae8" + }, + "42": { + "address": "0x6ff6c0ff1d68b964901f986d4c9fa3ac68346570" + }, + "50": { + "address": "0x1d7022f5b17d2f8b695918fb48fa1089c9f85401" + } + } +} diff --git a/packages/contract-wrappers/src/contract_wrappers.ts b/packages/contract-wrappers/src/contract_wrappers.ts new file mode 100644 index 000000000..1934ea2d0 --- /dev/null +++ b/packages/contract-wrappers/src/contract_wrappers.ts @@ -0,0 +1,136 @@ +import { schemas, SchemaValidator } from '@0xproject/json-schemas'; +import { + generatePseudoRandomSalt, + getOrderHashHex, + isValidOrderHash, + isValidSignature, + signOrderHashAsync, +} from '@0xproject/order-utils'; +import { ECSignature, Order, Provider, SignedOrder, TransactionReceiptWithDecodedLogs } from '@0xproject/types'; +import { AbiDecoder, BigNumber, intervalUtils } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import * as ethUtil from 'ethereumjs-util'; +import * as _ from 'lodash'; + +import { artifacts } from './artifacts'; +import { EtherTokenWrapper } from './contract_wrappers/ether_token_wrapper'; +import { ExchangeWrapper } from './contract_wrappers/exchange_wrapper'; +import { TokenRegistryWrapper } from './contract_wrappers/token_registry_wrapper'; +import { TokenTransferProxyWrapper } from './contract_wrappers/token_transfer_proxy_wrapper'; +import { TokenWrapper } from './contract_wrappers/token_wrapper'; +import { zeroExContractConfigSchema } from './schemas/zero_ex_contract_config_schema'; +import { zeroExContractPrivateNetworkConfigSchema } from './schemas/zero_ex_contract_private_network_config_schema'; +import { zeroExContractPublicNetworkConfigSchema } from './schemas/zero_ex_contract_public_network_config_schema'; +import { ZeroExContractConfig } from './types'; +import { assert } from './utils/assert'; +import { constants } from './utils/constants'; +import { decorators } from './utils/decorators'; +import { utils } from './utils/utils'; + +/** + * The ContractWrappers class contains smart contract wrappers helpful when building on 0x protocol. + */ +export class ContractWrappers { + /** + * An instance of the ExchangeWrapper class containing methods for interacting with the 0x Exchange smart contract. + */ + public exchange: ExchangeWrapper; + /** + * An instance of the TokenRegistryWrapper class containing methods for interacting with the 0x + * TokenRegistry smart contract. + */ + public tokenRegistry: TokenRegistryWrapper; + /** + * An instance of the TokenWrapper class containing methods for interacting with any ERC20 token smart contract. + */ + public token: TokenWrapper; + /** + * An instance of the EtherTokenWrapper class containing methods for interacting with the + * wrapped ETH ERC20 token smart contract. + */ + public etherToken: EtherTokenWrapper; + /** + * An instance of the TokenTransferProxyWrapper class containing methods for interacting with the + * tokenTransferProxy smart contract. + */ + public proxy: TokenTransferProxyWrapper; + private _web3Wrapper: Web3Wrapper; + /** + * Instantiates a new ContractWrappers instance. + * @param provider The Provider instance you would like the 0x.js library to use for interacting with + * the Ethereum network. + * @param config The configuration object. Look up the type for the description. + * @return An instance of the ContractWrappers class. + */ + constructor(provider: Provider, config: ZeroExContractConfig) { + assert.isWeb3Provider('provider', provider); + assert.doesConformToSchema('config', config, zeroExContractConfigSchema, [ + zeroExContractPrivateNetworkConfigSchema, + zeroExContractPublicNetworkConfigSchema, + ]); + const artifactJSONs = _.values(artifacts); + const abiArrays = _.map(artifactJSONs, artifact => artifact.abi); + const defaults = { + gasPrice: config.gasPrice, + }; + this._web3Wrapper = new Web3Wrapper(provider, defaults); + _.forEach(abiArrays, abi => { + this._web3Wrapper.abiDecoder.addABI(abi); + }); + this.proxy = new TokenTransferProxyWrapper( + this._web3Wrapper, + config.networkId, + config.tokenTransferProxyContractAddress, + ); + this.token = new TokenWrapper(this._web3Wrapper, config.networkId, this.proxy); + this.exchange = new ExchangeWrapper( + this._web3Wrapper, + config.networkId, + this.token, + config.exchangeContractAddress, + config.zrxContractAddress, + ); + this.tokenRegistry = new TokenRegistryWrapper( + this._web3Wrapper, + config.networkId, + config.tokenRegistryContractAddress, + ); + this.etherToken = new EtherTokenWrapper(this._web3Wrapper, config.networkId, this.token); + } + /** + * Sets a new web3 provider for 0x.js. Updating the provider will stop all + * subscriptions so you will need to re-subscribe to all events relevant to your app after this call. + * @param provider The Web3Provider you would like the 0x.js library to use from now on. + * @param networkId The id of the network your provider is connected to + */ + public setProvider(provider: Provider, networkId: number): void { + this._web3Wrapper.setProvider(provider); + (this.exchange as any)._invalidateContractInstances(); + (this.exchange as any)._setNetworkId(networkId); + (this.tokenRegistry as any)._invalidateContractInstance(); + (this.tokenRegistry as any)._setNetworkId(networkId); + (this.token as any)._invalidateContractInstances(); + (this.token as any)._setNetworkId(networkId); + (this.proxy as any)._invalidateContractInstance(); + (this.proxy as any)._setNetworkId(networkId); + (this.etherToken as any)._invalidateContractInstance(); + (this.etherToken as any)._setNetworkId(networkId); + } + /** + * Get the provider instance currently used by 0x.js + * @return Web3 provider instance + */ + public getProvider(): Provider { + return this._web3Wrapper.getProvider(); + } + /* + * HACK: `TokenWrapper` needs a token transfer proxy address. `TokenTransferProxy` address is fetched from + * an `ExchangeWrapper`. `ExchangeWrapper` needs `TokenWrapper` to validate orders, creating a dependency cycle. + * In order to break this - we create this function here and pass it as a parameter to the `TokenWrapper` + * and `ProxyWrapper`. + */ + private async _getTokenTransferProxyAddressAsync(): Promise<string> { + const tokenTransferProxyAddress = await (this.exchange as any)._getTokenTransferProxyAddressAsync(); + return tokenTransferProxyAddress; + } +} diff --git a/packages/0x.js/src/contract_wrappers/contract_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts index 02be2dab3..f255ced62 100644 --- a/packages/0x.js/src/contract_wrappers/contract_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts @@ -1,32 +1,38 @@ -import { BlockParamLiteral, ContractAbi, FilterObject, LogEntry, LogWithDecodedArgs, RawLog } from '@0xproject/types'; +import { + Artifact, + BlockParamLiteral, + ContractAbi, + FilterObject, + LogEntry, + LogWithDecodedArgs, + RawLog, +} from '@0xproject/types'; import { AbiDecoder, intervalUtils } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { Block, BlockAndLogStreamer } from 'ethereumjs-blockstream'; import * as _ from 'lodash'; -import * as Web3 from 'web3'; import { - Artifact, BlockRange, ContractEventArgs, ContractEvents, + ContractWrappersError, EventCallback, IndexedFilterValues, - InternalZeroExError, - ZeroExError, + InternalContractWrappersError, } from '../types'; import { constants } from '../utils/constants'; import { filterUtils } from '../utils/filter_utils'; const CONTRACT_NAME_TO_NOT_FOUND_ERROR: { - [contractName: string]: ZeroExError; + [contractName: string]: ContractWrappersError; } = { - ZRX: ZeroExError.ZRXContractDoesNotExist, - EtherToken: ZeroExError.EtherTokenContractDoesNotExist, - Token: ZeroExError.TokenContractDoesNotExist, - TokenRegistry: ZeroExError.TokenRegistryContractDoesNotExist, - TokenTransferProxy: ZeroExError.TokenTransferProxyContractDoesNotExist, - Exchange: ZeroExError.ExchangeContractDoesNotExist, + ZRX: ContractWrappersError.ZRXContractDoesNotExist, + EtherToken: ContractWrappersError.EtherTokenContractDoesNotExist, + Token: ContractWrappersError.TokenContractDoesNotExist, + TokenRegistry: ContractWrappersError.TokenRegistryContractDoesNotExist, + TokenTransferProxy: ContractWrappersError.TokenTransferProxyContractDoesNotExist, + Exchange: ContractWrappersError.ExchangeContractDoesNotExist, }; export class ContractWrapper { @@ -57,7 +63,7 @@ export class ContractWrapper { } protected _unsubscribe(filterToken: string, err?: Error): void { if (_.isUndefined(this._filters[filterToken])) { - throw new Error(ZeroExError.SubscriptionNotFound); + throw new Error(ContractWrappersError.SubscriptionNotFound); } if (!_.isUndefined(err)) { const callback = this._filterCallbacks[filterToken]; @@ -101,7 +107,7 @@ export class ContractWrapper { log: LogEntry, ): LogWithDecodedArgs<ArgsType> | RawLog { if (_.isUndefined(this._web3Wrapper.abiDecoder)) { - throw new Error(InternalZeroExError.NoAbiDecoder); + throw new Error(InternalContractWrappersError.NoAbiDecoder); } const logWithDecodedArgs = this._web3Wrapper.abiDecoder.tryToDecodeLogOrNoop(log); return logWithDecodedArgs; @@ -113,7 +119,7 @@ export class ContractWrapper { let contractAddress: string; if (_.isUndefined(addressIfExists)) { if (_.isUndefined(artifact.networks[this._networkId])) { - throw new Error(ZeroExError.ContractNotDeployedOnNetwork); + throw new Error(ContractWrappersError.ContractNotDeployedOnNetwork); } contractAddress = artifact.networks[this._networkId].address.toLowerCase(); } else { @@ -130,7 +136,7 @@ export class ContractWrapper { if (_.isUndefined(addressIfExists)) { const contractAddress = artifact.networks[this._networkId].address; if (_.isUndefined(contractAddress)) { - throw new Error(ZeroExError.ExchangeContractDoesNotExist); + throw new Error(ContractWrappersError.ExchangeContractDoesNotExist); } return contractAddress; } else { @@ -151,7 +157,7 @@ export class ContractWrapper { } private _startBlockAndLogStream(): void { if (!_.isUndefined(this._blockAndLogStreamerIfExists)) { - throw new Error(ZeroExError.SubscriptionAlreadyPresent); + throw new Error(ContractWrappersError.SubscriptionAlreadyPresent); } this._blockAndLogStreamerIfExists = new BlockAndLogStreamer( this._web3Wrapper.getBlockAsync.bind(this._web3Wrapper), @@ -184,7 +190,7 @@ export class ContractWrapper { } private _stopBlockAndLogStream(): void { if (_.isUndefined(this._blockAndLogStreamerIfExists)) { - throw new Error(ZeroExError.SubscriptionNotFound); + throw new Error(ContractWrappersError.SubscriptionNotFound); } this._blockAndLogStreamerIfExists.unsubscribeFromOnLogAdded(this._onLogAddedSubscriptionToken as string); this._blockAndLogStreamerIfExists.unsubscribeFromOnLogRemoved(this._onLogRemovedSubscriptionToken as string); diff --git a/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts index fd39de34b..1bd65270b 100644 --- a/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts @@ -5,7 +5,7 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; import { artifacts } from '../artifacts'; -import { BlockRange, EventCallback, IndexedFilterValues, TransactionOpts, ZeroExError } from '../types'; +import { BlockRange, ContractWrappersError, EventCallback, IndexedFilterValues, TransactionOpts } from '../types'; import { assert } from '../utils/assert'; import { ContractWrapper } from './contract_wrapper'; @@ -48,7 +48,7 @@ export class EtherTokenWrapper extends ContractWrapper { const normalizedDepositorAddress = depositor.toLowerCase(); const ethBalanceInWei = await this._web3Wrapper.getBalanceInWeiAsync(normalizedDepositorAddress); - assert.assert(ethBalanceInWei.gte(amountInWei), ZeroExError.InsufficientEthBalanceForDeposit); + assert.assert(ethBalanceInWei.gte(amountInWei), ContractWrappersError.InsufficientEthBalanceForDeposit); const wethContract = await this._getEtherTokenContractAsync(normalizedEtherTokenAddress); const txHash = await wethContract.deposit.sendTransactionAsync({ @@ -84,7 +84,10 @@ export class EtherTokenWrapper extends ContractWrapper { normalizedEtherTokenAddress, normalizedWithdrawerAddress, ); - assert.assert(WETHBalanceInBaseUnits.gte(amountInWei), ZeroExError.InsufficientWEthBalanceForWithdrawal); + assert.assert( + WETHBalanceInBaseUnits.gte(amountInWei), + ContractWrappersError.InsufficientWEthBalanceForWithdrawal, + ); const wethContract = await this._getEtherTokenContractAsync(normalizedEtherTokenAddress); const txHash = await wethContract.withdraw.sendTransactionAsync(amountInWei, { @@ -119,7 +122,7 @@ export class EtherTokenWrapper extends ContractWrapper { eventName, blockRange, indexFilterValues, - artifacts.EtherTokenArtifact.abi, + artifacts.EtherToken.abi, ); return logs; } @@ -147,7 +150,7 @@ export class EtherTokenWrapper extends ContractWrapper { normalizedEtherTokenAddress, eventName, indexFilterValues, - artifacts.EtherTokenArtifact.abi, + artifacts.EtherToken.abi, callback, ); return subscriptionToken; @@ -172,7 +175,7 @@ export class EtherTokenWrapper extends ContractWrapper { * @returns The Ethereum address of the EtherToken contract or undefined. */ public getContractAddressIfExists(): string | undefined { - const networkSpecificArtifact = artifacts.EtherTokenArtifact.networks[this._networkId]; + const networkSpecificArtifact = artifacts.EtherToken.networks[this._networkId]; const contractAddressIfExists = _.isUndefined(networkSpecificArtifact) ? undefined : networkSpecificArtifact.address; @@ -188,7 +191,7 @@ export class EtherTokenWrapper extends ContractWrapper { return etherTokenContract; } const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync( - artifacts.EtherTokenArtifact, + artifacts.EtherToken, etherTokenAddress, ); const contractInstance = new EtherTokenContract( diff --git a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts index 6ddaaaf4f..f2b64fc37 100644 --- a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts @@ -1,12 +1,16 @@ import { schemas } from '@0xproject/json-schemas'; -import { getOrderHashHex } from '@0xproject/order-utils'; +import { formatters, getOrderHashHex, OrderStateUtils } from '@0xproject/order-utils'; import { BlockParamLiteral, DecodedLogArgs, ECSignature, + ExchangeContractErrs, LogEntry, LogWithDecodedArgs, Order, + OrderAddresses, + OrderState, + OrderValues, SignedOrder, } from '@0xproject/types'; import { AbiDecoder, BigNumber } from '@0xproject/utils'; @@ -20,21 +24,16 @@ import { BlockRange, EventCallback, ExchangeContractErrCodes, - ExchangeContractErrs, IndexedFilterValues, MethodOpts, - OrderAddresses, OrderCancellationRequest, OrderFillRequest, - OrderState, OrderTransactionOpts, - OrderValues, ValidateOrderFillableOpts, } from '../types'; import { assert } from '../utils/assert'; import { decorators } from '../utils/decorators'; import { ExchangeTransferSimulator } from '../utils/exchange_transfer_simulator'; -import { OrderStateUtils } from '../utils/order_state_utils'; import { OrderValidationUtils } from '../utils/order_validation_utils'; import { utils } from '../utils/utils'; @@ -70,24 +69,6 @@ export class ExchangeWrapper extends ContractWrapper { }; private _contractAddressIfExists?: string; private _zrxContractAddressIfExists?: string; - private static _getOrderAddressesAndValues(order: Order): [OrderAddresses, OrderValues] { - const orderAddresses: OrderAddresses = [ - order.maker, - order.taker, - order.makerTokenAddress, - order.takerTokenAddress, - order.feeRecipient, - ]; - const orderValues: OrderValues = [ - order.makerTokenAmount, - order.takerTokenAmount, - order.makerFee, - order.takerFee, - order.expirationUnixTimestampSec, - order.salt, - ]; - return [orderAddresses, orderValues]; - } constructor( web3Wrapper: Web3Wrapper, networkId: number, @@ -209,7 +190,7 @@ export class ExchangeWrapper extends ContractWrapper { ); } - const [orderAddresses, orderValues] = ExchangeWrapper._getOrderAddressesAndValues(signedOrder); + const [orderAddresses, orderValues] = formatters.getOrderAddressesAndValues(signedOrder); const txHash: string = await exchangeInstance.fillOrder.sendTransactionAsync( orderAddresses, @@ -296,7 +277,7 @@ export class ExchangeWrapper extends ContractWrapper { const orderAddressesValuesAndSignatureArray = _.map(signedOrders, signedOrder => { return [ - ...ExchangeWrapper._getOrderAddressesAndValues(signedOrder), + ...formatters.getOrderAddressesAndValues(signedOrder), signedOrder.ecSignature.v, signedOrder.ecSignature.r, signedOrder.ecSignature.s, @@ -384,7 +365,7 @@ export class ExchangeWrapper extends ContractWrapper { const orderAddressesValuesAmountsAndSignatureArray = _.map(orderFillRequests, orderFillRequest => { return [ - ...ExchangeWrapper._getOrderAddressesAndValues(orderFillRequest.signedOrder), + ...formatters.getOrderAddressesAndValues(orderFillRequest.signedOrder), orderFillRequest.takerTokenFillAmount, orderFillRequest.signedOrder.ecSignature.v, orderFillRequest.signedOrder.ecSignature.r, @@ -453,7 +434,7 @@ export class ExchangeWrapper extends ContractWrapper { ); } - const [orderAddresses, orderValues] = ExchangeWrapper._getOrderAddressesAndValues(signedOrder); + const [orderAddresses, orderValues] = formatters.getOrderAddressesAndValues(signedOrder); const txHash = await exchangeInstance.fillOrKillOrder.sendTransactionAsync( orderAddresses, orderValues, @@ -519,7 +500,7 @@ export class ExchangeWrapper extends ContractWrapper { const orderAddressesValuesAndTakerTokenFillAmounts = _.map(orderFillRequests, request => { return [ - ...ExchangeWrapper._getOrderAddressesAndValues(request.signedOrder), + ...formatters.getOrderAddressesAndValues(request.signedOrder), request.takerTokenFillAmount, request.signedOrder.ecSignature.v, request.signedOrder.ecSignature.r, @@ -580,7 +561,7 @@ export class ExchangeWrapper extends ContractWrapper { ); } - const [orderAddresses, orderValues] = ExchangeWrapper._getOrderAddressesAndValues(order); + const [orderAddresses, orderValues] = formatters.getOrderAddressesAndValues(order); const txHash = await exchangeInstance.cancelOrder.sendTransactionAsync( orderAddresses, orderValues, @@ -645,7 +626,7 @@ export class ExchangeWrapper extends ContractWrapper { const exchangeInstance = await this._getExchangeContractAsync(); const orderAddressesValuesAndTakerTokenCancelAmounts = _.map(orderCancellationRequests, cancellationRequest => { return [ - ...ExchangeWrapper._getOrderAddressesAndValues(cancellationRequest.order), + ...formatters.getOrderAddressesAndValues(cancellationRequest.order), cancellationRequest.takerTokenCancelAmount, ]; }); @@ -686,7 +667,7 @@ export class ExchangeWrapper extends ContractWrapper { exchangeContractAddress, eventName, indexFilterValues, - artifacts.ExchangeArtifact.abi, + artifacts.Exchange.abi, callback, ); return subscriptionToken; @@ -726,7 +707,7 @@ export class ExchangeWrapper extends ContractWrapper { eventName, blockRange, indexFilterValues, - artifacts.ExchangeArtifact.abi, + artifacts.Exchange.abi, ); return logs; } @@ -736,7 +717,7 @@ export class ExchangeWrapper extends ContractWrapper { * @returns The Ethereum address of the Exchange contract being used. */ public getContractAddress(): string { - const contractAddress = this._getContractAddress(artifacts.ExchangeArtifact, this._contractAddressIfExists); + const contractAddress = this._getContractAddress(artifacts.Exchange, this._contractAddressIfExists); return contractAddress; } /** @@ -904,7 +885,7 @@ export class ExchangeWrapper extends ContractWrapper { * @return Address of ZRX token */ public getZRXTokenAddress(): string { - const contractAddress = this._getContractAddress(artifacts.ZRXArtifact, this._zrxContractAddressIfExists); + const contractAddress = this._getContractAddress(artifacts.ZRX, this._zrxContractAddressIfExists); return contractAddress; } private _invalidateContractInstances(): void { @@ -934,7 +915,7 @@ export class ExchangeWrapper extends ContractWrapper { } private async _getOrderHashHexUsingContractCallAsync(order: Order | SignedOrder): Promise<string> { const exchangeInstance = await this._getExchangeContractAsync(); - const [orderAddresses, orderValues] = ExchangeWrapper._getOrderAddressesAndValues(order); + const [orderAddresses, orderValues] = formatters.getOrderAddressesAndValues(order); const orderHashHex = await exchangeInstance.getOrderHash.callAsync(orderAddresses, orderValues); return orderHashHex; } @@ -943,7 +924,7 @@ export class ExchangeWrapper extends ContractWrapper { return this._exchangeContractIfExists; } const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync( - artifacts.ExchangeArtifact, + artifacts.Exchange, this._contractAddressIfExists, ); const contractInstance = new ExchangeContract( diff --git a/packages/contract-wrappers/src/contract_wrappers/generated/dummy_token.ts b/packages/contract-wrappers/src/contract_wrappers/generated/dummy_token.ts new file mode 100644 index 000000000..ca923c7c5 --- /dev/null +++ b/packages/contract-wrappers/src/contract_wrappers/generated/dummy_token.ts @@ -0,0 +1,84 @@ +/** + * This file is auto-generated using abi-gen. Don't edit directly. + * Templates can be found at https://github.com/0xProject/0x-monorepo/tree/development/packages/contract_templates. + */ +// tslint:disable:no-consecutive-blank-lines +// tslint:disable-next-line:no-unused-variable +import { BaseContract } from '@0xproject/base-contract'; +import { + BlockParam, + BlockParamLiteral, + CallData, + ContractAbi, + DataItem, + MethodAbi, + Provider, + TxData, + TxDataPayable, +} from '@0xproject/types'; +import { BigNumber, classUtils, promisify } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import * as ethers from 'ethers'; +import * as _ from 'lodash'; + +// tslint:disable:no-parameter-reassignment +export class DummyTokenContract extends BaseContract { + public setBalance = { + async sendTransactionAsync(_target: string, _value: BigNumber, txData: Partial<TxData> = {}): Promise<string> { + const self = (this as any) as DummyTokenContract; + const inputAbi = self._lookupAbi('setBalance(address,uint256)').inputs; + [_target, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_target, _value], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface('setBalance(address,uint256)') + .functions.setBalance(_target, _value).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.setBalance.estimateGasAsync.bind(self, _target, _value), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync(_target: string, _value: BigNumber, txData: Partial<TxData> = {}): Promise<number> { + const self = (this as any) as DummyTokenContract; + const inputAbi = self._lookupAbi('setBalance(address,uint256)').inputs; + [_target, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_target, _value], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface('setBalance(address,uint256)') + .functions.setBalance(_target, _value).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData(_target: string, _value: BigNumber): string { + const self = (this as any) as DummyTokenContract; + const inputAbi = self._lookupAbi('setBalance(address,uint256)').inputs; + [_target, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_target, _value], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('setBalance(address,uint256)') + .functions.setBalance(_target, _value).data; + return abiEncodedTransactionData; + }, + }; + constructor(abi: ContractAbi, address: string, provider: Provider, defaults?: Partial<TxData>) { + super(abi, address, provider, defaults); + classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); + } +} // tslint:disable:max-file-line-count diff --git a/packages/contract-wrappers/src/contract_wrappers/generated/ether_token.ts b/packages/contract-wrappers/src/contract_wrappers/generated/ether_token.ts new file mode 100644 index 000000000..df95ba937 --- /dev/null +++ b/packages/contract-wrappers/src/contract_wrappers/generated/ether_token.ts @@ -0,0 +1,621 @@ +/** + * This file is auto-generated using abi-gen. Don't edit directly. + * Templates can be found at https://github.com/0xProject/0x-monorepo/tree/development/packages/contract_templates. + */ +// tslint:disable:no-consecutive-blank-lines +// tslint:disable-next-line:no-unused-variable +import { BaseContract } from '@0xproject/base-contract'; +import { + BlockParam, + BlockParamLiteral, + CallData, + ContractAbi, + DataItem, + MethodAbi, + Provider, + TxData, + TxDataPayable, +} from '@0xproject/types'; +import { BigNumber, classUtils, promisify } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import * as ethers from 'ethers'; +import * as _ from 'lodash'; + +export type EtherTokenContractEventArgs = + | TransferContractEventArgs + | ApprovalContractEventArgs + | DepositContractEventArgs + | WithdrawalContractEventArgs; + +export enum EtherTokenEvents { + Transfer = 'Transfer', + Approval = 'Approval', + Deposit = 'Deposit', + Withdrawal = 'Withdrawal', +} + +export interface TransferContractEventArgs { + _from: string; + _to: string; + _value: BigNumber; +} + +export interface ApprovalContractEventArgs { + _owner: string; + _spender: string; + _value: BigNumber; +} + +export interface DepositContractEventArgs { + _owner: string; + _value: BigNumber; +} + +export interface WithdrawalContractEventArgs { + _owner: string; + _value: BigNumber; +} + +// tslint:disable:no-parameter-reassignment +export class EtherTokenContract extends BaseContract { + public name = { + async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> { + const self = (this as any) as EtherTokenContract; + const functionSignature = 'name()'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.name() as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'name' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public approve = { + async sendTransactionAsync(_spender: string, _value: BigNumber, txData: Partial<TxData> = {}): Promise<string> { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; + [_spender, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_spender, _value], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface('approve(address,uint256)') + .functions.approve(_spender, _value).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.approve.estimateGasAsync.bind(self, _spender, _value), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync(_spender: string, _value: BigNumber, txData: Partial<TxData> = {}): Promise<number> { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; + [_spender, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_spender, _value], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface('approve(address,uint256)') + .functions.approve(_spender, _value).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData(_spender: string, _value: BigNumber): string { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; + [_spender, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_spender, _value], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('approve(address,uint256)') + .functions.approve(_spender, _value).data; + return abiEncodedTransactionData; + }, + async callAsync( + _spender: string, + _value: BigNumber, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<boolean> { + const self = (this as any) as EtherTokenContract; + const functionSignature = 'approve(address,uint256)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [_spender, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_spender, _value], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.approve(_spender, _value) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'approve' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public totalSupply = { + async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<BigNumber> { + const self = (this as any) as EtherTokenContract; + const functionSignature = 'totalSupply()'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.totalSupply() as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'totalSupply' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public transferFrom = { + async sendTransactionAsync( + _from: string, + _to: string, + _value: BigNumber, + txData: Partial<TxData> = {}, + ): Promise<string> { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; + [_from, _to, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_from, _to, _value], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface('transferFrom(address,address,uint256)') + .functions.transferFrom(_from, _to, _value).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.transferFrom.estimateGasAsync.bind(self, _from, _to, _value), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync( + _from: string, + _to: string, + _value: BigNumber, + txData: Partial<TxData> = {}, + ): Promise<number> { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; + [_from, _to, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_from, _to, _value], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface('transferFrom(address,address,uint256)') + .functions.transferFrom(_from, _to, _value).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData(_from: string, _to: string, _value: BigNumber): string { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; + [_from, _to, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_from, _to, _value], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('transferFrom(address,address,uint256)') + .functions.transferFrom(_from, _to, _value).data; + return abiEncodedTransactionData; + }, + async callAsync( + _from: string, + _to: string, + _value: BigNumber, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<boolean> { + const self = (this as any) as EtherTokenContract; + const functionSignature = 'transferFrom(address,address,uint256)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [_from, _to, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_from, _to, _value], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.transferFrom(_from, _to, _value) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'transferFrom' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public withdraw = { + async sendTransactionAsync(amount: BigNumber, txData: Partial<TxData> = {}): Promise<string> { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('withdraw(uint256)').inputs; + [amount] = BaseContract._formatABIDataItemList( + inputAbi, + [amount], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self._lookupEthersInterface('withdraw(uint256)').functions.withdraw(amount).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.withdraw.estimateGasAsync.bind(self, amount), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync(amount: BigNumber, txData: Partial<TxData> = {}): Promise<number> { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('withdraw(uint256)').inputs; + [amount] = BaseContract._formatABIDataItemList( + inputAbi, + [amount], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self._lookupEthersInterface('withdraw(uint256)').functions.withdraw(amount).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData(amount: BigNumber): string { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('withdraw(uint256)').inputs; + [amount] = BaseContract._formatABIDataItemList( + inputAbi, + [amount], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('withdraw(uint256)') + .functions.withdraw(amount).data; + return abiEncodedTransactionData; + }, + }; + public decimals = { + async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<number> { + const self = (this as any) as EtherTokenContract; + const functionSignature = 'decimals()'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.decimals() as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'decimals' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public balanceOf = { + async callAsync( + _owner: string, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<BigNumber> { + const self = (this as any) as EtherTokenContract; + const functionSignature = 'balanceOf(address)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [_owner] = BaseContract._formatABIDataItemList( + inputAbi, + [_owner], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.balanceOf(_owner) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'balanceOf' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public symbol = { + async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> { + const self = (this as any) as EtherTokenContract; + const functionSignature = 'symbol()'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.symbol() as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'symbol' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public transfer = { + async sendTransactionAsync(_to: string, _value: BigNumber, txData: Partial<TxData> = {}): Promise<string> { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; + [_to, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_to, _value], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer(_to, _value) + .data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.transfer.estimateGasAsync.bind(self, _to, _value), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync(_to: string, _value: BigNumber, txData: Partial<TxData> = {}): Promise<number> { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; + [_to, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_to, _value], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer(_to, _value) + .data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData(_to: string, _value: BigNumber): string { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; + [_to, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_to, _value], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('transfer(address,uint256)') + .functions.transfer(_to, _value).data; + return abiEncodedTransactionData; + }, + async callAsync( + _to: string, + _value: BigNumber, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<boolean> { + const self = (this as any) as EtherTokenContract; + const functionSignature = 'transfer(address,uint256)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [_to, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_to, _value], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.transfer(_to, _value) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'transfer' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public deposit = { + async sendTransactionAsync(txData: Partial<TxDataPayable> = {}): Promise<string> { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('deposit()').inputs; + [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); + const encodedData = self._lookupEthersInterface('deposit()').functions.deposit().data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.deposit.estimateGasAsync.bind(self), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync(txData: Partial<TxData> = {}): Promise<number> { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('deposit()').inputs; + [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(this)); + const encodedData = self._lookupEthersInterface('deposit()').functions.deposit().data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData(): string { + const self = (this as any) as EtherTokenContract; + const inputAbi = self._lookupAbi('deposit()').inputs; + [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); + const abiEncodedTransactionData = self._lookupEthersInterface('deposit()').functions.deposit().data; + return abiEncodedTransactionData; + }, + }; + public allowance = { + async callAsync( + _owner: string, + _spender: string, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<BigNumber> { + const self = (this as any) as EtherTokenContract; + const functionSignature = 'allowance(address,address)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [_owner, _spender] = BaseContract._formatABIDataItemList( + inputAbi, + [_owner, _spender], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.allowance(_owner, _spender) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'allowance' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + constructor(abi: ContractAbi, address: string, provider: Provider, defaults?: Partial<TxData>) { + super(abi, address, provider, defaults); + classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); + } +} // tslint:disable:max-file-line-count diff --git a/packages/contract-wrappers/src/contract_wrappers/generated/exchange.ts b/packages/contract-wrappers/src/contract_wrappers/generated/exchange.ts new file mode 100644 index 000000000..da2fc1754 --- /dev/null +++ b/packages/contract-wrappers/src/contract_wrappers/generated/exchange.ts @@ -0,0 +1,1459 @@ +/** + * This file is auto-generated using abi-gen. Don't edit directly. + * Templates can be found at https://github.com/0xProject/0x-monorepo/tree/development/packages/contract_templates. + */ +// tslint:disable:no-consecutive-blank-lines +// tslint:disable-next-line:no-unused-variable +import { BaseContract } from '@0xproject/base-contract'; +import { + BlockParam, + BlockParamLiteral, + CallData, + ContractAbi, + DataItem, + MethodAbi, + Provider, + TxData, + TxDataPayable, +} from '@0xproject/types'; +import { BigNumber, classUtils, promisify } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import * as ethers from 'ethers'; +import * as _ from 'lodash'; + +export type ExchangeContractEventArgs = + | LogFillContractEventArgs + | LogCancelContractEventArgs + | LogErrorContractEventArgs; + +export enum ExchangeEvents { + LogFill = 'LogFill', + LogCancel = 'LogCancel', + LogError = 'LogError', +} + +export interface LogFillContractEventArgs { + maker: string; + taker: string; + feeRecipient: string; + makerToken: string; + takerToken: string; + filledMakerTokenAmount: BigNumber; + filledTakerTokenAmount: BigNumber; + paidMakerFee: BigNumber; + paidTakerFee: BigNumber; + tokens: string; + orderHash: string; +} + +export interface LogCancelContractEventArgs { + maker: string; + feeRecipient: string; + makerToken: string; + takerToken: string; + cancelledMakerTokenAmount: BigNumber; + cancelledTakerTokenAmount: BigNumber; + tokens: string; + orderHash: string; +} + +export interface LogErrorContractEventArgs { + errorId: number; + orderHash: string; +} + +// tslint:disable:no-parameter-reassignment +export class ExchangeContract extends BaseContract { + public isRoundingError = { + async callAsync( + numerator: BigNumber, + denominator: BigNumber, + target: BigNumber, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<boolean> { + const self = (this as any) as ExchangeContract; + const functionSignature = 'isRoundingError(uint256,uint256,uint256)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [numerator, denominator, target] = BaseContract._formatABIDataItemList( + inputAbi, + [numerator, denominator, target], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.isRoundingError(numerator, denominator, target) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'isRoundingError' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public filled = { + async callAsync( + index_0: string, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<BigNumber> { + const self = (this as any) as ExchangeContract; + const functionSignature = 'filled(bytes32)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [index_0] = BaseContract._formatABIDataItemList( + inputAbi, + [index_0], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.filled(index_0) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'filled' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public cancelled = { + async callAsync( + index_0: string, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<BigNumber> { + const self = (this as any) as ExchangeContract; + const functionSignature = 'cancelled(bytes32)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [index_0] = BaseContract._formatABIDataItemList( + inputAbi, + [index_0], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.cancelled(index_0) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'cancelled' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public fillOrdersUpTo = { + async sendTransactionAsync( + orderAddresses: string[][], + orderValues: BigNumber[][], + fillTakerTokenAmount: BigNumber, + shouldThrowOnInsufficientBalanceOrAllowance: boolean, + v: Array<number | BigNumber>, + r: string[], + s: string[], + txData: Partial<TxData> = {}, + ): Promise<string> { + const self = (this as any) as ExchangeContract; + const inputAbi = self._lookupAbi( + 'fillOrdersUpTo(address[5][],uint256[6][],uint256,bool,uint8[],bytes32[],bytes32[])', + ).inputs; + [ + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ] = BaseContract._formatABIDataItemList( + inputAbi, + [ + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface( + 'fillOrdersUpTo(address[5][],uint256[6][],uint256,bool,uint8[],bytes32[],bytes32[])', + ) + .functions.fillOrdersUpTo( + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.fillOrdersUpTo.estimateGasAsync.bind( + self, + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync( + orderAddresses: string[][], + orderValues: BigNumber[][], + fillTakerTokenAmount: BigNumber, + shouldThrowOnInsufficientBalanceOrAllowance: boolean, + v: Array<number | BigNumber>, + r: string[], + s: string[], + txData: Partial<TxData> = {}, + ): Promise<number> { + const self = (this as any) as ExchangeContract; + const inputAbi = self._lookupAbi( + 'fillOrdersUpTo(address[5][],uint256[6][],uint256,bool,uint8[],bytes32[],bytes32[])', + ).inputs; + [ + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ] = BaseContract._formatABIDataItemList( + inputAbi, + [ + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface( + 'fillOrdersUpTo(address[5][],uint256[6][],uint256,bool,uint8[],bytes32[],bytes32[])', + ) + .functions.fillOrdersUpTo( + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData( + orderAddresses: string[][], + orderValues: BigNumber[][], + fillTakerTokenAmount: BigNumber, + shouldThrowOnInsufficientBalanceOrAllowance: boolean, + v: Array<number | BigNumber>, + r: string[], + s: string[], + ): string { + const self = (this as any) as ExchangeContract; + const inputAbi = self._lookupAbi( + 'fillOrdersUpTo(address[5][],uint256[6][],uint256,bool,uint8[],bytes32[],bytes32[])', + ).inputs; + [ + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ] = BaseContract._formatABIDataItemList( + inputAbi, + [ + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface( + 'fillOrdersUpTo(address[5][],uint256[6][],uint256,bool,uint8[],bytes32[],bytes32[])', + ) + .functions.fillOrdersUpTo( + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ).data; + return abiEncodedTransactionData; + }, + async callAsync( + orderAddresses: string[][], + orderValues: BigNumber[][], + fillTakerTokenAmount: BigNumber, + shouldThrowOnInsufficientBalanceOrAllowance: boolean, + v: Array<number | BigNumber>, + r: string[], + s: string[], + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<BigNumber> { + const self = (this as any) as ExchangeContract; + const functionSignature = + 'fillOrdersUpTo(address[5][],uint256[6][],uint256,bool,uint8[],bytes32[],bytes32[])'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [ + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ] = BaseContract._formatABIDataItemList( + inputAbi, + [ + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.fillOrdersUpTo( + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'fillOrdersUpTo' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public cancelOrder = { + async sendTransactionAsync( + orderAddresses: string[], + orderValues: BigNumber[], + cancelTakerTokenAmount: BigNumber, + txData: Partial<TxData> = {}, + ): Promise<string> { + const self = (this as any) as ExchangeContract; + const inputAbi = self._lookupAbi('cancelOrder(address[5],uint256[6],uint256)').inputs; + [orderAddresses, orderValues, cancelTakerTokenAmount] = BaseContract._formatABIDataItemList( + inputAbi, + [orderAddresses, orderValues, cancelTakerTokenAmount], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface('cancelOrder(address[5],uint256[6],uint256)') + .functions.cancelOrder(orderAddresses, orderValues, cancelTakerTokenAmount).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.cancelOrder.estimateGasAsync.bind(self, orderAddresses, orderValues, cancelTakerTokenAmount), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync( + orderAddresses: string[], + orderValues: BigNumber[], + cancelTakerTokenAmount: BigNumber, + txData: Partial<TxData> = {}, + ): Promise<number> { + const self = (this as any) as ExchangeContract; + const inputAbi = self._lookupAbi('cancelOrder(address[5],uint256[6],uint256)').inputs; + [orderAddresses, orderValues, cancelTakerTokenAmount] = BaseContract._formatABIDataItemList( + inputAbi, + [orderAddresses, orderValues, cancelTakerTokenAmount], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface('cancelOrder(address[5],uint256[6],uint256)') + .functions.cancelOrder(orderAddresses, orderValues, cancelTakerTokenAmount).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData( + orderAddresses: string[], + orderValues: BigNumber[], + cancelTakerTokenAmount: BigNumber, + ): string { + const self = (this as any) as ExchangeContract; + const inputAbi = self._lookupAbi('cancelOrder(address[5],uint256[6],uint256)').inputs; + [orderAddresses, orderValues, cancelTakerTokenAmount] = BaseContract._formatABIDataItemList( + inputAbi, + [orderAddresses, orderValues, cancelTakerTokenAmount], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('cancelOrder(address[5],uint256[6],uint256)') + .functions.cancelOrder(orderAddresses, orderValues, cancelTakerTokenAmount).data; + return abiEncodedTransactionData; + }, + async callAsync( + orderAddresses: string[], + orderValues: BigNumber[], + cancelTakerTokenAmount: BigNumber, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<BigNumber> { + const self = (this as any) as ExchangeContract; + const functionSignature = 'cancelOrder(address[5],uint256[6],uint256)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [orderAddresses, orderValues, cancelTakerTokenAmount] = BaseContract._formatABIDataItemList( + inputAbi, + [orderAddresses, orderValues, cancelTakerTokenAmount], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.cancelOrder(orderAddresses, orderValues, cancelTakerTokenAmount) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'cancelOrder' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public ZRX_TOKEN_CONTRACT = { + async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> { + const self = (this as any) as ExchangeContract; + const functionSignature = 'ZRX_TOKEN_CONTRACT()'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.ZRX_TOKEN_CONTRACT() as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'ZRX_TOKEN_CONTRACT' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public batchFillOrKillOrders = { + async sendTransactionAsync( + orderAddresses: string[][], + orderValues: BigNumber[][], + fillTakerTokenAmounts: BigNumber[], + v: Array<number | BigNumber>, + r: string[], + s: string[], + txData: Partial<TxData> = {}, + ): Promise<string> { + const self = (this as any) as ExchangeContract; + const inputAbi = self._lookupAbi( + 'batchFillOrKillOrders(address[5][],uint256[6][],uint256[],uint8[],bytes32[],bytes32[])', + ).inputs; + [orderAddresses, orderValues, fillTakerTokenAmounts, v, r, s] = BaseContract._formatABIDataItemList( + inputAbi, + [orderAddresses, orderValues, fillTakerTokenAmounts, v, r, s], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface( + 'batchFillOrKillOrders(address[5][],uint256[6][],uint256[],uint8[],bytes32[],bytes32[])', + ) + .functions.batchFillOrKillOrders(orderAddresses, orderValues, fillTakerTokenAmounts, v, r, s).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.batchFillOrKillOrders.estimateGasAsync.bind( + self, + orderAddresses, + orderValues, + fillTakerTokenAmounts, + v, + r, + s, + ), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync( + orderAddresses: string[][], + orderValues: BigNumber[][], + fillTakerTokenAmounts: BigNumber[], + v: Array<number | BigNumber>, + r: string[], + s: string[], + txData: Partial<TxData> = {}, + ): Promise<number> { + const self = (this as any) as ExchangeContract; + const inputAbi = self._lookupAbi( + 'batchFillOrKillOrders(address[5][],uint256[6][],uint256[],uint8[],bytes32[],bytes32[])', + ).inputs; + [orderAddresses, orderValues, fillTakerTokenAmounts, v, r, s] = BaseContract._formatABIDataItemList( + inputAbi, + [orderAddresses, orderValues, fillTakerTokenAmounts, v, r, s], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface( + 'batchFillOrKillOrders(address[5][],uint256[6][],uint256[],uint8[],bytes32[],bytes32[])', + ) + .functions.batchFillOrKillOrders(orderAddresses, orderValues, fillTakerTokenAmounts, v, r, s).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData( + orderAddresses: string[][], + orderValues: BigNumber[][], + fillTakerTokenAmounts: BigNumber[], + v: Array<number | BigNumber>, + r: string[], + s: string[], + ): string { + const self = (this as any) as ExchangeContract; + const inputAbi = self._lookupAbi( + 'batchFillOrKillOrders(address[5][],uint256[6][],uint256[],uint8[],bytes32[],bytes32[])', + ).inputs; + [orderAddresses, orderValues, fillTakerTokenAmounts, v, r, s] = BaseContract._formatABIDataItemList( + inputAbi, + [orderAddresses, orderValues, fillTakerTokenAmounts, v, r, s], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface( + 'batchFillOrKillOrders(address[5][],uint256[6][],uint256[],uint8[],bytes32[],bytes32[])', + ) + .functions.batchFillOrKillOrders(orderAddresses, orderValues, fillTakerTokenAmounts, v, r, s).data; + return abiEncodedTransactionData; + }, + }; + public fillOrKillOrder = { + async sendTransactionAsync( + orderAddresses: string[], + orderValues: BigNumber[], + fillTakerTokenAmount: BigNumber, + v: number | BigNumber, + r: string, + s: string, + txData: Partial<TxData> = {}, + ): Promise<string> { + const self = (this as any) as ExchangeContract; + const inputAbi = self._lookupAbi('fillOrKillOrder(address[5],uint256[6],uint256,uint8,bytes32,bytes32)') + .inputs; + [orderAddresses, orderValues, fillTakerTokenAmount, v, r, s] = BaseContract._formatABIDataItemList( + inputAbi, + [orderAddresses, orderValues, fillTakerTokenAmount, v, r, s], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface('fillOrKillOrder(address[5],uint256[6],uint256,uint8,bytes32,bytes32)') + .functions.fillOrKillOrder(orderAddresses, orderValues, fillTakerTokenAmount, v, r, s).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.fillOrKillOrder.estimateGasAsync.bind( + self, + orderAddresses, + orderValues, + fillTakerTokenAmount, + v, + r, + s, + ), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync( + orderAddresses: string[], + orderValues: BigNumber[], + fillTakerTokenAmount: BigNumber, + v: number | BigNumber, + r: string, + s: string, + txData: Partial<TxData> = {}, + ): Promise<number> { + const self = (this as any) as ExchangeContract; + const inputAbi = self._lookupAbi('fillOrKillOrder(address[5],uint256[6],uint256,uint8,bytes32,bytes32)') + .inputs; + [orderAddresses, orderValues, fillTakerTokenAmount, v, r, s] = BaseContract._formatABIDataItemList( + inputAbi, + [orderAddresses, orderValues, fillTakerTokenAmount, v, r, s], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface('fillOrKillOrder(address[5],uint256[6],uint256,uint8,bytes32,bytes32)') + .functions.fillOrKillOrder(orderAddresses, orderValues, fillTakerTokenAmount, v, r, s).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData( + orderAddresses: string[], + orderValues: BigNumber[], + fillTakerTokenAmount: BigNumber, + v: number | BigNumber, + r: string, + s: string, + ): string { + const self = (this as any) as ExchangeContract; + const inputAbi = self._lookupAbi('fillOrKillOrder(address[5],uint256[6],uint256,uint8,bytes32,bytes32)') + .inputs; + [orderAddresses, orderValues, fillTakerTokenAmount, v, r, s] = BaseContract._formatABIDataItemList( + inputAbi, + [orderAddresses, orderValues, fillTakerTokenAmount, v, r, s], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('fillOrKillOrder(address[5],uint256[6],uint256,uint8,bytes32,bytes32)') + .functions.fillOrKillOrder(orderAddresses, orderValues, fillTakerTokenAmount, v, r, s).data; + return abiEncodedTransactionData; + }, + }; + public getUnavailableTakerTokenAmount = { + async callAsync( + orderHash: string, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<BigNumber> { + const self = (this as any) as ExchangeContract; + const functionSignature = 'getUnavailableTakerTokenAmount(bytes32)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [orderHash] = BaseContract._formatABIDataItemList( + inputAbi, + [orderHash], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.getUnavailableTakerTokenAmount(orderHash) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'getUnavailableTakerTokenAmount' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public isValidSignature = { + async callAsync( + signer: string, + hash: string, + v: number | BigNumber, + r: string, + s: string, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<boolean> { + const self = (this as any) as ExchangeContract; + const functionSignature = 'isValidSignature(address,bytes32,uint8,bytes32,bytes32)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [signer, hash, v, r, s] = BaseContract._formatABIDataItemList( + inputAbi, + [signer, hash, v, r, s], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.isValidSignature(signer, hash, v, r, s) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'isValidSignature' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public getPartialAmount = { + async callAsync( + numerator: BigNumber, + denominator: BigNumber, + target: BigNumber, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<BigNumber> { + const self = (this as any) as ExchangeContract; + const functionSignature = 'getPartialAmount(uint256,uint256,uint256)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [numerator, denominator, target] = BaseContract._formatABIDataItemList( + inputAbi, + [numerator, denominator, target], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.getPartialAmount(numerator, denominator, target) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'getPartialAmount' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public TOKEN_TRANSFER_PROXY_CONTRACT = { + async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> { + const self = (this as any) as ExchangeContract; + const functionSignature = 'TOKEN_TRANSFER_PROXY_CONTRACT()'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.TOKEN_TRANSFER_PROXY_CONTRACT() as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'TOKEN_TRANSFER_PROXY_CONTRACT' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public batchFillOrders = { + async sendTransactionAsync( + orderAddresses: string[][], + orderValues: BigNumber[][], + fillTakerTokenAmounts: BigNumber[], + shouldThrowOnInsufficientBalanceOrAllowance: boolean, + v: Array<number | BigNumber>, + r: string[], + s: string[], + txData: Partial<TxData> = {}, + ): Promise<string> { + const self = (this as any) as ExchangeContract; + const inputAbi = self._lookupAbi( + 'batchFillOrders(address[5][],uint256[6][],uint256[],bool,uint8[],bytes32[],bytes32[])', + ).inputs; + [ + orderAddresses, + orderValues, + fillTakerTokenAmounts, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ] = BaseContract._formatABIDataItemList( + inputAbi, + [ + orderAddresses, + orderValues, + fillTakerTokenAmounts, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface( + 'batchFillOrders(address[5][],uint256[6][],uint256[],bool,uint8[],bytes32[],bytes32[])', + ) + .functions.batchFillOrders( + orderAddresses, + orderValues, + fillTakerTokenAmounts, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.batchFillOrders.estimateGasAsync.bind( + self, + orderAddresses, + orderValues, + fillTakerTokenAmounts, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync( + orderAddresses: string[][], + orderValues: BigNumber[][], + fillTakerTokenAmounts: BigNumber[], + shouldThrowOnInsufficientBalanceOrAllowance: boolean, + v: Array<number | BigNumber>, + r: string[], + s: string[], + txData: Partial<TxData> = {}, + ): Promise<number> { + const self = (this as any) as ExchangeContract; + const inputAbi = self._lookupAbi( + 'batchFillOrders(address[5][],uint256[6][],uint256[],bool,uint8[],bytes32[],bytes32[])', + ).inputs; + [ + orderAddresses, + orderValues, + fillTakerTokenAmounts, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ] = BaseContract._formatABIDataItemList( + inputAbi, + [ + orderAddresses, + orderValues, + fillTakerTokenAmounts, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface( + 'batchFillOrders(address[5][],uint256[6][],uint256[],bool,uint8[],bytes32[],bytes32[])', + ) + .functions.batchFillOrders( + orderAddresses, + orderValues, + fillTakerTokenAmounts, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData( + orderAddresses: string[][], + orderValues: BigNumber[][], + fillTakerTokenAmounts: BigNumber[], + shouldThrowOnInsufficientBalanceOrAllowance: boolean, + v: Array<number | BigNumber>, + r: string[], + s: string[], + ): string { + const self = (this as any) as ExchangeContract; + const inputAbi = self._lookupAbi( + 'batchFillOrders(address[5][],uint256[6][],uint256[],bool,uint8[],bytes32[],bytes32[])', + ).inputs; + [ + orderAddresses, + orderValues, + fillTakerTokenAmounts, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ] = BaseContract._formatABIDataItemList( + inputAbi, + [ + orderAddresses, + orderValues, + fillTakerTokenAmounts, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface( + 'batchFillOrders(address[5][],uint256[6][],uint256[],bool,uint8[],bytes32[],bytes32[])', + ) + .functions.batchFillOrders( + orderAddresses, + orderValues, + fillTakerTokenAmounts, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ).data; + return abiEncodedTransactionData; + }, + }; + public batchCancelOrders = { + async sendTransactionAsync( + orderAddresses: string[][], + orderValues: BigNumber[][], + cancelTakerTokenAmounts: BigNumber[], + txData: Partial<TxData> = {}, + ): Promise<string> { + const self = (this as any) as ExchangeContract; + const inputAbi = self._lookupAbi('batchCancelOrders(address[5][],uint256[6][],uint256[])').inputs; + [orderAddresses, orderValues, cancelTakerTokenAmounts] = BaseContract._formatABIDataItemList( + inputAbi, + [orderAddresses, orderValues, cancelTakerTokenAmounts], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface('batchCancelOrders(address[5][],uint256[6][],uint256[])') + .functions.batchCancelOrders(orderAddresses, orderValues, cancelTakerTokenAmounts).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.batchCancelOrders.estimateGasAsync.bind( + self, + orderAddresses, + orderValues, + cancelTakerTokenAmounts, + ), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync( + orderAddresses: string[][], + orderValues: BigNumber[][], + cancelTakerTokenAmounts: BigNumber[], + txData: Partial<TxData> = {}, + ): Promise<number> { + const self = (this as any) as ExchangeContract; + const inputAbi = self._lookupAbi('batchCancelOrders(address[5][],uint256[6][],uint256[])').inputs; + [orderAddresses, orderValues, cancelTakerTokenAmounts] = BaseContract._formatABIDataItemList( + inputAbi, + [orderAddresses, orderValues, cancelTakerTokenAmounts], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface('batchCancelOrders(address[5][],uint256[6][],uint256[])') + .functions.batchCancelOrders(orderAddresses, orderValues, cancelTakerTokenAmounts).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData( + orderAddresses: string[][], + orderValues: BigNumber[][], + cancelTakerTokenAmounts: BigNumber[], + ): string { + const self = (this as any) as ExchangeContract; + const inputAbi = self._lookupAbi('batchCancelOrders(address[5][],uint256[6][],uint256[])').inputs; + [orderAddresses, orderValues, cancelTakerTokenAmounts] = BaseContract._formatABIDataItemList( + inputAbi, + [orderAddresses, orderValues, cancelTakerTokenAmounts], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('batchCancelOrders(address[5][],uint256[6][],uint256[])') + .functions.batchCancelOrders(orderAddresses, orderValues, cancelTakerTokenAmounts).data; + return abiEncodedTransactionData; + }, + }; + public fillOrder = { + async sendTransactionAsync( + orderAddresses: string[], + orderValues: BigNumber[], + fillTakerTokenAmount: BigNumber, + shouldThrowOnInsufficientBalanceOrAllowance: boolean, + v: number | BigNumber, + r: string, + s: string, + txData: Partial<TxData> = {}, + ): Promise<string> { + const self = (this as any) as ExchangeContract; + const inputAbi = self._lookupAbi('fillOrder(address[5],uint256[6],uint256,bool,uint8,bytes32,bytes32)') + .inputs; + [ + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ] = BaseContract._formatABIDataItemList( + inputAbi, + [ + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface('fillOrder(address[5],uint256[6],uint256,bool,uint8,bytes32,bytes32)') + .functions.fillOrder( + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.fillOrder.estimateGasAsync.bind( + self, + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync( + orderAddresses: string[], + orderValues: BigNumber[], + fillTakerTokenAmount: BigNumber, + shouldThrowOnInsufficientBalanceOrAllowance: boolean, + v: number | BigNumber, + r: string, + s: string, + txData: Partial<TxData> = {}, + ): Promise<number> { + const self = (this as any) as ExchangeContract; + const inputAbi = self._lookupAbi('fillOrder(address[5],uint256[6],uint256,bool,uint8,bytes32,bytes32)') + .inputs; + [ + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ] = BaseContract._formatABIDataItemList( + inputAbi, + [ + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface('fillOrder(address[5],uint256[6],uint256,bool,uint8,bytes32,bytes32)') + .functions.fillOrder( + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData( + orderAddresses: string[], + orderValues: BigNumber[], + fillTakerTokenAmount: BigNumber, + shouldThrowOnInsufficientBalanceOrAllowance: boolean, + v: number | BigNumber, + r: string, + s: string, + ): string { + const self = (this as any) as ExchangeContract; + const inputAbi = self._lookupAbi('fillOrder(address[5],uint256[6],uint256,bool,uint8,bytes32,bytes32)') + .inputs; + [ + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ] = BaseContract._formatABIDataItemList( + inputAbi, + [ + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('fillOrder(address[5],uint256[6],uint256,bool,uint8,bytes32,bytes32)') + .functions.fillOrder( + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ).data; + return abiEncodedTransactionData; + }, + async callAsync( + orderAddresses: string[], + orderValues: BigNumber[], + fillTakerTokenAmount: BigNumber, + shouldThrowOnInsufficientBalanceOrAllowance: boolean, + v: number | BigNumber, + r: string, + s: string, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<BigNumber> { + const self = (this as any) as ExchangeContract; + const functionSignature = 'fillOrder(address[5],uint256[6],uint256,bool,uint8,bytes32,bytes32)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [ + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ] = BaseContract._formatABIDataItemList( + inputAbi, + [ + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.fillOrder( + orderAddresses, + orderValues, + fillTakerTokenAmount, + shouldThrowOnInsufficientBalanceOrAllowance, + v, + r, + s, + ) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'fillOrder' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public getOrderHash = { + async callAsync( + orderAddresses: string[], + orderValues: BigNumber[], + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<string> { + const self = (this as any) as ExchangeContract; + const functionSignature = 'getOrderHash(address[5],uint256[6])'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [orderAddresses, orderValues] = BaseContract._formatABIDataItemList( + inputAbi, + [orderAddresses, orderValues], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.getOrderHash(orderAddresses, orderValues) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'getOrderHash' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public EXTERNAL_QUERY_GAS_LIMIT = { + async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<number> { + const self = (this as any) as ExchangeContract; + const functionSignature = 'EXTERNAL_QUERY_GAS_LIMIT()'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.EXTERNAL_QUERY_GAS_LIMIT() as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'EXTERNAL_QUERY_GAS_LIMIT' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public VERSION = { + async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> { + const self = (this as any) as ExchangeContract; + const functionSignature = 'VERSION()'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.VERSION() as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'VERSION' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + constructor(abi: ContractAbi, address: string, provider: Provider, defaults?: Partial<TxData>) { + super(abi, address, provider, defaults); + classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); + } +} // tslint:disable:max-file-line-count diff --git a/packages/contract-wrappers/src/contract_wrappers/generated/token.ts b/packages/contract-wrappers/src/contract_wrappers/generated/token.ts new file mode 100644 index 000000000..130265d4d --- /dev/null +++ b/packages/contract-wrappers/src/contract_wrappers/generated/token.ts @@ -0,0 +1,432 @@ +/** + * This file is auto-generated using abi-gen. Don't edit directly. + * Templates can be found at https://github.com/0xProject/0x-monorepo/tree/development/packages/contract_templates. + */ +// tslint:disable:no-consecutive-blank-lines +// tslint:disable-next-line:no-unused-variable +import { BaseContract } from '@0xproject/base-contract'; +import { + BlockParam, + BlockParamLiteral, + CallData, + ContractAbi, + DataItem, + MethodAbi, + Provider, + TxData, + TxDataPayable, +} from '@0xproject/types'; +import { BigNumber, classUtils, promisify } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import * as ethers from 'ethers'; +import * as _ from 'lodash'; + +export type TokenContractEventArgs = TransferContractEventArgs | ApprovalContractEventArgs; + +export enum TokenEvents { + Transfer = 'Transfer', + Approval = 'Approval', +} + +export interface TransferContractEventArgs { + _from: string; + _to: string; + _value: BigNumber; +} + +export interface ApprovalContractEventArgs { + _owner: string; + _spender: string; + _value: BigNumber; +} + +// tslint:disable:no-parameter-reassignment +export class TokenContract extends BaseContract { + public approve = { + async sendTransactionAsync(_spender: string, _value: BigNumber, txData: Partial<TxData> = {}): Promise<string> { + const self = (this as any) as TokenContract; + const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; + [_spender, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_spender, _value], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface('approve(address,uint256)') + .functions.approve(_spender, _value).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.approve.estimateGasAsync.bind(self, _spender, _value), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync(_spender: string, _value: BigNumber, txData: Partial<TxData> = {}): Promise<number> { + const self = (this as any) as TokenContract; + const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; + [_spender, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_spender, _value], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface('approve(address,uint256)') + .functions.approve(_spender, _value).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData(_spender: string, _value: BigNumber): string { + const self = (this as any) as TokenContract; + const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; + [_spender, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_spender, _value], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('approve(address,uint256)') + .functions.approve(_spender, _value).data; + return abiEncodedTransactionData; + }, + async callAsync( + _spender: string, + _value: BigNumber, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<boolean> { + const self = (this as any) as TokenContract; + const functionSignature = 'approve(address,uint256)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [_spender, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_spender, _value], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.approve(_spender, _value) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'approve' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public totalSupply = { + async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<BigNumber> { + const self = (this as any) as TokenContract; + const functionSignature = 'totalSupply()'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.totalSupply() as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'totalSupply' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public transferFrom = { + async sendTransactionAsync( + _from: string, + _to: string, + _value: BigNumber, + txData: Partial<TxData> = {}, + ): Promise<string> { + const self = (this as any) as TokenContract; + const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; + [_from, _to, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_from, _to, _value], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface('transferFrom(address,address,uint256)') + .functions.transferFrom(_from, _to, _value).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.transferFrom.estimateGasAsync.bind(self, _from, _to, _value), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync( + _from: string, + _to: string, + _value: BigNumber, + txData: Partial<TxData> = {}, + ): Promise<number> { + const self = (this as any) as TokenContract; + const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; + [_from, _to, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_from, _to, _value], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface('transferFrom(address,address,uint256)') + .functions.transferFrom(_from, _to, _value).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData(_from: string, _to: string, _value: BigNumber): string { + const self = (this as any) as TokenContract; + const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; + [_from, _to, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_from, _to, _value], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('transferFrom(address,address,uint256)') + .functions.transferFrom(_from, _to, _value).data; + return abiEncodedTransactionData; + }, + async callAsync( + _from: string, + _to: string, + _value: BigNumber, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<boolean> { + const self = (this as any) as TokenContract; + const functionSignature = 'transferFrom(address,address,uint256)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [_from, _to, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_from, _to, _value], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.transferFrom(_from, _to, _value) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'transferFrom' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public balanceOf = { + async callAsync( + _owner: string, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<BigNumber> { + const self = (this as any) as TokenContract; + const functionSignature = 'balanceOf(address)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [_owner] = BaseContract._formatABIDataItemList( + inputAbi, + [_owner], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.balanceOf(_owner) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'balanceOf' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public transfer = { + async sendTransactionAsync(_to: string, _value: BigNumber, txData: Partial<TxData> = {}): Promise<string> { + const self = (this as any) as TokenContract; + const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; + [_to, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_to, _value], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer(_to, _value) + .data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.transfer.estimateGasAsync.bind(self, _to, _value), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync(_to: string, _value: BigNumber, txData: Partial<TxData> = {}): Promise<number> { + const self = (this as any) as TokenContract; + const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; + [_to, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_to, _value], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer(_to, _value) + .data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData(_to: string, _value: BigNumber): string { + const self = (this as any) as TokenContract; + const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; + [_to, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_to, _value], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('transfer(address,uint256)') + .functions.transfer(_to, _value).data; + return abiEncodedTransactionData; + }, + async callAsync( + _to: string, + _value: BigNumber, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<boolean> { + const self = (this as any) as TokenContract; + const functionSignature = 'transfer(address,uint256)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [_to, _value] = BaseContract._formatABIDataItemList( + inputAbi, + [_to, _value], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.transfer(_to, _value) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'transfer' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public allowance = { + async callAsync( + _owner: string, + _spender: string, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<BigNumber> { + const self = (this as any) as TokenContract; + const functionSignature = 'allowance(address,address)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [_owner, _spender] = BaseContract._formatABIDataItemList( + inputAbi, + [_owner, _spender], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.allowance(_owner, _spender) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'allowance' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + constructor(abi: ContractAbi, address: string, provider: Provider, defaults?: Partial<TxData>) { + super(abi, address, provider, defaults); + classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); + } +} // tslint:disable:max-file-line-count diff --git a/packages/contract-wrappers/src/contract_wrappers/generated/token_registry.ts b/packages/contract-wrappers/src/contract_wrappers/generated/token_registry.ts new file mode 100644 index 000000000..243f81088 --- /dev/null +++ b/packages/contract-wrappers/src/contract_wrappers/generated/token_registry.ts @@ -0,0 +1,799 @@ +/** + * This file is auto-generated using abi-gen. Don't edit directly. + * Templates can be found at https://github.com/0xProject/0x-monorepo/tree/development/packages/contract_templates. + */ +// tslint:disable:no-consecutive-blank-lines +// tslint:disable-next-line:no-unused-variable +import { BaseContract } from '@0xproject/base-contract'; +import { + BlockParam, + BlockParamLiteral, + CallData, + ContractAbi, + DataItem, + MethodAbi, + Provider, + TxData, + TxDataPayable, +} from '@0xproject/types'; +import { BigNumber, classUtils, promisify } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import * as ethers from 'ethers'; +import * as _ from 'lodash'; + +export type TokenRegistryContractEventArgs = + | LogAddTokenContractEventArgs + | LogRemoveTokenContractEventArgs + | LogTokenNameChangeContractEventArgs + | LogTokenSymbolChangeContractEventArgs + | LogTokenIpfsHashChangeContractEventArgs + | LogTokenSwarmHashChangeContractEventArgs; + +export enum TokenRegistryEvents { + LogAddToken = 'LogAddToken', + LogRemoveToken = 'LogRemoveToken', + LogTokenNameChange = 'LogTokenNameChange', + LogTokenSymbolChange = 'LogTokenSymbolChange', + LogTokenIpfsHashChange = 'LogTokenIpfsHashChange', + LogTokenSwarmHashChange = 'LogTokenSwarmHashChange', +} + +export interface LogAddTokenContractEventArgs { + token: string; + name: string; + symbol: string; + decimals: number; + ipfsHash: string; + swarmHash: string; +} + +export interface LogRemoveTokenContractEventArgs { + token: string; + name: string; + symbol: string; + decimals: number; + ipfsHash: string; + swarmHash: string; +} + +export interface LogTokenNameChangeContractEventArgs { + token: string; + oldName: string; + newName: string; +} + +export interface LogTokenSymbolChangeContractEventArgs { + token: string; + oldSymbol: string; + newSymbol: string; +} + +export interface LogTokenIpfsHashChangeContractEventArgs { + token: string; + oldIpfsHash: string; + newIpfsHash: string; +} + +export interface LogTokenSwarmHashChangeContractEventArgs { + token: string; + oldSwarmHash: string; + newSwarmHash: string; +} + +// tslint:disable:no-parameter-reassignment +export class TokenRegistryContract extends BaseContract { + public removeToken = { + async sendTransactionAsync(_token: string, _index: BigNumber, txData: Partial<TxData> = {}): Promise<string> { + const self = (this as any) as TokenRegistryContract; + const inputAbi = self._lookupAbi('removeToken(address,uint256)').inputs; + [_token, _index] = BaseContract._formatABIDataItemList( + inputAbi, + [_token, _index], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface('removeToken(address,uint256)') + .functions.removeToken(_token, _index).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.removeToken.estimateGasAsync.bind(self, _token, _index), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync(_token: string, _index: BigNumber, txData: Partial<TxData> = {}): Promise<number> { + const self = (this as any) as TokenRegistryContract; + const inputAbi = self._lookupAbi('removeToken(address,uint256)').inputs; + [_token, _index] = BaseContract._formatABIDataItemList( + inputAbi, + [_token, _index], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface('removeToken(address,uint256)') + .functions.removeToken(_token, _index).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData(_token: string, _index: BigNumber): string { + const self = (this as any) as TokenRegistryContract; + const inputAbi = self._lookupAbi('removeToken(address,uint256)').inputs; + [_token, _index] = BaseContract._formatABIDataItemList( + inputAbi, + [_token, _index], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('removeToken(address,uint256)') + .functions.removeToken(_token, _index).data; + return abiEncodedTransactionData; + }, + }; + public getTokenAddressByName = { + async callAsync(_name: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> { + const self = (this as any) as TokenRegistryContract; + const functionSignature = 'getTokenAddressByName(string)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [_name] = BaseContract._formatABIDataItemList( + inputAbi, + [_name], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.getTokenAddressByName(_name) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'getTokenAddressByName' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public getTokenAddressBySymbol = { + async callAsync(_symbol: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> { + const self = (this as any) as TokenRegistryContract; + const functionSignature = 'getTokenAddressBySymbol(string)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [_symbol] = BaseContract._formatABIDataItemList( + inputAbi, + [_symbol], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.getTokenAddressBySymbol(_symbol) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'getTokenAddressBySymbol' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public setTokenSwarmHash = { + async sendTransactionAsync(_token: string, _swarmHash: string, txData: Partial<TxData> = {}): Promise<string> { + const self = (this as any) as TokenRegistryContract; + const inputAbi = self._lookupAbi('setTokenSwarmHash(address,bytes)').inputs; + [_token, _swarmHash] = BaseContract._formatABIDataItemList( + inputAbi, + [_token, _swarmHash], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface('setTokenSwarmHash(address,bytes)') + .functions.setTokenSwarmHash(_token, _swarmHash).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.setTokenSwarmHash.estimateGasAsync.bind(self, _token, _swarmHash), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync(_token: string, _swarmHash: string, txData: Partial<TxData> = {}): Promise<number> { + const self = (this as any) as TokenRegistryContract; + const inputAbi = self._lookupAbi('setTokenSwarmHash(address,bytes)').inputs; + [_token, _swarmHash] = BaseContract._formatABIDataItemList( + inputAbi, + [_token, _swarmHash], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface('setTokenSwarmHash(address,bytes)') + .functions.setTokenSwarmHash(_token, _swarmHash).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData(_token: string, _swarmHash: string): string { + const self = (this as any) as TokenRegistryContract; + const inputAbi = self._lookupAbi('setTokenSwarmHash(address,bytes)').inputs; + [_token, _swarmHash] = BaseContract._formatABIDataItemList( + inputAbi, + [_token, _swarmHash], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('setTokenSwarmHash(address,bytes)') + .functions.setTokenSwarmHash(_token, _swarmHash).data; + return abiEncodedTransactionData; + }, + }; + public getTokenMetaData = { + async callAsync( + _token: string, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<[string, string, string, number, string, string]> { + const self = (this as any) as TokenRegistryContract; + const functionSignature = 'getTokenMetaData(address)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [_token] = BaseContract._formatABIDataItemList( + inputAbi, + [_token], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.getTokenMetaData(_token) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'getTokenMetaData' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray; + }, + }; + public owner = { + async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> { + const self = (this as any) as TokenRegistryContract; + const functionSignature = 'owner()'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.owner() as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'owner' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public addToken = { + async sendTransactionAsync( + _token: string, + _name: string, + _symbol: string, + _decimals: number | BigNumber, + _ipfsHash: string, + _swarmHash: string, + txData: Partial<TxData> = {}, + ): Promise<string> { + const self = (this as any) as TokenRegistryContract; + const inputAbi = self._lookupAbi('addToken(address,string,string,uint8,bytes,bytes)').inputs; + [_token, _name, _symbol, _decimals, _ipfsHash, _swarmHash] = BaseContract._formatABIDataItemList( + inputAbi, + [_token, _name, _symbol, _decimals, _ipfsHash, _swarmHash], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface('addToken(address,string,string,uint8,bytes,bytes)') + .functions.addToken(_token, _name, _symbol, _decimals, _ipfsHash, _swarmHash).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.addToken.estimateGasAsync.bind(self, _token, _name, _symbol, _decimals, _ipfsHash, _swarmHash), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync( + _token: string, + _name: string, + _symbol: string, + _decimals: number | BigNumber, + _ipfsHash: string, + _swarmHash: string, + txData: Partial<TxData> = {}, + ): Promise<number> { + const self = (this as any) as TokenRegistryContract; + const inputAbi = self._lookupAbi('addToken(address,string,string,uint8,bytes,bytes)').inputs; + [_token, _name, _symbol, _decimals, _ipfsHash, _swarmHash] = BaseContract._formatABIDataItemList( + inputAbi, + [_token, _name, _symbol, _decimals, _ipfsHash, _swarmHash], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface('addToken(address,string,string,uint8,bytes,bytes)') + .functions.addToken(_token, _name, _symbol, _decimals, _ipfsHash, _swarmHash).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData( + _token: string, + _name: string, + _symbol: string, + _decimals: number | BigNumber, + _ipfsHash: string, + _swarmHash: string, + ): string { + const self = (this as any) as TokenRegistryContract; + const inputAbi = self._lookupAbi('addToken(address,string,string,uint8,bytes,bytes)').inputs; + [_token, _name, _symbol, _decimals, _ipfsHash, _swarmHash] = BaseContract._formatABIDataItemList( + inputAbi, + [_token, _name, _symbol, _decimals, _ipfsHash, _swarmHash], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('addToken(address,string,string,uint8,bytes,bytes)') + .functions.addToken(_token, _name, _symbol, _decimals, _ipfsHash, _swarmHash).data; + return abiEncodedTransactionData; + }, + }; + public setTokenName = { + async sendTransactionAsync(_token: string, _name: string, txData: Partial<TxData> = {}): Promise<string> { + const self = (this as any) as TokenRegistryContract; + const inputAbi = self._lookupAbi('setTokenName(address,string)').inputs; + [_token, _name] = BaseContract._formatABIDataItemList( + inputAbi, + [_token, _name], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface('setTokenName(address,string)') + .functions.setTokenName(_token, _name).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.setTokenName.estimateGasAsync.bind(self, _token, _name), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync(_token: string, _name: string, txData: Partial<TxData> = {}): Promise<number> { + const self = (this as any) as TokenRegistryContract; + const inputAbi = self._lookupAbi('setTokenName(address,string)').inputs; + [_token, _name] = BaseContract._formatABIDataItemList( + inputAbi, + [_token, _name], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface('setTokenName(address,string)') + .functions.setTokenName(_token, _name).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData(_token: string, _name: string): string { + const self = (this as any) as TokenRegistryContract; + const inputAbi = self._lookupAbi('setTokenName(address,string)').inputs; + [_token, _name] = BaseContract._formatABIDataItemList( + inputAbi, + [_token, _name], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('setTokenName(address,string)') + .functions.setTokenName(_token, _name).data; + return abiEncodedTransactionData; + }, + }; + public tokens = { + async callAsync( + index_0: string, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<[string, string, string, number, string, string]> { + const self = (this as any) as TokenRegistryContract; + const functionSignature = 'tokens(address)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [index_0] = BaseContract._formatABIDataItemList( + inputAbi, + [index_0], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.tokens(index_0) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'tokens' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray; + }, + }; + public tokenAddresses = { + async callAsync( + index_0: BigNumber, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<string> { + const self = (this as any) as TokenRegistryContract; + const functionSignature = 'tokenAddresses(uint256)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [index_0] = BaseContract._formatABIDataItemList( + inputAbi, + [index_0], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.tokenAddresses(index_0) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'tokenAddresses' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public getTokenByName = { + async callAsync( + _name: string, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<[string, string, string, number, string, string]> { + const self = (this as any) as TokenRegistryContract; + const functionSignature = 'getTokenByName(string)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [_name] = BaseContract._formatABIDataItemList( + inputAbi, + [_name], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.getTokenByName(_name) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'getTokenByName' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray; + }, + }; + public getTokenAddresses = { + async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string[]> { + const self = (this as any) as TokenRegistryContract; + const functionSignature = 'getTokenAddresses()'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.getTokenAddresses() as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'getTokenAddresses' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public setTokenIpfsHash = { + async sendTransactionAsync(_token: string, _ipfsHash: string, txData: Partial<TxData> = {}): Promise<string> { + const self = (this as any) as TokenRegistryContract; + const inputAbi = self._lookupAbi('setTokenIpfsHash(address,bytes)').inputs; + [_token, _ipfsHash] = BaseContract._formatABIDataItemList( + inputAbi, + [_token, _ipfsHash], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface('setTokenIpfsHash(address,bytes)') + .functions.setTokenIpfsHash(_token, _ipfsHash).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.setTokenIpfsHash.estimateGasAsync.bind(self, _token, _ipfsHash), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync(_token: string, _ipfsHash: string, txData: Partial<TxData> = {}): Promise<number> { + const self = (this as any) as TokenRegistryContract; + const inputAbi = self._lookupAbi('setTokenIpfsHash(address,bytes)').inputs; + [_token, _ipfsHash] = BaseContract._formatABIDataItemList( + inputAbi, + [_token, _ipfsHash], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface('setTokenIpfsHash(address,bytes)') + .functions.setTokenIpfsHash(_token, _ipfsHash).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData(_token: string, _ipfsHash: string): string { + const self = (this as any) as TokenRegistryContract; + const inputAbi = self._lookupAbi('setTokenIpfsHash(address,bytes)').inputs; + [_token, _ipfsHash] = BaseContract._formatABIDataItemList( + inputAbi, + [_token, _ipfsHash], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('setTokenIpfsHash(address,bytes)') + .functions.setTokenIpfsHash(_token, _ipfsHash).data; + return abiEncodedTransactionData; + }, + }; + public getTokenBySymbol = { + async callAsync( + _symbol: string, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<[string, string, string, number, string, string]> { + const self = (this as any) as TokenRegistryContract; + const functionSignature = 'getTokenBySymbol(string)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [_symbol] = BaseContract._formatABIDataItemList( + inputAbi, + [_symbol], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.getTokenBySymbol(_symbol) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'getTokenBySymbol' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray; + }, + }; + public setTokenSymbol = { + async sendTransactionAsync(_token: string, _symbol: string, txData: Partial<TxData> = {}): Promise<string> { + const self = (this as any) as TokenRegistryContract; + const inputAbi = self._lookupAbi('setTokenSymbol(address,string)').inputs; + [_token, _symbol] = BaseContract._formatABIDataItemList( + inputAbi, + [_token, _symbol], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface('setTokenSymbol(address,string)') + .functions.setTokenSymbol(_token, _symbol).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.setTokenSymbol.estimateGasAsync.bind(self, _token, _symbol), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync(_token: string, _symbol: string, txData: Partial<TxData> = {}): Promise<number> { + const self = (this as any) as TokenRegistryContract; + const inputAbi = self._lookupAbi('setTokenSymbol(address,string)').inputs; + [_token, _symbol] = BaseContract._formatABIDataItemList( + inputAbi, + [_token, _symbol], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface('setTokenSymbol(address,string)') + .functions.setTokenSymbol(_token, _symbol).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData(_token: string, _symbol: string): string { + const self = (this as any) as TokenRegistryContract; + const inputAbi = self._lookupAbi('setTokenSymbol(address,string)').inputs; + [_token, _symbol] = BaseContract._formatABIDataItemList( + inputAbi, + [_token, _symbol], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('setTokenSymbol(address,string)') + .functions.setTokenSymbol(_token, _symbol).data; + return abiEncodedTransactionData; + }, + }; + public transferOwnership = { + async sendTransactionAsync(newOwner: string, txData: Partial<TxData> = {}): Promise<string> { + const self = (this as any) as TokenRegistryContract; + const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; + [newOwner] = BaseContract._formatABIDataItemList( + inputAbi, + [newOwner], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface('transferOwnership(address)') + .functions.transferOwnership(newOwner).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.transferOwnership.estimateGasAsync.bind(self, newOwner), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync(newOwner: string, txData: Partial<TxData> = {}): Promise<number> { + const self = (this as any) as TokenRegistryContract; + const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; + [newOwner] = BaseContract._formatABIDataItemList( + inputAbi, + [newOwner], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface('transferOwnership(address)') + .functions.transferOwnership(newOwner).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData(newOwner: string): string { + const self = (this as any) as TokenRegistryContract; + const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; + [newOwner] = BaseContract._formatABIDataItemList( + inputAbi, + [newOwner], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('transferOwnership(address)') + .functions.transferOwnership(newOwner).data; + return abiEncodedTransactionData; + }, + }; + constructor(abi: ContractAbi, address: string, provider: Provider, defaults?: Partial<TxData>) { + super(abi, address, provider, defaults); + classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); + } +} // tslint:disable:max-file-line-count diff --git a/packages/contract-wrappers/src/contract_wrappers/generated/token_transfer_proxy.ts b/packages/contract-wrappers/src/contract_wrappers/generated/token_transfer_proxy.ts new file mode 100644 index 000000000..e533430ff --- /dev/null +++ b/packages/contract-wrappers/src/contract_wrappers/generated/token_transfer_proxy.ts @@ -0,0 +1,447 @@ +/** + * This file is auto-generated using abi-gen. Don't edit directly. + * Templates can be found at https://github.com/0xProject/0x-monorepo/tree/development/packages/contract_templates. + */ +// tslint:disable:no-consecutive-blank-lines +// tslint:disable-next-line:no-unused-variable +import { BaseContract } from '@0xproject/base-contract'; +import { + BlockParam, + BlockParamLiteral, + CallData, + ContractAbi, + DataItem, + MethodAbi, + Provider, + TxData, + TxDataPayable, +} from '@0xproject/types'; +import { BigNumber, classUtils, promisify } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import * as ethers from 'ethers'; +import * as _ from 'lodash'; + +export type TokenTransferProxyContractEventArgs = + | LogAuthorizedAddressAddedContractEventArgs + | LogAuthorizedAddressRemovedContractEventArgs; + +export enum TokenTransferProxyEvents { + LogAuthorizedAddressAdded = 'LogAuthorizedAddressAdded', + LogAuthorizedAddressRemoved = 'LogAuthorizedAddressRemoved', +} + +export interface LogAuthorizedAddressAddedContractEventArgs { + target: string; + caller: string; +} + +export interface LogAuthorizedAddressRemovedContractEventArgs { + target: string; + caller: string; +} + +// tslint:disable:no-parameter-reassignment +export class TokenTransferProxyContract extends BaseContract { + public transferFrom = { + async sendTransactionAsync( + token: string, + from: string, + to: string, + value: BigNumber, + txData: Partial<TxData> = {}, + ): Promise<string> { + const self = (this as any) as TokenTransferProxyContract; + const inputAbi = self._lookupAbi('transferFrom(address,address,address,uint256)').inputs; + [token, from, to, value] = BaseContract._formatABIDataItemList( + inputAbi, + [token, from, to, value], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface('transferFrom(address,address,address,uint256)') + .functions.transferFrom(token, from, to, value).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.transferFrom.estimateGasAsync.bind(self, token, from, to, value), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync( + token: string, + from: string, + to: string, + value: BigNumber, + txData: Partial<TxData> = {}, + ): Promise<number> { + const self = (this as any) as TokenTransferProxyContract; + const inputAbi = self._lookupAbi('transferFrom(address,address,address,uint256)').inputs; + [token, from, to, value] = BaseContract._formatABIDataItemList( + inputAbi, + [token, from, to, value], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface('transferFrom(address,address,address,uint256)') + .functions.transferFrom(token, from, to, value).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData(token: string, from: string, to: string, value: BigNumber): string { + const self = (this as any) as TokenTransferProxyContract; + const inputAbi = self._lookupAbi('transferFrom(address,address,address,uint256)').inputs; + [token, from, to, value] = BaseContract._formatABIDataItemList( + inputAbi, + [token, from, to, value], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('transferFrom(address,address,address,uint256)') + .functions.transferFrom(token, from, to, value).data; + return abiEncodedTransactionData; + }, + async callAsync( + token: string, + from: string, + to: string, + value: BigNumber, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<boolean> { + const self = (this as any) as TokenTransferProxyContract; + const functionSignature = 'transferFrom(address,address,address,uint256)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [token, from, to, value] = BaseContract._formatABIDataItemList( + inputAbi, + [token, from, to, value], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.transferFrom(token, from, to, value) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'transferFrom' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public addAuthorizedAddress = { + async sendTransactionAsync(target: string, txData: Partial<TxData> = {}): Promise<string> { + const self = (this as any) as TokenTransferProxyContract; + const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs; + [target] = BaseContract._formatABIDataItemList( + inputAbi, + [target], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface('addAuthorizedAddress(address)') + .functions.addAuthorizedAddress(target).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.addAuthorizedAddress.estimateGasAsync.bind(self, target), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync(target: string, txData: Partial<TxData> = {}): Promise<number> { + const self = (this as any) as TokenTransferProxyContract; + const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs; + [target] = BaseContract._formatABIDataItemList( + inputAbi, + [target], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface('addAuthorizedAddress(address)') + .functions.addAuthorizedAddress(target).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData(target: string): string { + const self = (this as any) as TokenTransferProxyContract; + const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs; + [target] = BaseContract._formatABIDataItemList( + inputAbi, + [target], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('addAuthorizedAddress(address)') + .functions.addAuthorizedAddress(target).data; + return abiEncodedTransactionData; + }, + }; + public authorities = { + async callAsync( + index_0: BigNumber, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<string> { + const self = (this as any) as TokenTransferProxyContract; + const functionSignature = 'authorities(uint256)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [index_0] = BaseContract._formatABIDataItemList( + inputAbi, + [index_0], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.authorities(index_0) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'authorities' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public removeAuthorizedAddress = { + async sendTransactionAsync(target: string, txData: Partial<TxData> = {}): Promise<string> { + const self = (this as any) as TokenTransferProxyContract; + const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs; + [target] = BaseContract._formatABIDataItemList( + inputAbi, + [target], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface('removeAuthorizedAddress(address)') + .functions.removeAuthorizedAddress(target).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.removeAuthorizedAddress.estimateGasAsync.bind(self, target), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync(target: string, txData: Partial<TxData> = {}): Promise<number> { + const self = (this as any) as TokenTransferProxyContract; + const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs; + [target] = BaseContract._formatABIDataItemList( + inputAbi, + [target], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface('removeAuthorizedAddress(address)') + .functions.removeAuthorizedAddress(target).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData(target: string): string { + const self = (this as any) as TokenTransferProxyContract; + const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs; + [target] = BaseContract._formatABIDataItemList( + inputAbi, + [target], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('removeAuthorizedAddress(address)') + .functions.removeAuthorizedAddress(target).data; + return abiEncodedTransactionData; + }, + }; + public owner = { + async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> { + const self = (this as any) as TokenTransferProxyContract; + const functionSignature = 'owner()'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.owner() as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'owner' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public authorized = { + async callAsync( + index_0: string, + callData: Partial<CallData> = {}, + defaultBlock?: BlockParam, + ): Promise<boolean> { + const self = (this as any) as TokenTransferProxyContract; + const functionSignature = 'authorized(address)'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [index_0] = BaseContract._formatABIDataItemList( + inputAbi, + [index_0], + BaseContract._bigNumberToString.bind(self), + ); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.authorized(index_0) as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'authorized' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public getAuthorizedAddresses = { + async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string[]> { + const self = (this as any) as TokenTransferProxyContract; + const functionSignature = 'getAuthorizedAddresses()'; + const inputAbi = self._lookupAbi(functionSignature).inputs; + [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); + const ethersFunction = self + ._lookupEthersInterface(functionSignature) + .functions.getAuthorizedAddresses() as ethers.CallDescription; + const encodedData = ethersFunction.data; + const callDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + data: encodedData, + }); + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + let resultArray = ethersFunction.parse(rawCallResult); + const outputAbi = (_.find(self.abi, { name: 'getAuthorizedAddresses' }) as MethodAbi).outputs; + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._lowercaseAddress.bind(this), + ); + resultArray = BaseContract._formatABIDataItemList( + outputAbi, + resultArray, + BaseContract._bnToBigNumber.bind(this), + ); + return resultArray[0]; + }, + }; + public transferOwnership = { + async sendTransactionAsync(newOwner: string, txData: Partial<TxData> = {}): Promise<string> { + const self = (this as any) as TokenTransferProxyContract; + const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; + [newOwner] = BaseContract._formatABIDataItemList( + inputAbi, + [newOwner], + BaseContract._bigNumberToString.bind(self), + ); + const encodedData = self + ._lookupEthersInterface('transferOwnership(address)') + .functions.transferOwnership(newOwner).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + { + ...txData, + data: encodedData, + }, + self.transferOwnership.estimateGasAsync.bind(self, newOwner), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; + }, + async estimateGasAsync(newOwner: string, txData: Partial<TxData> = {}): Promise<number> { + const self = (this as any) as TokenTransferProxyContract; + const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; + [newOwner] = BaseContract._formatABIDataItemList( + inputAbi, + [newOwner], + BaseContract._bigNumberToString.bind(this), + ); + const encodedData = self + ._lookupEthersInterface('transferOwnership(address)') + .functions.transferOwnership(newOwner).data; + const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ + ...txData, + data: encodedData, + }); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; + }, + getABIEncodedTransactionData(newOwner: string): string { + const self = (this as any) as TokenTransferProxyContract; + const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; + [newOwner] = BaseContract._formatABIDataItemList( + inputAbi, + [newOwner], + BaseContract._bigNumberToString.bind(self), + ); + const abiEncodedTransactionData = self + ._lookupEthersInterface('transferOwnership(address)') + .functions.transferOwnership(newOwner).data; + return abiEncodedTransactionData; + }, + }; + constructor(abi: ContractAbi, address: string, provider: Provider, defaults?: Partial<TxData>) { + super(abi, address, provider, defaults); + classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); + } +} // tslint:disable:max-file-line-count diff --git a/packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/token_registry_wrapper.ts index c4a193264..5ae488172 100644 --- a/packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/token_registry_wrapper.ts @@ -1,8 +1,9 @@ +import { Token } from '@0xproject/types'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; import { artifacts } from '../artifacts'; -import { Token, TokenMetadata } from '../types'; +import { TokenMetadata } from '../types'; import { assert } from '../utils/assert'; import { constants } from '../utils/constants'; @@ -105,7 +106,7 @@ export class TokenRegistryWrapper extends ContractWrapper { */ public getContractAddress(): string { const contractAddress = this._getContractAddress( - artifacts.TokenRegistryArtifact, + artifacts.TokenRegistry, this._contractAddressIfExists, ); return contractAddress; @@ -118,7 +119,7 @@ export class TokenRegistryWrapper extends ContractWrapper { return this._tokenRegistryContractIfExists; } const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync( - artifacts.TokenRegistryArtifact, + artifacts.TokenRegistry, this._contractAddressIfExists, ); const contractInstance = new TokenRegistryContract( diff --git a/packages/0x.js/src/contract_wrappers/token_transfer_proxy_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/token_transfer_proxy_wrapper.ts index be558b5be..ebd40e4d2 100644 --- a/packages/0x.js/src/contract_wrappers/token_transfer_proxy_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/token_transfer_proxy_wrapper.ts @@ -47,7 +47,7 @@ export class TokenTransferProxyWrapper extends ContractWrapper { */ public getContractAddress(): string { const contractAddress = this._getContractAddress( - artifacts.TokenTransferProxyArtifact, + artifacts.TokenTransferProxy, this._contractAddressIfExists, ); return contractAddress; @@ -60,7 +60,7 @@ export class TokenTransferProxyWrapper extends ContractWrapper { return this._tokenTransferProxyContractIfExists; } const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync( - artifacts.TokenTransferProxyArtifact, + artifacts.TokenTransferProxy, this._contractAddressIfExists, ); const contractInstance = new TokenTransferProxyContract( diff --git a/packages/0x.js/src/contract_wrappers/token_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/token_wrapper.ts index 194cfb5aa..844318c79 100644 --- a/packages/0x.js/src/contract_wrappers/token_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/token_wrapper.ts @@ -5,7 +5,14 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; import { artifacts } from '../artifacts'; -import { BlockRange, EventCallback, IndexedFilterValues, MethodOpts, TransactionOpts, ZeroExError } from '../types'; +import { + BlockRange, + ContractWrappersError, + EventCallback, + IndexedFilterValues, + MethodOpts, + TransactionOpts, +} from '../types'; import { assert } from '../utils/assert'; import { constants } from '../utils/constants'; @@ -266,7 +273,7 @@ export class TokenWrapper extends ContractWrapper { const fromAddressBalance = await this.getBalanceAsync(normalizedTokenAddress, normalizedFromAddress); if (fromAddressBalance.lessThan(amountInBaseUnits)) { - throw new Error(ZeroExError.InsufficientBalanceForTransfer); + throw new Error(ContractWrappersError.InsufficientBalanceForTransfer); } const txHash = await tokenContract.transfer.sendTransactionAsync(normalizedToAddress, amountInBaseUnits, { @@ -316,12 +323,12 @@ export class TokenWrapper extends ContractWrapper { normalizedSenderAddress, ); if (fromAddressAllowance.lessThan(amountInBaseUnits)) { - throw new Error(ZeroExError.InsufficientAllowanceForTransfer); + throw new Error(ContractWrappersError.InsufficientAllowanceForTransfer); } const fromAddressBalance = await this.getBalanceAsync(normalizedTokenAddress, normalizedFromAddress); if (fromAddressBalance.lessThan(amountInBaseUnits)) { - throw new Error(ZeroExError.InsufficientBalanceForTransfer); + throw new Error(ContractWrappersError.InsufficientBalanceForTransfer); } const txHash = await tokenContract.transferFrom.sendTransactionAsync( @@ -360,7 +367,7 @@ export class TokenWrapper extends ContractWrapper { normalizedTokenAddress, eventName, indexFilterValues, - artifacts.TokenArtifact.abi, + artifacts.Token.abi, callback, ); return subscriptionToken; @@ -403,7 +410,7 @@ export class TokenWrapper extends ContractWrapper { eventName, blockRange, indexFilterValues, - artifacts.TokenArtifact.abi, + artifacts.Token.abi, ); return logs; } @@ -418,7 +425,7 @@ export class TokenWrapper extends ContractWrapper { return tokenContract; } const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync( - artifacts.TokenArtifact, + artifacts.Token, normalizedTokenAddress, ); const contractInstance = new TokenContract( diff --git a/packages/0x.js/src/fetchers/simple_balance_and_proxy_allowance_fetcher.ts b/packages/contract-wrappers/src/fetchers/simple_balance_and_proxy_allowance_fetcher.ts index 21774d794..5017d879a 100644 --- a/packages/0x.js/src/fetchers/simple_balance_and_proxy_allowance_fetcher.ts +++ b/packages/contract-wrappers/src/fetchers/simple_balance_and_proxy_allowance_fetcher.ts @@ -1,10 +1,10 @@ +import { AbstractBalanceAndProxyAllowanceFetcher } from '@0xproject/order-utils'; import { BlockParamLiteral } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; -import { BalanceAndProxyAllowanceFetcher } from '../abstract/balance_and_proxy_allowance_fetcher'; import { TokenWrapper } from '../contract_wrappers/token_wrapper'; -export class SimpleBalanceAndProxyAllowanceFetcher implements BalanceAndProxyAllowanceFetcher { +export class SimpleBalanceAndProxyAllowanceFetcher implements AbstractBalanceAndProxyAllowanceFetcher { private _tokenWrapper: TokenWrapper; private _defaultBlock: BlockParamLiteral; constructor(token: TokenWrapper, defaultBlock: BlockParamLiteral) { diff --git a/packages/0x.js/src/fetchers/simple_order_filled_cancelled_fetcher.ts b/packages/contract-wrappers/src/fetchers/simple_order_filled_cancelled_fetcher.ts index b7548d54d..b6f31b205 100644 --- a/packages/0x.js/src/fetchers/simple_order_filled_cancelled_fetcher.ts +++ b/packages/contract-wrappers/src/fetchers/simple_order_filled_cancelled_fetcher.ts @@ -1,10 +1,10 @@ +import { AbstractOrderFilledCancelledFetcher } from '@0xproject/order-utils'; import { BlockParamLiteral } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; -import { OrderFilledCancelledFetcher } from '../abstract/order_filled_cancelled_fetcher'; import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper'; -export class SimpleOrderFilledCancelledFetcher implements OrderFilledCancelledFetcher { +export class SimpleOrderFilledCancelledFetcher implements AbstractOrderFilledCancelledFetcher { private _exchangeWrapper: ExchangeWrapper; private _defaultBlock: BlockParamLiteral; constructor(exchange: ExchangeWrapper, defaultBlock: BlockParamLiteral) { @@ -25,4 +25,10 @@ export class SimpleOrderFilledCancelledFetcher implements OrderFilledCancelledFe const cancelledTakerAmount = this._exchangeWrapper.getCancelledTakerAmountAsync(orderHash, methodOpts); return cancelledTakerAmount; } + public async getUnavailableTakerAmountAsync(orderHash: string) { + return this._exchangeWrapper.getUnavailableTakerAmountAsync(orderHash); + } + public getZRXTokenAddress(): string { + return this._exchangeWrapper.getZRXTokenAddress(); + } } diff --git a/packages/contract-wrappers/src/globals.d.ts b/packages/contract-wrappers/src/globals.d.ts new file mode 100644 index 000000000..94e63a32d --- /dev/null +++ b/packages/contract-wrappers/src/globals.d.ts @@ -0,0 +1,6 @@ +declare module '*.json' { + const json: any; + /* tslint:disable */ + export default json; + /* tslint:enable */ +} diff --git a/packages/contract-wrappers/src/index.ts b/packages/contract-wrappers/src/index.ts new file mode 100644 index 000000000..f88313eb1 --- /dev/null +++ b/packages/contract-wrappers/src/index.ts @@ -0,0 +1,68 @@ +export { ContractWrappers } from './contract_wrappers'; +export { ExchangeWrapper } from './contract_wrappers/exchange_wrapper'; +export { TokenWrapper } from './contract_wrappers/token_wrapper'; +export { TokenRegistryWrapper } from './contract_wrappers/token_registry_wrapper'; +export { EtherTokenWrapper } from './contract_wrappers/ether_token_wrapper'; +export { TokenTransferProxyWrapper } from './contract_wrappers/token_transfer_proxy_wrapper'; + +export { + ContractWrappersError, + EventCallback, + ContractEvent, + Token, + IndexedFilterValues, + BlockRange, + OrderCancellationRequest, + OrderFillRequest, + ContractEventArgs, + ZeroExContractConfig, + MethodOpts, + OrderTransactionOpts, + TransactionOpts, + LogEvent, + DecodedLogEvent, + OnOrderStateChangeCallback, +} from './types'; + +export { + BlockParamLiteral, + FilterObject, + BlockParam, + ContractEventArg, + ExchangeContractErrs, + LogWithDecodedArgs, + Order, + Provider, + SignedOrder, + ECSignature, + OrderStateValid, + OrderStateInvalid, + OrderState, + TransactionReceipt, + TransactionReceiptWithDecodedLogs, +} from '@0xproject/types'; + +export { + EtherTokenContractEventArgs, + WithdrawalContractEventArgs, + DepositContractEventArgs, + EtherTokenEvents, +} from './contract_wrappers/generated/ether_token'; + +export { + TransferContractEventArgs, + ApprovalContractEventArgs, + TokenContractEventArgs, + TokenEvents, +} from './contract_wrappers/generated/token'; + +export { + LogErrorContractEventArgs, + LogCancelContractEventArgs, + LogFillContractEventArgs, + ExchangeContractEventArgs, + ExchangeEvents, +} from './contract_wrappers/generated/exchange'; + +export { BalanceAndProxyAllowanceLazyStore } from './stores/balance_proxy_allowance_lazy_store'; +export { OrderFilledCancelledLazyStore } from './stores/order_filled_cancelled_lazy_store'; diff --git a/packages/contract-wrappers/src/monorepo_scripts/postpublish.ts b/packages/contract-wrappers/src/monorepo_scripts/postpublish.ts new file mode 100644 index 000000000..dcb99d0f7 --- /dev/null +++ b/packages/contract-wrappers/src/monorepo_scripts/postpublish.ts @@ -0,0 +1,8 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; + +import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; + +const cwd = `${__dirname}/..`; +// tslint:disable-next-line:no-floating-promises +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/contract-wrappers/src/schemas/zero_ex_contract_config_schema.ts b/packages/contract-wrappers/src/schemas/zero_ex_contract_config_schema.ts new file mode 100644 index 000000000..eec386643 --- /dev/null +++ b/packages/contract-wrappers/src/schemas/zero_ex_contract_config_schema.ts @@ -0,0 +1,5 @@ +export const zeroExContractConfigSchema = { + id: '/ZeroExContractConfig', + oneOf: [{ $ref: '/ZeroExContractPrivateNetworkConfig' }, { $ref: '/ZeroExContractPublicNetworkConfig' }], + type: 'object', +}; diff --git a/packages/contract-wrappers/src/schemas/zero_ex_contract_private_network_config_schema.ts b/packages/contract-wrappers/src/schemas/zero_ex_contract_private_network_config_schema.ts new file mode 100644 index 000000000..6d93d4e60 --- /dev/null +++ b/packages/contract-wrappers/src/schemas/zero_ex_contract_private_network_config_schema.ts @@ -0,0 +1,35 @@ +export const zeroExContractPrivateNetworkConfigSchema = { + id: '/ZeroExContractPrivateNetworkConfig', + properties: { + networkId: { + type: 'number', + minimum: 1, + }, + gasPrice: { $ref: '/Number' }, + zrxContractAddress: { $ref: '/Address' }, + exchangeContractAddress: { $ref: '/Address' }, + tokenRegistryContractAddress: { $ref: '/Address' }, + tokenTransferProxyContractAddress: { $ref: '/Address' }, + orderWatcherConfig: { + type: 'object', + properties: { + pollingIntervalMs: { + type: 'number', + minimum: 0, + }, + numConfirmations: { + type: 'number', + minimum: 0, + }, + }, + }, + }, + type: 'object', + required: [ + 'networkId', + 'zrxContractAddress', + 'exchangeContractAddress', + 'tokenRegistryContractAddress', + 'tokenTransferProxyContractAddress', + ], +}; diff --git a/packages/contract-wrappers/src/schemas/zero_ex_contract_public_network_config_schema.ts b/packages/contract-wrappers/src/schemas/zero_ex_contract_public_network_config_schema.ts new file mode 100644 index 000000000..79a241cd2 --- /dev/null +++ b/packages/contract-wrappers/src/schemas/zero_ex_contract_public_network_config_schema.ts @@ -0,0 +1,29 @@ +export const zeroExContractPublicNetworkConfigSchema = { + id: '/ZeroExContractPublicNetworkConfig', + properties: { + networkId: { + type: 'number', + enum: [1, 3, 4, 42, 50], + }, + gasPrice: { $ref: '/Number' }, + zrxContractAddress: { $ref: '/Address' }, + exchangeContractAddress: { $ref: '/Address' }, + tokenRegistryContractAddress: { $ref: '/Address' }, + tokenTransferProxyContractAddress: { $ref: '/Address' }, + orderWatcherConfig: { + type: 'object', + properties: { + pollingIntervalMs: { + type: 'number', + minimum: 0, + }, + numConfirmations: { + type: 'number', + minimum: 0, + }, + }, + }, + }, + type: 'object', + required: ['networkId'], +}; diff --git a/packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts b/packages/contract-wrappers/src/stores/balance_proxy_allowance_lazy_store.ts index 3ff116db4..614195157 100644 --- a/packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts +++ b/packages/contract-wrappers/src/stores/balance_proxy_allowance_lazy_store.ts @@ -1,14 +1,14 @@ +import { AbstractBalanceAndProxyAllowanceFetcher } from '@0xproject/order-utils'; import { BlockParamLiteral } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; -import { BalanceAndProxyAllowanceFetcher } from '../abstract/balance_and_proxy_allowance_fetcher'; import { TokenWrapper } from '../contract_wrappers/token_wrapper'; /** * Copy on read store for balances/proxyAllowances of tokens/accounts */ -export class BalanceAndProxyAllowanceLazyStore implements BalanceAndProxyAllowanceFetcher { +export class BalanceAndProxyAllowanceLazyStore implements AbstractBalanceAndProxyAllowanceFetcher { private _tokenWrapper: TokenWrapper; private _defaultBlock: BlockParamLiteral; private _balance: { diff --git a/packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts b/packages/contract-wrappers/src/stores/order_filled_cancelled_lazy_store.ts index 61d2db8c2..b554191a2 100644 --- a/packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts +++ b/packages/contract-wrappers/src/stores/order_filled_cancelled_lazy_store.ts @@ -1,14 +1,14 @@ +import { AbstractOrderFilledCancelledFetcher } from '@0xproject/order-utils'; import { BlockParamLiteral } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; -import { OrderFilledCancelledFetcher } from '../abstract/order_filled_cancelled_fetcher'; import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper'; /** * Copy on read store for filled/cancelled taker amounts */ -export class OrderFilledCancelledLazyStore implements OrderFilledCancelledFetcher { +export class OrderFilledCancelledLazyStore implements AbstractOrderFilledCancelledFetcher { private _exchangeWrapper: ExchangeWrapper; private _defaultBlock: BlockParamLiteral; private _filledTakerAmount: { @@ -64,4 +64,10 @@ export class OrderFilledCancelledLazyStore implements OrderFilledCancelledFetche this._filledTakerAmount = {}; this._cancelledTakerAmount = {}; } + public async getUnavailableTakerAmountAsync(orderHash: string) { + return this._exchangeWrapper.getUnavailableTakerAmountAsync(orderHash); + } + public getZRXTokenAddress(): string { + return this._exchangeWrapper.getZRXTokenAddress(); + } } diff --git a/packages/contract-wrappers/src/types.ts b/packages/contract-wrappers/src/types.ts new file mode 100644 index 000000000..e69701820 --- /dev/null +++ b/packages/contract-wrappers/src/types.ts @@ -0,0 +1,187 @@ +import { BigNumber } from '@0xproject/utils'; + +import { + BlockParam, + BlockParamLiteral, + ContractAbi, + ContractEventArg, + ExchangeContractErrs, + FilterObject, + LogEntryEvent, + LogWithDecodedArgs, + Order, + OrderState, + SignedOrder, +} from '@0xproject/types'; + +import { EtherTokenContractEventArgs, EtherTokenEvents } from './contract_wrappers/generated/ether_token'; +import { ExchangeContractEventArgs, ExchangeEvents } from './contract_wrappers/generated/exchange'; +import { TokenContractEventArgs, TokenEvents } from './contract_wrappers/generated/token'; + +export enum ContractWrappersError { + ExchangeContractDoesNotExist = 'EXCHANGE_CONTRACT_DOES_NOT_EXIST', + ZRXContractDoesNotExist = 'ZRX_CONTRACT_DOES_NOT_EXIST', + EtherTokenContractDoesNotExist = 'ETHER_TOKEN_CONTRACT_DOES_NOT_EXIST', + TokenTransferProxyContractDoesNotExist = 'TOKEN_TRANSFER_PROXY_CONTRACT_DOES_NOT_EXIST', + TokenRegistryContractDoesNotExist = 'TOKEN_REGISTRY_CONTRACT_DOES_NOT_EXIST', + TokenContractDoesNotExist = 'TOKEN_CONTRACT_DOES_NOT_EXIST', + ContractNotDeployedOnNetwork = 'CONTRACT_NOT_DEPLOYED_ON_NETWORK', + InsufficientAllowanceForTransfer = 'INSUFFICIENT_ALLOWANCE_FOR_TRANSFER', + InsufficientBalanceForTransfer = 'INSUFFICIENT_BALANCE_FOR_TRANSFER', + InsufficientEthBalanceForDeposit = 'INSUFFICIENT_ETH_BALANCE_FOR_DEPOSIT', + InsufficientWEthBalanceForWithdrawal = 'INSUFFICIENT_WETH_BALANCE_FOR_WITHDRAWAL', + InvalidJump = 'INVALID_JUMP', + OutOfGas = 'OUT_OF_GAS', + SubscriptionNotFound = 'SUBSCRIPTION_NOT_FOUND', + SubscriptionAlreadyPresent = 'SUBSCRIPTION_ALREADY_PRESENT', +} + +export enum InternalContractWrappersError { + NoAbiDecoder = 'NO_ABI_DECODER', + ZrxNotInTokenRegistry = 'ZRX_NOT_IN_TOKEN_REGISTRY', + WethNotInTokenRegistry = 'WETH_NOT_IN_TOKEN_REGISTRY', +} + +export type LogEvent = LogEntryEvent; +export interface DecodedLogEvent<ArgsType> { + isRemoved: boolean; + log: LogWithDecodedArgs<ArgsType>; +} + +export type EventCallback<ArgsType> = (err: null | Error, log?: DecodedLogEvent<ArgsType>) => void; + +export enum ExchangeContractErrCodes { + ERROR_FILL_EXPIRED, // Order has already expired + ERROR_FILL_NO_VALUE, // Order has already been fully filled or cancelled + ERROR_FILL_TRUNCATION, // Rounding error too large + ERROR_FILL_BALANCE_ALLOWANCE, // Insufficient balance or allowance for token transfer + ERROR_CANCEL_EXPIRED, // Order has already expired + ERROR_CANCEL_NO_VALUE, // Order has already been fully filled or cancelled +} + +export interface ContractEvent { + logIndex: number; + transactionIndex: number; + transactionHash: string; + blockHash: string; + blockNumber: number; + address: string; + type: string; + event: string; + args: ContractEventArgs; +} + +export type ContractEventArgs = ExchangeContractEventArgs | TokenContractEventArgs | EtherTokenContractEventArgs; + +// [address, name, symbol, decimals, ipfsHash, swarmHash] +export type TokenMetadata = [string, string, string, number, string, string]; + +export interface Token { + name: string; + address: string; + symbol: string; + decimals: number; +} + +export interface TxOpts { + from: string; + gas?: number; + value?: BigNumber; + gasPrice?: BigNumber; +} + +export interface TokenAddressBySymbol { + [symbol: string]: string; +} + +export type ContractEvents = TokenEvents | ExchangeEvents | EtherTokenEvents; + +export interface IndexedFilterValues { + [index: string]: ContractEventArg; +} + +export interface BlockRange { + fromBlock: BlockParam; + toBlock: BlockParam; +} + +export interface OrderCancellationRequest { + order: Order | SignedOrder; + takerTokenCancelAmount: BigNumber; +} + +export interface OrderFillRequest { + signedOrder: SignedOrder; + takerTokenFillAmount: BigNumber; +} + +export type AsyncMethod = (...args: any[]) => Promise<any>; +export type SyncMethod = (...args: any[]) => any; + +/** + * networkId: The id of the underlying ethereum network your provider is connected to. (1-mainnet, 3-ropsten, 4-rinkeby, 42-kovan, 50-testrpc) + * gasPrice: Gas price to use with every transaction + * exchangeContractAddress: The address of an exchange contract to use + * zrxContractAddress: The address of the ZRX contract to use + * tokenRegistryContractAddress: The address of a token registry contract to use + * tokenTransferProxyContractAddress: The address of the token transfer proxy contract to use + * orderWatcherConfig: All the configs related to the orderWatcher + */ +export interface ZeroExContractConfig { + networkId: number; + gasPrice?: BigNumber; + exchangeContractAddress?: string; + zrxContractAddress?: string; + tokenRegistryContractAddress?: string; + tokenTransferProxyContractAddress?: string; +} + +/** + * expectedFillTakerTokenAmount: If specified, the validation method will ensure that the + * supplied order maker has a sufficient allowance/balance to fill this amount of the order's + * takerTokenAmount. If not specified, the validation method ensures that the maker has a sufficient + * allowance/balance to fill the entire remaining order amount. + */ +export interface ValidateOrderFillableOpts { + expectedFillTakerTokenAmount?: BigNumber; +} + +/** + * defaultBlock: The block up to which to query the blockchain state. Setting this to a historical block number + * let's the user query the blockchain's state at an arbitrary point in time. In order for this to work, the + * backing Ethereum node must keep the entire historical state of the chain (e.g setting `--pruning=archive` + * flag when running Parity). + */ +export interface MethodOpts { + defaultBlock?: BlockParam; +} + +/** + * gasPrice: Gas price in Wei to use for a transaction + * gasLimit: The amount of gas to send with a transaction + */ +export interface TransactionOpts { + gasPrice?: BigNumber; + gasLimit?: number; +} + +/** + * shouldValidate: Flag indicating whether the library should make attempts to validate a transaction before + * broadcasting it. For example, order has a valid signature, maker has sufficient funds, etc. Default=true. + */ +export interface OrderTransactionOpts extends TransactionOpts { + shouldValidate?: boolean; +} + +export enum TradeSide { + Maker = 'maker', + Taker = 'taker', +} + +export enum TransferType { + Trade = 'trade', + Fee = 'fee', +} + +export type OnOrderStateChangeCallback = (err: Error | null, orderState?: OrderState) => void; +// tslint:disable:max-file-line-count diff --git a/packages/0x.js/src/utils/assert.ts b/packages/contract-wrappers/src/utils/assert.ts index 2588a4d09..2588a4d09 100644 --- a/packages/0x.js/src/utils/assert.ts +++ b/packages/contract-wrappers/src/utils/assert.ts diff --git a/packages/contract-wrappers/src/utils/constants.ts b/packages/contract-wrappers/src/utils/constants.ts new file mode 100644 index 000000000..07da6745d --- /dev/null +++ b/packages/contract-wrappers/src/utils/constants.ts @@ -0,0 +1,11 @@ +import { BigNumber } from '@0xproject/utils'; + +export const constants = { + NULL_ADDRESS: '0x0000000000000000000000000000000000000000', + TESTRPC_NETWORK_ID: 50, + INVALID_JUMP_PATTERN: 'invalid JUMP at', + OUT_OF_GAS_PATTERN: 'out of gas', + INVALID_TAKER_FORMAT: 'instance.taker is not of a type(s) string', + UNLIMITED_ALLOWANCE_IN_BASE_UNITS: new BigNumber(2).pow(256).minus(1), + DEFAULT_BLOCK_POLLING_INTERVAL: 1000, +}; diff --git a/packages/0x.js/src/utils/decorators.ts b/packages/contract-wrappers/src/utils/decorators.ts index f774d734e..64123143c 100644 --- a/packages/0x.js/src/utils/decorators.ts +++ b/packages/contract-wrappers/src/utils/decorators.ts @@ -1,6 +1,6 @@ import * as _ from 'lodash'; -import { AsyncMethod, SyncMethod, ZeroExError } from '../types'; +import { AsyncMethod, ContractWrappersError, SyncMethod } from '../types'; import { constants } from './constants'; @@ -8,10 +8,10 @@ type ErrorTransformer = (err: Error) => Error; const contractCallErrorTransformer = (error: Error) => { if (_.includes(error.message, constants.INVALID_JUMP_PATTERN)) { - return new Error(ZeroExError.InvalidJump); + return new Error(ContractWrappersError.InvalidJump); } if (_.includes(error.message, constants.OUT_OF_GAS_PATTERN)) { - return new Error(ZeroExError.OutOfGas); + return new Error(ContractWrappersError.OutOfGas); } return error; }; diff --git a/packages/0x.js/src/utils/exchange_transfer_simulator.ts b/packages/contract-wrappers/src/utils/exchange_transfer_simulator.ts index f8301f5c2..b575285a1 100644 --- a/packages/0x.js/src/utils/exchange_transfer_simulator.ts +++ b/packages/contract-wrappers/src/utils/exchange_transfer_simulator.ts @@ -1,10 +1,10 @@ -import { BlockParamLiteral } from '@0xproject/types'; +import { BlockParamLiteral, ExchangeContractErrs } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import { TokenWrapper } from '../contract_wrappers/token_wrapper'; import { BalanceAndProxyAllowanceLazyStore } from '../stores/balance_proxy_allowance_lazy_store'; -import { ExchangeContractErrs, TradeSide, TransferType } from '../types'; +import { TradeSide, TransferType } from '../types'; import { constants } from '../utils/constants'; enum FailureReason { diff --git a/packages/0x.js/src/utils/filter_utils.ts b/packages/contract-wrappers/src/utils/filter_utils.ts index c5df7321e..c5df7321e 100644 --- a/packages/0x.js/src/utils/filter_utils.ts +++ b/packages/contract-wrappers/src/utils/filter_utils.ts diff --git a/packages/0x.js/src/utils/order_validation_utils.ts b/packages/contract-wrappers/src/utils/order_validation_utils.ts index a13c3dc04..36dfbd800 100644 --- a/packages/0x.js/src/utils/order_validation_utils.ts +++ b/packages/contract-wrappers/src/utils/order_validation_utils.ts @@ -1,11 +1,10 @@ -import { getOrderHashHex, OrderError } from '@0xproject/order-utils'; -import { Order, SignedOrder } from '@0xproject/types'; +import { getOrderHashHex, isValidSignature, OrderError } from '@0xproject/order-utils'; +import { ExchangeContractErrs, Order, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; -import { ZeroEx } from '../0x'; import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper'; -import { ExchangeContractErrs, TradeSide, TransferType, ZeroExError } from '../types'; +import { ContractWrappersError, TradeSide, TransferType } from '../types'; import { constants } from '../utils/constants'; import { utils } from '../utils/utils'; @@ -144,7 +143,7 @@ export class OrderValidationUtils { throw new Error(ExchangeContractErrs.OrderFillAmountZero); } const orderHash = getOrderHashHex(signedOrder); - if (!ZeroEx.isValidSignature(orderHash, signedOrder.ecSignature, signedOrder.maker)) { + if (!isValidSignature(orderHash, signedOrder.ecSignature, signedOrder.maker)) { throw new Error(OrderError.InvalidSignature); } const unavailableTakerTokenAmount = await this._exchangeWrapper.getUnavailableTakerAmountAsync(orderHash); diff --git a/packages/0x.js/src/utils/utils.ts b/packages/contract-wrappers/src/utils/utils.ts index af1125632..af1125632 100644 --- a/packages/0x.js/src/utils/utils.ts +++ b/packages/contract-wrappers/src/utils/utils.ts diff --git a/packages/contract-wrappers/test/artifacts/AccountLevels.json b/packages/contract-wrappers/test/artifacts/AccountLevels.json new file mode 100644 index 000000000..3ec5afdf8 --- /dev/null +++ b/packages/contract-wrappers/test/artifacts/AccountLevels.json @@ -0,0 +1,39 @@ +{ + "contract_name": "AccountLevels", + "networks": { + "50": { + "solc_version": "0.4.23", + "source_tree_hash": "0x48558bbda893aa15786836980a5fffb694db15163d462619c4dcb0f8ad97977b", + "optimizer_enabled": false, + "abi": [ + { + "constant": true, + "inputs": [ + { + "name": "user", + "type": "address" + } + ], + "name": "accountLevel", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x608060405234801561001057600080fd5b5060ce8061001f6000396000f300608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680631cbd0519146044575b600080fd5b348015604f57600080fd5b506082600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506098565b6040518082815260200191505060405180910390f35b60008090509190505600a165627a7a72305820ba8f0553b1bad01d6aebe1dfdcea170d83055523ddd0c848be8952e0494b9e230029", + "runtime_bytecode": "0x608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680631cbd0519146044575b600080fd5b348015604f57600080fd5b506082600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506098565b6040518082815260200191505060405180910390f35b60008090509190505600a165627a7a72305820ba8f0553b1bad01d6aebe1dfdcea170d83055523ddd0c848be8952e0494b9e230029", + "updated_at": 1525776887441, + "source_map": "26:388:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;26:388:0;;;;;;;", + "source_map_runtime": "26:388:0:-;;;;;;;;;;;;;;;;;;;;;;;;328:84;;8:9:-1;5:2;;;30:1;27;20:12;5:2;328:84:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;381:4;404:1;397:8;;328:84;;;:::o", + "sources": [ + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/tutorials/EtherDelta/AccountLevels.sol" + ] + } + } +}
\ No newline at end of file diff --git a/packages/contract-wrappers/test/artifacts/Arbitrage.json b/packages/contract-wrappers/test/artifacts/Arbitrage.json new file mode 100644 index 000000000..fe9c1c02a --- /dev/null +++ b/packages/contract-wrappers/test/artifacts/Arbitrage.json @@ -0,0 +1,121 @@ +{ + "contract_name": "Arbitrage", + "networks": { + "50": { + "solc_version": "0.4.23", + "source_tree_hash": "0x9d4dca59038ae8c995d9d06db8e5184dc52133935ab31834e98ca16a4cba24a5", + "optimizer_enabled": false, + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "tokenAddress", + "type": "address" + } + ], + "name": "setAllowances", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "addresses", + "type": "address[6]" + }, + { + "name": "values", + "type": "uint256[12]" + }, + { + "name": "v", + "type": "uint8[2]" + }, + { + "name": "r", + "type": "bytes32[2]" + }, + { + "name": "s", + "type": "bytes32[2]" + } + ], + "name": "makeAtomicTrade", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "name": "_exchangeAddress", + "type": "address" + }, + { + "name": "_etherDeltaAddress", + "type": "address" + }, + { + "name": "_proxyAddress", + "type": "address" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + } + ], + "bytecode": "0x608060405234801561001057600080fd5b50604051606080611236833981018060405281019080805190602001909291908051906020019092919080519060200190929190505050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050506110da8061015c6000396000f300608060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633c059027146100675780638da5cb5b146100aa578063f2fde38b14610101578063f41cd05914610144575b600080fd5b34801561007357600080fd5b506100a8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061019a565b005b3480156100b657600080fd5b506100bf610560565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561010d57600080fd5b50610142600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610585565b005b34801561015057600080fd5b506101986004803603810190808060c001909192919290806101800190919291929080604001909192919290806040019091929192908060400190919291929050505061065a565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156101f757600080fd5b8190508073ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156102df57600080fd5b505af11580156102f3573d6000803e3d6000fd5b505050506040513d602081101561030957600080fd5b8101908080519060200190929190505050508073ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561040057600080fd5b505af1158015610414573d6000803e3d6000fd5b505050506040513d602081101561042a57600080fd5b8101908080519060200190929190505050508073ffffffffffffffffffffffffffffffffffffffff1663095ea7b36000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561052057600080fd5b505af1158015610534573d6000803e3d6000fd5b505050506040513d602081101561054a57600080fd5b8101908080519060200190929190505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156105e057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151561065757806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106b557600080fd5b61077b856006806020026040519081016040528092919082600660200280828437820191505050505085600c806020026040519081016040528092919082600c602002808284378201915050505050856002806020026040519081016040528092919082600260200280828437820191505050505085600280602002604051908101604052809291908260026020028082843782019150505050508560028060200260405190810160405280929190826002602002808284378201915050505050610848565b610841856006806020026040519081016040528092919082600660200280828437820191505050505085600c806020026040519081016040528092919082600c602002808284378201915050505050856002806020026040519081016040528092919082600260200280828437820191505050505085600280602002604051908101604052809291908260026020028082843782019150505050508560028060200260405190810160405280929190826002602002808284378201915050505050610bf1565b5050505050565b610850611068565b61085861108b565b600060a06040519081016040528089600060068110151561087557fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018960016006811015156108ba57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018960026006811015156108ff57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200189600360068110151561094457fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200189600460068110151561098957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815250925060c060405190810160405280886000600c811015156109da57fe5b60200201518152602001886001600c811015156109f357fe5b60200201518152602001886002600c81101515610a0c57fe5b60200201518152602001886003600c81101515610a2557fe5b60200201518152602001886004600c81101515610a3e57fe5b60200201518152602001886005600c81101515610a5757fe5b60200201518152509150866006600c81101515610a7057fe5b60200201519050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663741bcc938484848a6000600281101515610ac757fe5b60200201518a6000600281101515610adb57fe5b60200201518a6000600281101515610aef57fe5b60200201516040518763ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018087600560200280838360005b83811015610b4a578082015181840152602081019050610b2f565b5050505090500186600660200280838360005b83811015610b78578082015181840152602081019050610b5d565b505050509050018581526020018460ff1660ff168152602001836000191660001916815260200182600019166000191681526020019650505050505050600060405180830381600087803b158015610bcf57600080fd5b505af1158015610be3573d6000803e3d6000fd5b505050505050505050505050565b600084600b600c81101515610c0257fe5b60200201519050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663338b5dea876002600681101515610c5657fe5b6020020151876007600c81101515610c6a57fe5b60200201516040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610cf457600080fd5b505af1158015610d08573d6000803e3d6000fd5b50505050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630a19b14a876002600681101515610d5957fe5b6020020151876007600c81101515610d6d57fe5b6020020151896003600681101515610d8157fe5b6020020151896008600c81101515610d9557fe5b60200201518a6009600c81101515610da957fe5b60200201518b600a600c81101515610dbd57fe5b60200201518d6005600681101515610dd157fe5b60200201518c6001600281101515610de557fe5b60200201518c6001600281101515610df957fe5b60200201518c6001600281101515610e0d57fe5b60200201518c6040518c63ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018560ff1660ff168152602001846000191660001916815260200183600019166000191681526020018281526020019b505050505050505050505050600060405180830381600087803b158015610f4557600080fd5b505af1158015610f59573d6000803e3d6000fd5b50505050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639e281a98876003600681101515610faa57fe5b6020020151876008600c81101515610fbe57fe5b60200201516040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561104857600080fd5b505af115801561105c573d6000803e3d6000fd5b50505050505050505050565b60a060405190810160405280600590602082028038833980820191505090505090565b60c0604051908101604052806006906020820280388339808201915050905050905600a165627a7a72305820feb279fd744b6f3aa956cde844e557f9c865e4dcfe7702c1d634e742710ddd010029", + "runtime_bytecode": "0x608060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633c059027146100675780638da5cb5b146100aa578063f2fde38b14610101578063f41cd05914610144575b600080fd5b34801561007357600080fd5b506100a8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061019a565b005b3480156100b657600080fd5b506100bf610560565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561010d57600080fd5b50610142600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610585565b005b34801561015057600080fd5b506101986004803603810190808060c001909192919290806101800190919291929080604001909192919290806040019091929192908060400190919291929050505061065a565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156101f757600080fd5b8190508073ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156102df57600080fd5b505af11580156102f3573d6000803e3d6000fd5b505050506040513d602081101561030957600080fd5b8101908080519060200190929190505050508073ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561040057600080fd5b505af1158015610414573d6000803e3d6000fd5b505050506040513d602081101561042a57600080fd5b8101908080519060200190929190505050508073ffffffffffffffffffffffffffffffffffffffff1663095ea7b36000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561052057600080fd5b505af1158015610534573d6000803e3d6000fd5b505050506040513d602081101561054a57600080fd5b8101908080519060200190929190505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156105e057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151561065757806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106b557600080fd5b61077b856006806020026040519081016040528092919082600660200280828437820191505050505085600c806020026040519081016040528092919082600c602002808284378201915050505050856002806020026040519081016040528092919082600260200280828437820191505050505085600280602002604051908101604052809291908260026020028082843782019150505050508560028060200260405190810160405280929190826002602002808284378201915050505050610848565b610841856006806020026040519081016040528092919082600660200280828437820191505050505085600c806020026040519081016040528092919082600c602002808284378201915050505050856002806020026040519081016040528092919082600260200280828437820191505050505085600280602002604051908101604052809291908260026020028082843782019150505050508560028060200260405190810160405280929190826002602002808284378201915050505050610bf1565b5050505050565b610850611068565b61085861108b565b600060a06040519081016040528089600060068110151561087557fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018960016006811015156108ba57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018960026006811015156108ff57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200189600360068110151561094457fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200189600460068110151561098957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815250925060c060405190810160405280886000600c811015156109da57fe5b60200201518152602001886001600c811015156109f357fe5b60200201518152602001886002600c81101515610a0c57fe5b60200201518152602001886003600c81101515610a2557fe5b60200201518152602001886004600c81101515610a3e57fe5b60200201518152602001886005600c81101515610a5757fe5b60200201518152509150866006600c81101515610a7057fe5b60200201519050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663741bcc938484848a6000600281101515610ac757fe5b60200201518a6000600281101515610adb57fe5b60200201518a6000600281101515610aef57fe5b60200201516040518763ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018087600560200280838360005b83811015610b4a578082015181840152602081019050610b2f565b5050505090500186600660200280838360005b83811015610b78578082015181840152602081019050610b5d565b505050509050018581526020018460ff1660ff168152602001836000191660001916815260200182600019166000191681526020019650505050505050600060405180830381600087803b158015610bcf57600080fd5b505af1158015610be3573d6000803e3d6000fd5b505050505050505050505050565b600084600b600c81101515610c0257fe5b60200201519050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663338b5dea876002600681101515610c5657fe5b6020020151876007600c81101515610c6a57fe5b60200201516040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610cf457600080fd5b505af1158015610d08573d6000803e3d6000fd5b50505050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630a19b14a876002600681101515610d5957fe5b6020020151876007600c81101515610d6d57fe5b6020020151896003600681101515610d8157fe5b6020020151896008600c81101515610d9557fe5b60200201518a6009600c81101515610da957fe5b60200201518b600a600c81101515610dbd57fe5b60200201518d6005600681101515610dd157fe5b60200201518c6001600281101515610de557fe5b60200201518c6001600281101515610df957fe5b60200201518c6001600281101515610e0d57fe5b60200201518c6040518c63ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018560ff1660ff168152602001846000191660001916815260200183600019166000191681526020018281526020019b505050505050505050505050600060405180830381600087803b158015610f4557600080fd5b505af1158015610f59573d6000803e3d6000fd5b50505050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639e281a98876003600681101515610faa57fe5b6020020151876008600c81101515610fbe57fe5b60200201516040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561104857600080fd5b505af115801561105c573d6000803e3d6000fd5b50505050505050505050565b60a060405190810160405280600590602082028038833980820191505090505090565b60c0604051908101604052806006906020820280388339808201915050905050905600a165627a7a72305820feb279fd744b6f3aa956cde844e557f9c865e4dcfe7702c1d634e742710ddd010029", + "updated_at": 1525776886083, + "source_map": "427:3407:3:-;;;586:241;8:9:-1;5:2;;;30:1;27;20:12;5:2;586:241:3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;303:10:6;295:5;;:18;;;;;;;;;;;;;;;;;;712:16:3;692:8;;:37;;;;;;;;;;;;;;;;;;763:18;739:10;;:43;;;;;;;;;;;;;;;;;;807:13;792:12;;:28;;;;;;;;;;;;;;;;;;586:241;;;427:3407;;;;;;", + "source_map_runtime": "427:3407:3:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1039:255;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1039:255:3;;;;;;;;;;;;;;;;;;;;;;;;;;;;220:20:6;;8:9:-1;5:2;;;30:1;27;20:12;5:2;220:20:6;;;;;;;;;;;;;;;;;;;;;;;;;;;409:167;;8:9:-1;5:2;;;30:1;27;20:12;5:2;409:167:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;1765:264:3;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1765:264:3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1039:255;1113:11;379:5:6;;;;;;;;;;;365:19;;:10;:19;;;357:28;;;;;;;;1133:12:3;1113:33;;1156:5;:13;;;1178:10;;;;;;;;;;;569;1156:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1156:44:3;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1156:44:3;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1156:44:3;;;;;;;;;;;;;;;;;1210:5;:13;;;1224:12;;;;;;;;;;;569:10;1210:37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1210:37:3;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1210:37:3;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1210:37:3;;;;;;;;;;;;;;;;;1257:5;:13;;;1271:5;;;;;;;;;;;569:10;1257:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1257:30:3;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1257:30:3;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1257:30:3;;;;;;;;;;;;;;;;;1039:255;;:::o;220:20:6:-;;;;;;;;;;;;;:::o;409:167::-;379:5;;;;;;;;;;;365:19;;:10;:19;;;357:28;;;;;;;;525:1;505:22;;:8;:22;;;;501:69;;;551:8;543:5;;:16;;;;;;;;;;;;;;;;;;501:69;409:167;:::o;1765:264:3:-;379:5:6;;;;;;;;;;;365:19;;:10;:19;;;357:28;;;;;;;;1920:45:3;1938:9;1920:45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1949:6;1920:45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1957:1;1920:45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1960:1;1920:45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1963:1;1920:45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:17;:45::i;:::-;1975:47;1995:9;1975:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2006:6;1975:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2014:1;1975:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2017:1;1975:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2020:1;1975:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:19;:47::i;:::-;1765:264;;;;;:::o;2879:953::-;3026:32;;:::i;:::-;3273:26;;:::i;:::-;3561:25;3026:237;;;;;;;;;3075:9;3085:1;3075:12;;;;;;;;;;;;;3026:237;;;;;;;;3110:9;3120:1;3110:12;;;;;;;;;;;;;3026:237;;;;;;;;3145:9;3155:1;3145:12;;;;;;;;;;;;;3026:237;;;;;;;;3185:9;3195:1;3185:12;;;;;;;;;;;;;3026:237;;;;;;;;3225:9;3235:1;3225:12;;;;;;;;;;;;;3026:237;;;;;;;;;3273:278;;;;;;;;;3316:6;3323:1;3316:9;;;;;;;;;;;;;3273:278;;;;3359:6;3366:1;3359:9;;;;;;;;;;;;;3273:278;;;;3402:6;3409:1;3402:9;;;;;;;;;;;;;3273:278;;;;3437:6;3444:1;3437:9;;;;;;;;;;;;;3273:278;;;;3472:6;3479:1;3472:9;;;;;;;;;;;;;3273:278;;;;3523:6;3530:1;3523:9;;;;;;;;;;;;;3273:278;;;;;3589:6;3596:1;3589:9;;;;;;;;;;;;;3561:37;;3732:8;;;;;;;;;;;:24;;;3757:14;3773:11;3786:20;3808:1;3810;3808:4;;;;;;;;;;;;;3814:1;3816;3814:4;;;;;;;;;;;;;3820:1;3822;3820:4;;;;;;;;;;;;;3732:93;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;3732:93:3;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;3732:93:3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3732:93:3;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3732:93:3;;;;2879:953;;;;;;;;:::o;2035:838::-;2184:11;2198:6;2205:2;2198:10;;;;;;;;;;;;;2184:24;;2218:10;;;;;;;;;;;:23;;;2255:9;2265:1;2255:12;;;;;;;;;;;;;2308:6;2315:1;2308:9;;;;;;;;;;;;;2218:122;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2218:122:3;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2218:122:3;;;;2350:10;;;;;;;;;;;:16;;;2380:9;2390:1;2380:12;;;;;;;;;;;;;2433:6;2440:1;2433:9;;;;;;;;;;;;;2469;2479:1;2469:12;;;;;;;;;;;;;2523:6;2530:1;2523:9;;;;;;;;;;;;;2560:6;2567:1;2560:9;;;;;;;;;;;;;2594:6;2601:2;2594:10;;;;;;;;;;;;;2627:9;2637:1;2627:12;;;;;;;;;;;;;2661:1;2663;2661:4;;;;;;;;;;;;;2679:1;2681;2679:4;;;;;;;;;;;;;2697:1;2699;2697:4;;;;;;;;;;;;;2715:6;2350:381;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2350:381:3;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2350:381:3;;;;2741:10;;;;;;;;;;;:24;;;2779:9;2789:1;2779:12;;;;;;;;;;;;;2833:6;2840:1;2833:9;;;;;;;;;;;;;2741:125;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2741:125:3;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2741:125:3;;;;2035:838;;;;;;:::o;427:3407::-;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;427:3407:3;;;;:::o;:::-;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;427:3407:3;;;;:::o", + "sources": [ + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/protocol/Exchange/Exchange.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/protocol/TokenTransferProxy/TokenTransferProxy.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/tokens/Token/Token.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/tutorials/Arbitrage/Arbitrage.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/tutorials/EtherDelta/AccountLevels.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/tutorials/EtherDelta/EtherDelta.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/utils/Ownable/Ownable.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/utils/SafeMath/SafeMath.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/previous/Ownable/Ownable_v1.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/previous/SafeMath/SafeMath_v1.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/previous/Token/Token_v1.sol" + ] + } + } +}
\ No newline at end of file diff --git a/packages/contract-wrappers/test/artifacts/DummyToken.json b/packages/contract-wrappers/test/artifacts/DummyToken.json new file mode 100644 index 000000000..3ed430c47 --- /dev/null +++ b/packages/contract-wrappers/test/artifacts/DummyToken.json @@ -0,0 +1,324 @@ +{ + "contract_name": "DummyToken", + "networks": { + "50": { + "solc_version": "0.4.23", + "source_tree_hash": "0x2f9492eca3d4b55758be98c05afd51d51310ed97769b69ae7d45366f038de653", + "optimizer_enabled": false, + "abi": [ + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_spender", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_value", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_target", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "setBalance", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "name": "_name", + "type": "string" + }, + { + "name": "_symbol", + "type": "string" + }, + { + "name": "_decimals", + "type": "uint256" + }, + { + "name": "_totalSupply", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_from", + "type": "address" + }, + { + "indexed": true, + "name": "_to", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "name": "_spender", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + } + ], + "bytecode": "0x60806040523480156200001157600080fd5b506040516200126b3803806200126b8339810180604052810190808051820192919060200180518201929190602001805190602001909291908051906020019092919050505033600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508360049080519060200190620000b092919062000125565b508260059080519060200190620000c992919062000125565b508160068190555080600281905550806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050505050620001d4565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200016857805160ff191683800117855562000199565b8280016001018555821562000199579182015b82811115620001985782518255916020019190600101906200017b565b5b509050620001a89190620001ac565b5090565b620001d191905b80821115620001cd576000816000905550600101620001b3565b5090565b90565b61108780620001e46000396000f3006080604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100ca578063095ea7b31461015a57806318160ddd146101bf57806323b872dd146101ea578063313ce5671461026f57806370a082311461029a5780638da5cb5b146102f157806395d89b4114610348578063a0712d68146103d8578063a9059cbb14610405578063dd62ed3e1461046a578063e30443bc146104e1578063f2fde38b1461052e575b600080fd5b3480156100d657600080fd5b506100df610571565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011f578082015181840152602081019050610104565b50505050905090810190601f16801561014c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561016657600080fd5b506101a5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061060f565b604051808215151515815260200191505060405180910390f35b3480156101cb57600080fd5b506101d4610701565b6040518082815260200191505060405180910390f35b3480156101f657600080fd5b50610255600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610707565b604051808215151515815260200191505060405180910390f35b34801561027b57600080fd5b50610284610a28565b6040518082815260200191505060405180910390f35b3480156102a657600080fd5b506102db600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a2e565b6040518082815260200191505060405180910390f35b3480156102fd57600080fd5b50610306610a76565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561035457600080fd5b5061035d610a9c565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561039d578082015181840152602081019050610382565b50505050905090810190601f1680156103ca5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103e457600080fd5b5061040360048036038101908080359060200190929190505050610b3a565b005b34801561041157600080fd5b50610450600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bf1565b604051808215151515815260200191505060405180910390f35b34801561047657600080fd5b506104cb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dd1565b6040518082815260200191505060405180910390f35b3480156104ed57600080fd5b5061052c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e58565b005b34801561053a57600080fd5b5061056f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f4d565b005b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106075780601f106105dc57610100808354040283529160200191610607565b820191906000526020600020905b8154815290600101906020018083116105ea57829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60025481565b600080600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156107d75750828110155b801561086157506000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110155b151561086c57600080fd5b826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8110156109b75782600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b60065481565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b325780601f10610b0757610100808354040283529160200191610b32565b820191906000526020600020905b815481529060010190602001808311610b1557829003601f168201915b505050505081565b68056bc75e2d631000008111151515610b5257600080fd5b610b9a816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611024565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610be860025482611024565b60028190555050565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610cbf57506000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110155b1515610cca57600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610eb657600080fd5b610ebf83610a2e565b905080821015610ee957610ede600254610ed98385611042565b611042565b600281905550610f05565b610efe600254610ef98484611042565b611024565b6002819055505b816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fa957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156110215780600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b600080828401905083811015151561103857fe5b8091505092915050565b600082821115151561105057fe5b8183039050929150505600a165627a7a723058206617294e53696a49168d286205dfacf136fe719bb1cfb5429aedb20732ad7bb40029", + "runtime_bytecode": "0x6080604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100ca578063095ea7b31461015a57806318160ddd146101bf57806323b872dd146101ea578063313ce5671461026f57806370a082311461029a5780638da5cb5b146102f157806395d89b4114610348578063a0712d68146103d8578063a9059cbb14610405578063dd62ed3e1461046a578063e30443bc146104e1578063f2fde38b1461052e575b600080fd5b3480156100d657600080fd5b506100df610571565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011f578082015181840152602081019050610104565b50505050905090810190601f16801561014c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561016657600080fd5b506101a5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061060f565b604051808215151515815260200191505060405180910390f35b3480156101cb57600080fd5b506101d4610701565b6040518082815260200191505060405180910390f35b3480156101f657600080fd5b50610255600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610707565b604051808215151515815260200191505060405180910390f35b34801561027b57600080fd5b50610284610a28565b6040518082815260200191505060405180910390f35b3480156102a657600080fd5b506102db600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a2e565b6040518082815260200191505060405180910390f35b3480156102fd57600080fd5b50610306610a76565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561035457600080fd5b5061035d610a9c565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561039d578082015181840152602081019050610382565b50505050905090810190601f1680156103ca5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103e457600080fd5b5061040360048036038101908080359060200190929190505050610b3a565b005b34801561041157600080fd5b50610450600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bf1565b604051808215151515815260200191505060405180910390f35b34801561047657600080fd5b506104cb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dd1565b6040518082815260200191505060405180910390f35b3480156104ed57600080fd5b5061052c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e58565b005b34801561053a57600080fd5b5061056f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f4d565b005b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106075780601f106105dc57610100808354040283529160200191610607565b820191906000526020600020905b8154815290600101906020018083116105ea57829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60025481565b600080600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156107d75750828110155b801561086157506000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110155b151561086c57600080fd5b826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8110156109b75782600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b60065481565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b325780601f10610b0757610100808354040283529160200191610b32565b820191906000526020600020905b815481529060010190602001808311610b1557829003601f168201915b505050505081565b68056bc75e2d631000008111151515610b5257600080fd5b610b9a816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611024565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610be860025482611024565b60028190555050565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610cbf57506000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110155b1515610cca57600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610eb657600080fd5b610ebf83610a2e565b905080821015610ee957610ede600254610ed98385611042565b611042565b600281905550610f05565b610efe600254610ef98484611042565b611024565b6002819055505b816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fa957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156110215780600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b600080828401905083811015151561103857fe5b8091505092915050565b600082821115151561105057fe5b8183039050929150505600a165627a7a723058206617294e53696a49168d286205dfacf136fe719bb1cfb5429aedb20732ad7bb40029", + "updated_at": 1525776875456, + "source_map": "139:831:0:-;;;263:303;8:9:-1;5:2;;;30:1;27;20:12;5:2;263:303:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;303:10:5;295:5;;:18;;;;;;;;;;;;;;;;;;417:5:0;410:4;:12;;;;;;;;;;;;:::i;:::-;;441:7;432:6;:16;;;;;;;;;;;;:::i;:::-;;469:9;458:8;:20;;;;502:12;488:11;:26;;;;547:12;524:8;:20;533:10;524:20;;;;;;;;;;;;;;;:35;;;;263:303;;;;139:831;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;", + "source_map_runtime": "139:831:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;186:18;;8:9:-1;5:2;;;30:1;27;20:12;5:2;186:18:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;186:18:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;853:214:2;;8:9:-1;5:2;;;30:1;27;20:12;5:2;853:214:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1472:23;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1472:23:2;;;;;;;;;;;;;;;;;;;;;;;1091:498:4;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1091:498:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;236:20:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;236:20:0;;;;;;;;;;;;;;;;;;;;;;;1073:130:2;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1073:130:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;220:20:5;;8:9:-1;5:2;;;30:1;27;20:12;5:2;220:20:5;;;;;;;;;;;;;;;;;;;;;;;;;;;210::0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;210:20:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;210:20:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;342:225:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;342:225:1;;;;;;;;;;;;;;;;;;;;;;;;;;107:322:2;;8:9:-1;5:2;;;30:1;27;20:12;5:2;107:322:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1209:157;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1209:157:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;572:396:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;572:396:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;409:167:5;;8:9:-1;5:2;;;30:1;27;20:12;5:2;409:167:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;186:18:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;853:214:2:-;933:4;985:6;953:7;:19;961:10;953:19;;;;;;;;;;;;;;;:29;973:8;953:29;;;;;;;;;;;;;;;:38;;;;1022:8;1001:38;;1010:10;1001:38;;;1032:6;1001:38;;;;;;;;;;;;;;;;;;1056:4;1049:11;;853:214;;;;:::o;1472:23::-;;;;:::o;1091:498:4:-;1186:4;1206:14;1223:7;:14;1231:5;1223:14;;;;;;;;;;;;;;;:26;1238:10;1223:26;;;;;;;;;;;;;;;;1206:43;;1286:6;1267:8;:15;1276:5;1267:15;;;;;;;;;;;;;;;;:25;;:48;;;;;1309:6;1296:9;:19;;1267:48;:91;;;;;1345:8;:13;1354:3;1345:13;;;;;;;;;;;;;;;;1335:6;1319:8;:13;1328:3;1319:13;;;;;;;;;;;;;;;;:22;:39;;1267:91;1259:100;;;;;;;;1386:6;1369:8;:13;1378:3;1369:13;;;;;;;;;;;;;;;;:23;;;;;;;;;;;1421:6;1402:8;:15;1411:5;1402:15;;;;;;;;;;;;;;;;:25;;;;;;;;;;;745:10;1441:9;:20;1437:87;;;1507:6;1477:7;:14;1485:5;1477:14;;;;;;;;;;;;;;;:26;1492:10;1477:26;;;;;;;;;;;;;;;;:36;;;;;;;;;;;1437:87;1549:3;1533:28;;1542:5;1533:28;;;1554:6;1533:28;;;;;;;;;;;;;;;;;;1578:4;1571:11;;1091:498;;;;;;:::o;236:20:0:-;;;;:::o;1073:130:2:-;1153:4;1180:8;:16;1189:6;1180:16;;;;;;;;;;;;;;;;1173:23;;1073:130;;;:::o;220:20:5:-;;;;;;;;;;;;;:::o;210::0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;342:225:1:-;416:21;406:6;:31;;398:40;;;;;;;;471:37;479:6;487:8;:20;496:10;487:20;;;;;;;;;;;;;;;;471:7;:37::i;:::-;448:8;:20;457:10;448:20;;;;;;;;;;;;;;;:60;;;;532:28;540:11;;553:6;532:7;:28::i;:::-;518:11;:42;;;;342:225;:::o;107:322:2:-;183:4;235:6;211:8;:20;220:10;211:20;;;;;;;;;;;;;;;;:30;;:73;;;;;271:8;:13;280:3;271:13;;;;;;;;;;;;;;;;261:6;245:8;:13;254:3;245:13;;;;;;;;;;;;;;;;:22;:39;;211:73;203:82;;;;;;;;319:6;295:8;:20;304:10;295:20;;;;;;;;;;;;;;;;:30;;;;;;;;;;;352:6;335:8;:13;344:3;335:13;;;;;;;;;;;;;;;;:23;;;;;;;;;;;389:3;368:33;;377:10;368:33;;;394:6;368:33;;;;;;;;;;;;;;;;;;418:4;411:11;;107:322;;;;:::o;1209:157::-;1307:4;1334:7;:15;1342:6;1334:15;;;;;;;;;;;;;;;:25;1350:8;1334:25;;;;;;;;;;;;;;;;1327:32;;1209:157;;;;:::o;572:396:0:-;669:16;379:5:5;;;;;;;;;;;365:19;;:10;:19;;;357:28;;;;;;;;688:18:0;698:7;688:9;:18::i;:::-;669:37;;729:11;720:6;:20;716:210;;;770:50;778:11;;791:28;799:11;812:6;791:7;:28::i;:::-;770:7;:50::i;:::-;756:11;:64;;;;716:210;;;865:50;873:11;;886:28;894:6;902:11;886:7;:28::i;:::-;865:7;:50::i;:::-;851:11;:64;;;;716:210;955:6;935:8;:17;944:7;935:17;;;;;;;;;;;;;;;:26;;;;572:396;;;:::o;409:167:5:-;379:5;;;;;;;;;;;365:19;;:10;:19;;;357:28;;;;;;;;525:1;505:22;;:8;:22;;;;501:69;;;551:8;543:5;;:16;;;;;;;;;;;;;;;;;;501:69;409:167;:::o;536:166:6:-;616:7;639:6;652:1;648;:5;639:14;;675:1;670;:6;;663:14;;;;;;694:1;687:8;;536:166;;;;;:::o;384:146::-;464:7;499:1;494;:6;;487:14;;;;;;522:1;518;:5;511:12;;384:146;;;;:::o", + "sources": [ + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/test/DummyToken/DummyToken.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/test/Mintable/Mintable.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/tokens/ERC20Token/ERC20Token.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/tokens/Token/Token.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/tokens/UnlimitedAllowanceToken/UnlimitedAllowanceToken.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/utils/Ownable/Ownable.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/utils/SafeMath/SafeMath.sol" + ] + } + } +}
\ No newline at end of file diff --git a/packages/contract-wrappers/test/artifacts/EtherDelta.json b/packages/contract-wrappers/test/artifacts/EtherDelta.json new file mode 100644 index 000000000..8ea4e008f --- /dev/null +++ b/packages/contract-wrappers/test/artifacts/EtherDelta.json @@ -0,0 +1,875 @@ +{ + "contract_name": "EtherDelta", + "networks": { + "50": { + "solc_version": "0.4.23", + "source_tree_hash": "0x00c7e1f07a9b18919e3f2989e837a31bd5089a3f877f8facd320d60b919c6023", + "optimizer_enabled": false, + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "tokenGet", + "type": "address" + }, + { + "name": "amountGet", + "type": "uint256" + }, + { + "name": "tokenGive", + "type": "address" + }, + { + "name": "amountGive", + "type": "uint256" + }, + { + "name": "expires", + "type": "uint256" + }, + { + "name": "nonce", + "type": "uint256" + }, + { + "name": "user", + "type": "address" + }, + { + "name": "v", + "type": "uint8" + }, + { + "name": "r", + "type": "bytes32" + }, + { + "name": "s", + "type": "bytes32" + }, + { + "name": "amount", + "type": "uint256" + } + ], + "name": "trade", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "tokenGet", + "type": "address" + }, + { + "name": "amountGet", + "type": "uint256" + }, + { + "name": "tokenGive", + "type": "address" + }, + { + "name": "amountGive", + "type": "uint256" + }, + { + "name": "expires", + "type": "uint256" + }, + { + "name": "nonce", + "type": "uint256" + } + ], + "name": "order", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "bytes32" + } + ], + "name": "orderFills", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "tokenGet", + "type": "address" + }, + { + "name": "amountGet", + "type": "uint256" + }, + { + "name": "tokenGive", + "type": "address" + }, + { + "name": "amountGive", + "type": "uint256" + }, + { + "name": "expires", + "type": "uint256" + }, + { + "name": "nonce", + "type": "uint256" + }, + { + "name": "v", + "type": "uint8" + }, + { + "name": "r", + "type": "bytes32" + }, + { + "name": "s", + "type": "bytes32" + } + ], + "name": "cancelOrder", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "token", + "type": "address" + }, + { + "name": "amount", + "type": "uint256" + } + ], + "name": "depositToken", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "tokenGet", + "type": "address" + }, + { + "name": "amountGet", + "type": "uint256" + }, + { + "name": "tokenGive", + "type": "address" + }, + { + "name": "amountGive", + "type": "uint256" + }, + { + "name": "expires", + "type": "uint256" + }, + { + "name": "nonce", + "type": "uint256" + }, + { + "name": "user", + "type": "address" + }, + { + "name": "v", + "type": "uint8" + }, + { + "name": "r", + "type": "bytes32" + }, + { + "name": "s", + "type": "bytes32" + } + ], + "name": "amountFilled", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "address" + } + ], + "name": "tokens", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "feeMake_", + "type": "uint256" + } + ], + "name": "changeFeeMake", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "feeMake", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "feeRebate_", + "type": "uint256" + } + ], + "name": "changeFeeRebate", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "feeAccount", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "tokenGet", + "type": "address" + }, + { + "name": "amountGet", + "type": "uint256" + }, + { + "name": "tokenGive", + "type": "address" + }, + { + "name": "amountGive", + "type": "uint256" + }, + { + "name": "expires", + "type": "uint256" + }, + { + "name": "nonce", + "type": "uint256" + }, + { + "name": "user", + "type": "address" + }, + { + "name": "v", + "type": "uint8" + }, + { + "name": "r", + "type": "bytes32" + }, + { + "name": "s", + "type": "bytes32" + }, + { + "name": "amount", + "type": "uint256" + }, + { + "name": "sender", + "type": "address" + } + ], + "name": "testTrade", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "feeAccount_", + "type": "address" + } + ], + "name": "changeFeeAccount", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "feeRebate", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "feeTake_", + "type": "uint256" + } + ], + "name": "changeFeeTake", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "admin_", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "token", + "type": "address" + }, + { + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawToken", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "bytes32" + } + ], + "name": "orders", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "feeTake", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "deposit", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "accountLevelsAddr_", + "type": "address" + } + ], + "name": "changeAccountLevelsAddr", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "accountLevelsAddr", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "token", + "type": "address" + }, + { + "name": "user", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "tokenGet", + "type": "address" + }, + { + "name": "amountGet", + "type": "uint256" + }, + { + "name": "tokenGive", + "type": "address" + }, + { + "name": "amountGive", + "type": "uint256" + }, + { + "name": "expires", + "type": "uint256" + }, + { + "name": "nonce", + "type": "uint256" + }, + { + "name": "user", + "type": "address" + }, + { + "name": "v", + "type": "uint8" + }, + { + "name": "r", + "type": "bytes32" + }, + { + "name": "s", + "type": "bytes32" + } + ], + "name": "availableVolume", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "name": "admin_", + "type": "address" + }, + { + "name": "feeAccount_", + "type": "address" + }, + { + "name": "accountLevelsAddr_", + "type": "address" + }, + { + "name": "feeMake_", + "type": "uint256" + }, + { + "name": "feeTake_", + "type": "uint256" + }, + { + "name": "feeRebate_", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "payable": false, + "stateMutability": "nonpayable", + "type": "fallback" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "tokenGet", + "type": "address" + }, + { + "indexed": false, + "name": "amountGet", + "type": "uint256" + }, + { + "indexed": false, + "name": "tokenGive", + "type": "address" + }, + { + "indexed": false, + "name": "amountGive", + "type": "uint256" + }, + { + "indexed": false, + "name": "expires", + "type": "uint256" + }, + { + "indexed": false, + "name": "nonce", + "type": "uint256" + }, + { + "indexed": false, + "name": "user", + "type": "address" + } + ], + "name": "Order", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "tokenGet", + "type": "address" + }, + { + "indexed": false, + "name": "amountGet", + "type": "uint256" + }, + { + "indexed": false, + "name": "tokenGive", + "type": "address" + }, + { + "indexed": false, + "name": "amountGive", + "type": "uint256" + }, + { + "indexed": false, + "name": "expires", + "type": "uint256" + }, + { + "indexed": false, + "name": "nonce", + "type": "uint256" + }, + { + "indexed": false, + "name": "user", + "type": "address" + }, + { + "indexed": false, + "name": "v", + "type": "uint8" + }, + { + "indexed": false, + "name": "r", + "type": "bytes32" + }, + { + "indexed": false, + "name": "s", + "type": "bytes32" + } + ], + "name": "Cancel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "tokenGet", + "type": "address" + }, + { + "indexed": false, + "name": "amountGet", + "type": "uint256" + }, + { + "indexed": false, + "name": "tokenGive", + "type": "address" + }, + { + "indexed": false, + "name": "amountGive", + "type": "uint256" + }, + { + "indexed": false, + "name": "get", + "type": "address" + }, + { + "indexed": false, + "name": "give", + "type": "address" + } + ], + "name": "Trade", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "user", + "type": "address" + }, + { + "indexed": false, + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "name": "balance", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "user", + "type": "address" + }, + { + "indexed": false, + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "name": "balance", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + } + ], + "bytecode": "0x608060405234801561001057600080fd5b5060405160c0806137a8833981018060405281019080805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190505050856000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555084600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550826003819055508160048190555080600581905550505050505050613657806101516000396000f300608060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630a19b14a146101665780630b9276661461024457806319774d43146102cf578063278b8c0e146103345780632e1a7d4d146103e8578063338b5dea1461041557806346be96c314610462578063508493bc1461054a57806354d03b5c146105c157806357786394146105ee5780635e1d7ae41461061957806365e17c9d146106465780636c86888b1461069d57806371ffcb16146107b3578063731c2f81146107f65780638823a9c0146108215780638f2839701461084e5780639e281a9814610891578063bb5f4629146108de578063c281309e14610947578063d0e30db014610972578063e8f6bc2e1461097c578063f3412942146109bf578063f7888aec14610a16578063f851a44014610a8d578063fb6e155f14610ae4575b34801561016057600080fd5b50600080fd5b34801561017257600080fd5b50610242600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff1690602001909291908035600019169060200190929190803560001916906020019092919080359060200190929190505050610bcc565b005b34801561025057600080fd5b506102cd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803590602001909291905050506110e1565b005b3480156102db57600080fd5b5061031e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035600019169060200190929190505050611380565b6040518082815260200191505060405180910390f35b34801561034057600080fd5b506103e6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803560ff169060200190929190803560001916906020019092919080356000191690602001909291905050506113a5565b005b3480156103f457600080fd5b50610413600480360381019080803590602001909291905050506117cd565b005b34801561042157600080fd5b50610460600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611a4c565b005b34801561046e57600080fd5b50610534600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff16906020019092919080356000191690602001909291908035600019169060200190929190505050611dba565b6040518082815260200191505060405180910390f35b34801561055657600080fd5b506105ab600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f5f565b6040518082815260200191505060405180910390f35b3480156105cd57600080fd5b506105ec60048036038101908080359060200190929190505050611f84565b005b3480156105fa57600080fd5b50610603611ff8565b6040518082815260200191505060405180910390f35b34801561062557600080fd5b5061064460048036038101908080359060200190929190505050611ffe565b005b34801561065257600080fd5b5061065b61207e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106a957600080fd5b50610799600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff1690602001909291908035600019169060200190929190803560001916906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506120a4565b604051808215151515815260200191505060405180910390f35b3480156107bf57600080fd5b506107f4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612167565b005b34801561080257600080fd5b5061080b612206565b6040518082815260200191505060405180910390f35b34801561082d57600080fd5b5061084c6004803603810190808035906020019092919050505061220c565b005b34801561085a57600080fd5b5061088f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061228c565b005b34801561089d57600080fd5b506108dc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061232a565b005b3480156108ea57600080fd5b5061092d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080356000191690602001909291905050506126ed565b604051808215151515815260200191505060405180910390f35b34801561095357600080fd5b5061095c61271c565b6040518082815260200191505060405180910390f35b61097a612722565b005b34801561098857600080fd5b506109bd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506128f6565b005b3480156109cb57600080fd5b506109d4612995565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610a2257600080fd5b50610a77600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506129bb565b6040518082815260200191505060405180910390f35b348015610a9957600080fd5b50610aa2612a42565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610af057600080fd5b50610bb6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff16906020019092919080356000191690602001909291908035600019169060200190929190505050612a67565b6040518082815260200191505060405180910390f35b60006002308d8d8d8d8d8d604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506020604051808303816000865af1158015610cde573d6000803e3d6000fd5b5050506040513d6020811015610cf357600080fd5b81019080805190602001909291905050509050600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000826000191660001916815260200190815260200160002060009054906101000a900460ff1680610e6757508573ffffffffffffffffffffffffffffffffffffffff1660018260405180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040518091039020878787604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1158015610e45573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff16145b8015610e735750874311155b8015610ee057508a610edd600860008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084600019166000191681526020019081526020016000205484612e3d565b11155b1515610eeb57600080fd5b610ef98c8c8c8c8a87612e5b565b610f5b600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083600019166000191681526020019081526020016000205483612e3d565b600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008360001916600019168152602001908152602001600020819055507f6effdda786735d5033bfad5f53e5131abcced9e52be6c507b62d639685fbed6d8c838c8e868e02811515610fe857fe5b048a33604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001965050505050505060405180910390a1505050505050505050505050565b6000600230888888888888604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506020604051808303816000865af11580156111f3573d6000803e3d6000fd5b5050506040513d602081101561120857600080fd5b810190808051906020019092919050505090506001600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000836000191660001916815260200190815260200160002060006101000a81548160ff0219169083151502179055507f3f7f2eda73683c21a15f9435af1028c93185b5f1fa38270762dc32be606b3e8587878787878733604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200197505050505050505060405180910390a150505050505050565b6008602052816000526040600020602052806000526040600020600091509150505481565b60006002308b8b8b8b8b8b604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506020604051808303816000865af11580156114b7573d6000803e3d6000fd5b5050506040513d60208110156114cc57600080fd5b81019080805190602001909291905050509050600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000826000191660001916815260200190815260200160002060009054906101000a900460ff168061164057503373ffffffffffffffffffffffffffffffffffffffff1660018260405180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040518091039020868686604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af115801561161e573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff16145b151561164b57600080fd5b88600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008360001916600019168152602001908152602001600020819055507f1e0b760c386003e9cb9bcf4fcf3997886042859d9b6ed6320e804597fcdb28b08a8a8a8a8a8a338b8b8b604051808b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018a81526020018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018881526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018460ff1660ff168152602001836000191660001916815260200182600019166000191681526020019a505050505050505050505060405180910390a150505050505050505050565b80600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561184057600080fd5b6118b0600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826135df565b600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff168160405160006040518083038185875af192505050151561195157600080fd5b7ff341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb56760003383600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a150565b60008273ffffffffffffffffffffffffffffffffffffffff161415611a7057600080fd5b8173ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015611b4757600080fd5b505af1158015611b5b573d6000803e3d6000fd5b505050506040513d6020811015611b7157600080fd5b81019080805190602001909291905050501515611b8d57600080fd5b611c13600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482612e3d565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7823383600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a15050565b6000806002308d8d8d8d8d8d604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506020604051808303816000865af1158015611ecd573d6000803e3d6000fd5b5050506040513d6020811015611ee257600080fd5b81019080805190602001909291905050509050600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008260001916600019168152602001908152602001600020549150509a9950505050505050505050565b6006602052816000526040600020602052806000526040600020600091509150505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611fdf57600080fd5b600354811115611fee57600080fd5b8060038190555050565b60035481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561205957600080fd5b60055481108061206a575060045481115b1561207457600080fd5b8060058190555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600082600660008f73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156121435750826121408e8e8e8e8e8e8e8e8e8e612a67565b10155b15156121525760009050612157565b600190505b9c9b505050505050505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156121c257600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60055481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561226757600080fd5b600454811180612278575060055481105b1561228257600080fd5b8060048190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156122e757600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008273ffffffffffffffffffffffffffffffffffffffff16141561234e57600080fd5b80600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156123d757600080fd5b61245d600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826135df565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561258057600080fd5b505af1158015612594573d6000803e3d6000fd5b505050506040513d60208110156125aa57600080fd5b810190808051906020019092919050505015156125c657600080fd5b7ff341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb567823383600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a15050565b60076020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60045481565b612792600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205434612e3d565b600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d760003334600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a1565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561295157600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000806002308f8f8f8f8f8f604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506020604051808303816000865af1158015612b7d573d6000803e3d6000fd5b5050506040513d6020811015612b9257600080fd5b81019080805190602001909291905050509250600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000846000191660001916815260200190815260200160002060009054906101000a900460ff1680612d0657508773ffffffffffffffffffffffffffffffffffffffff1660018460405180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040518091039020898989604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1158015612ce4573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff16145b8015612d125750894311155b1515612d215760009350612e2c565b612d838d600860008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008660001916600019168152602001908152602001600020546135df565b91508a612e0c600660008f73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548f6135f8565b811515612e1557fe5b04905080821015612e2857819350612e2c565b8093505b5050509a9950505050505050505050565b6000808284019050838110151515612e5157fe5b8091505092915050565b600080600080670de0b6b3a7640000612e76866003546135f8565b811515612e7f57fe5b049350670de0b6b3a7640000612e97866004546135f8565b811515612ea057fe5b049250600091506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561301c57600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631cbd0519876040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015612fa657600080fd5b505af1158015612fba573d6000803e3d6000fd5b505050506040513d6020811015612fd057600080fd5b81019080805190602001909291905050509050600181141561300e57670de0b6b3a7640000613001866005546135f8565b81151561300a57fe5b0491505b600281141561301b578291505b5b6130ab600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546130a68786612e3d565b6135df565b600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131c3600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131be6131b88886612e3d565b876135df565b612e3d565b600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506132fd600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546132f86132f28787612e3d565b856135df565b612e3d565b600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613439600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548a61342a8a896135f8565b81151561343357fe5b046135df565b600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613553600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548a6135448a896135f8565b81151561354d57fe5b04612e3d565b600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050505050505050505050565b60008282111515156135ed57fe5b818303905092915050565b60008082840290506000841480613619575082848281151561361657fe5b04145b151561362157fe5b80915050929150505600a165627a7a72305820998b4b5b3f327b78bdbd9295d90357156733f4380f94800b9722256f4f9781bf0029", + "runtime_bytecode": "0x608060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630a19b14a146101665780630b9276661461024457806319774d43146102cf578063278b8c0e146103345780632e1a7d4d146103e8578063338b5dea1461041557806346be96c314610462578063508493bc1461054a57806354d03b5c146105c157806357786394146105ee5780635e1d7ae41461061957806365e17c9d146106465780636c86888b1461069d57806371ffcb16146107b3578063731c2f81146107f65780638823a9c0146108215780638f2839701461084e5780639e281a9814610891578063bb5f4629146108de578063c281309e14610947578063d0e30db014610972578063e8f6bc2e1461097c578063f3412942146109bf578063f7888aec14610a16578063f851a44014610a8d578063fb6e155f14610ae4575b34801561016057600080fd5b50600080fd5b34801561017257600080fd5b50610242600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff1690602001909291908035600019169060200190929190803560001916906020019092919080359060200190929190505050610bcc565b005b34801561025057600080fd5b506102cd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803590602001909291905050506110e1565b005b3480156102db57600080fd5b5061031e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035600019169060200190929190505050611380565b6040518082815260200191505060405180910390f35b34801561034057600080fd5b506103e6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803560ff169060200190929190803560001916906020019092919080356000191690602001909291905050506113a5565b005b3480156103f457600080fd5b50610413600480360381019080803590602001909291905050506117cd565b005b34801561042157600080fd5b50610460600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611a4c565b005b34801561046e57600080fd5b50610534600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff16906020019092919080356000191690602001909291908035600019169060200190929190505050611dba565b6040518082815260200191505060405180910390f35b34801561055657600080fd5b506105ab600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f5f565b6040518082815260200191505060405180910390f35b3480156105cd57600080fd5b506105ec60048036038101908080359060200190929190505050611f84565b005b3480156105fa57600080fd5b50610603611ff8565b6040518082815260200191505060405180910390f35b34801561062557600080fd5b5061064460048036038101908080359060200190929190505050611ffe565b005b34801561065257600080fd5b5061065b61207e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106a957600080fd5b50610799600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff1690602001909291908035600019169060200190929190803560001916906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506120a4565b604051808215151515815260200191505060405180910390f35b3480156107bf57600080fd5b506107f4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612167565b005b34801561080257600080fd5b5061080b612206565b6040518082815260200191505060405180910390f35b34801561082d57600080fd5b5061084c6004803603810190808035906020019092919050505061220c565b005b34801561085a57600080fd5b5061088f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061228c565b005b34801561089d57600080fd5b506108dc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061232a565b005b3480156108ea57600080fd5b5061092d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080356000191690602001909291905050506126ed565b604051808215151515815260200191505060405180910390f35b34801561095357600080fd5b5061095c61271c565b6040518082815260200191505060405180910390f35b61097a612722565b005b34801561098857600080fd5b506109bd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506128f6565b005b3480156109cb57600080fd5b506109d4612995565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610a2257600080fd5b50610a77600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506129bb565b6040518082815260200191505060405180910390f35b348015610a9957600080fd5b50610aa2612a42565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610af057600080fd5b50610bb6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff16906020019092919080356000191690602001909291908035600019169060200190929190505050612a67565b6040518082815260200191505060405180910390f35b60006002308d8d8d8d8d8d604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506020604051808303816000865af1158015610cde573d6000803e3d6000fd5b5050506040513d6020811015610cf357600080fd5b81019080805190602001909291905050509050600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000826000191660001916815260200190815260200160002060009054906101000a900460ff1680610e6757508573ffffffffffffffffffffffffffffffffffffffff1660018260405180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040518091039020878787604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1158015610e45573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff16145b8015610e735750874311155b8015610ee057508a610edd600860008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084600019166000191681526020019081526020016000205484612e3d565b11155b1515610eeb57600080fd5b610ef98c8c8c8c8a87612e5b565b610f5b600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083600019166000191681526020019081526020016000205483612e3d565b600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008360001916600019168152602001908152602001600020819055507f6effdda786735d5033bfad5f53e5131abcced9e52be6c507b62d639685fbed6d8c838c8e868e02811515610fe857fe5b048a33604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001965050505050505060405180910390a1505050505050505050505050565b6000600230888888888888604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506020604051808303816000865af11580156111f3573d6000803e3d6000fd5b5050506040513d602081101561120857600080fd5b810190808051906020019092919050505090506001600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000836000191660001916815260200190815260200160002060006101000a81548160ff0219169083151502179055507f3f7f2eda73683c21a15f9435af1028c93185b5f1fa38270762dc32be606b3e8587878787878733604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200197505050505050505060405180910390a150505050505050565b6008602052816000526040600020602052806000526040600020600091509150505481565b60006002308b8b8b8b8b8b604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506020604051808303816000865af11580156114b7573d6000803e3d6000fd5b5050506040513d60208110156114cc57600080fd5b81019080805190602001909291905050509050600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000826000191660001916815260200190815260200160002060009054906101000a900460ff168061164057503373ffffffffffffffffffffffffffffffffffffffff1660018260405180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040518091039020868686604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af115801561161e573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff16145b151561164b57600080fd5b88600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008360001916600019168152602001908152602001600020819055507f1e0b760c386003e9cb9bcf4fcf3997886042859d9b6ed6320e804597fcdb28b08a8a8a8a8a8a338b8b8b604051808b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018a81526020018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018881526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018460ff1660ff168152602001836000191660001916815260200182600019166000191681526020019a505050505050505050505060405180910390a150505050505050505050565b80600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561184057600080fd5b6118b0600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826135df565b600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff168160405160006040518083038185875af192505050151561195157600080fd5b7ff341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb56760003383600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a150565b60008273ffffffffffffffffffffffffffffffffffffffff161415611a7057600080fd5b8173ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015611b4757600080fd5b505af1158015611b5b573d6000803e3d6000fd5b505050506040513d6020811015611b7157600080fd5b81019080805190602001909291905050501515611b8d57600080fd5b611c13600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482612e3d565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7823383600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a15050565b6000806002308d8d8d8d8d8d604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506020604051808303816000865af1158015611ecd573d6000803e3d6000fd5b5050506040513d6020811015611ee257600080fd5b81019080805190602001909291905050509050600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008260001916600019168152602001908152602001600020549150509a9950505050505050505050565b6006602052816000526040600020602052806000526040600020600091509150505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611fdf57600080fd5b600354811115611fee57600080fd5b8060038190555050565b60035481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561205957600080fd5b60055481108061206a575060045481115b1561207457600080fd5b8060058190555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600082600660008f73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156121435750826121408e8e8e8e8e8e8e8e8e8e612a67565b10155b15156121525760009050612157565b600190505b9c9b505050505050505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156121c257600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60055481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561226757600080fd5b600454811180612278575060055481105b1561228257600080fd5b8060048190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156122e757600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008273ffffffffffffffffffffffffffffffffffffffff16141561234e57600080fd5b80600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156123d757600080fd5b61245d600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826135df565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561258057600080fd5b505af1158015612594573d6000803e3d6000fd5b505050506040513d60208110156125aa57600080fd5b810190808051906020019092919050505015156125c657600080fd5b7ff341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb567823383600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a15050565b60076020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60045481565b612792600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205434612e3d565b600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d760003334600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a1565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561295157600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000806002308f8f8f8f8f8f604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506020604051808303816000865af1158015612b7d573d6000803e3d6000fd5b5050506040513d6020811015612b9257600080fd5b81019080805190602001909291905050509250600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000846000191660001916815260200190815260200160002060009054906101000a900460ff1680612d0657508773ffffffffffffffffffffffffffffffffffffffff1660018460405180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040518091039020898989604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1158015612ce4573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff16145b8015612d125750894311155b1515612d215760009350612e2c565b612d838d600860008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008660001916600019168152602001908152602001600020546135df565b91508a612e0c600660008f73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548f6135f8565b811515612e1557fe5b04905080821015612e2857819350612e2c565b8093505b5050509a9950505050505050505050565b6000808284019050838110151515612e5157fe5b8091505092915050565b600080600080670de0b6b3a7640000612e76866003546135f8565b811515612e7f57fe5b049350670de0b6b3a7640000612e97866004546135f8565b811515612ea057fe5b049250600091506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561301c57600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631cbd0519876040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015612fa657600080fd5b505af1158015612fba573d6000803e3d6000fd5b505050506040513d6020811015612fd057600080fd5b81019080805190602001909291905050509050600181141561300e57670de0b6b3a7640000613001866005546135f8565b81151561300a57fe5b0491505b600281141561301b578291505b5b6130ab600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546130a68786612e3d565b6135df565b600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131c3600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131be6131b88886612e3d565b876135df565b612e3d565b600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506132fd600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546132f86132f28787612e3d565b856135df565b612e3d565b600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613439600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548a61342a8a896135f8565b81151561343357fe5b046135df565b600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613553600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548a6135448a896135f8565b81151561354d57fe5b04612e3d565b600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050505050505050505050565b60008282111515156135ed57fe5b818303905092915050565b60008082840290506000841480613619575082848281151561361657fe5b04145b151561362157fe5b80915050929150505600a165627a7a72305820998b4b5b3f327b78bdbd9295d90357156733f4380f94800b9722256f4f9781bf0029", + "updated_at": 1525776887229, + "source_map": "196:8564:2:-;;;1660:333;8:9:-1;5:2;;;30:1;27;20:12;5:2;1660:333:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1810:6;1802:5;;:14;;;;;;;;;;;;;;;;;;1839:11;1826:10;;:24;;;;;;;;;;;;;;;;;;1880:18;1860:17;;:38;;;;;;;;;;;;;;;;;;1918:8;1908:7;:18;;;;1946:8;1936:7;:18;;;;1976:10;1964:9;:22;;;;1660:333;;;;;;196:8564;;;;;;", + "source_map_runtime": "196:8564:2:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;196:8564:2;2020:5;;;4729:810;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4729:810:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4380:343;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4380:343:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;935:64;;8:9:-1;5:2;;;30:1;27;20:12;5:2;935:64:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8230:528;;8:9:-1;5:2;;;30:1;27;20:12;5:2;8230:528:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3163:278;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3163:278:2;;;;;;;;;;;;;;;;;;;;;;;;;;3447:443;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3447:443:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7895:329;;8:9:-1;5:2;;;30:1;27;20:12;5:2;7895:329:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;594:60;;8:9:-1;5:2;;;30:1;27;20:12;5:2;594:60:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2448:152;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2448:152:2;;;;;;;;;;;;;;;;;;;;;;;;;;430:19;;8:9:-1;5:2;;;30:1;27;20:12;5:2;430:19:2;;;;;;;;;;;;;;;;;;;;;;;2788:188;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2788:188:2;;;;;;;;;;;;;;;;;;;;;;;;;;280:25;;8:9:-1;5:2;;;30:1;27;20:12;5:2;280:25:2;;;;;;;;;;;;;;;;;;;;;;;;;;;6729:443;;8:9:-1;5:2;;;30:1;27;20:12;5:2;6729:443:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2314:128;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2314:128:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;538:21;;8:9:-1;5:2;;;30:1;27;20:12;5:2;538:21:2;;;;;;;;;;;;;;;;;;;;;;;2606:176;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2606:176:2;;;;;;;;;;;;;;;;;;;;;;;;;;2038:108;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2038:108:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;3896:357;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3896:357:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;742:60;;8:9:-1;5:2;;;30:1;27;20:12;5:2;742:60:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;484:19;;8:9:-1;5:2;;;30:1;27;20:12;5:2;484:19:2;;;;;;;;;;;;;;;;;;;;;;;2982:175;;;;;;2152:156;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2152:156:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;348:32;;8:9:-1;5:2;;;30:1;27;20:12;5:2;348:32:2;;;;;;;;;;;;;;;;;;;;;;;;;;;4259:115;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4259:115:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;234:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;234:20:2;;;;;;;;;;;;;;;;;;;;;;;;;;;7178:711;;8:9:-1;5:2;;;30:1;27;20:12;5:2;7178:711:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4729:810;4947:12;4962:72;4969:4;4975:8;4985:9;4996;5007:10;5019:7;5028:5;4962:72;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;4962:72:2;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;4962:72:2;;;;;;;;;;;;;;;;4947:87;;5064:6;:12;5071:4;5064:12;;;;;;;;;;;;;;;:18;5077:4;5064:18;;;;;;;;;;;;;;;;;;;;;;;;;;;:93;;;;5153:4;5086:71;;:63;5137:4;5096:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5143:1;5145;5147;5086:63;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;5086:63:2;;;;;;;;:71;;;5064:93;5063:134;;;;;5190:7;5174:12;:23;;5063:134;:202;;;;;5256:9;5213:39;5221:10;:16;5232:4;5221:16;;;;;;;;;;;;;;;:22;5238:4;5221:22;;;;;;;;;;;;;;;;;;5245:6;5213:7;:39::i;:::-;:52;;5063:202;5048:227;5044:238;;;5277:5;;;5044:238;5292:71;5306:8;5316:9;5327;5338:10;5350:4;5356:6;5292:13;:71::i;:::-;5398:39;5406:10;:16;5417:4;5406:16;;;;;;;;;;;;;;;:22;5423:4;5406:22;;;;;;;;;;;;;;;;;;5430:6;5398:7;:39::i;:::-;5373:10;:16;5384:4;5373:16;;;;;;;;;;;;;;;:22;5390:4;5373:22;;;;;;;;;;;;;;;;;:64;;;;5447:85;5453:8;5463:6;5471:9;5504;5495:6;5482:10;:19;:31;;;;;;;;5515:4;5521:10;5447:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4729:810;;;;;;;;;;;;:::o;4380:343::-;4501:12;4516:72;4523:4;4529:8;4539:9;4550;4561:10;4573:7;4582:5;4516:72;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;4516:72:2;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;4516:72:2;;;;;;;;;;;;;;;;4501:87;;4625:4;4598:6;:18;4605:10;4598:18;;;;;;;;;;;;;;;:24;4617:4;4598:24;;;;;;;;;;;;;;;;;;:31;;;;;;;;;;;;;;;;;;4639:77;4645:8;4655:9;4666;4677:10;4689:7;4698:5;4705:10;4639:77;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4380:343;;;;;;;:::o;935:64::-;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;8230:528::-;8388:12;8403:72;8410:4;8416:8;8426:9;8437;8448:10;8460:7;8469:5;8403:72;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;8403:72:2;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;8403:72:2;;;;;;;;;;;;;;;;8388:87;;8491:6;:18;8498:10;8491:18;;;;;;;;;;;;;;;:24;8510:4;8491:24;;;;;;;;;;;;;;;;;;;;;;;;;;;:105;;;;8586:10;8519:77;;:63;8570:4;8529:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8576:1;8578;8580;8519:63;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;8519:63:2;;;;;;;;:77;;;8491:105;8489:108;8485:119;;;8599:5;;;8485:119;8645:9;8614:10;:22;8625:10;8614:22;;;;;;;;;;;;;;;:28;8637:4;8614:28;;;;;;;;;;;;;;;;;:40;;;;8664:87;8671:8;8681:9;8692;8703:10;8715:7;8724:5;8731:10;8743:1;8746;8749;8664:87;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8230:528;;;;;;;;;;:::o;3163:278::-;3232:6;3208;:9;3215:1;3208:9;;;;;;;;;;;;;:21;3218:10;3208:21;;;;;;;;;;;;;;;;:30;3204:41;;;3240:5;;;3204:41;3279:38;3287:6;:9;3294:1;3287:9;;;;;;;;;;;;;:21;3297:10;3287:21;;;;;;;;;;;;;;;;3310:6;3279:7;:38::i;:::-;3255:6;:9;3262:1;3255:9;;;;;;;;;;;;;:21;3265:10;3255:21;;;;;;;;;;;;;;;:62;;;;3332:10;:15;;3354:6;3332:31;;;;;;;;;;;;;;;;;3331:32;3327:43;;;3365:5;;;3327:43;3380:54;3389:1;3392:10;3404:6;3412;:9;3419:1;3412:9;;;;;;;;;;;;;:21;3422:10;3412:21;;;;;;;;;;;;;;;;3380:54;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3163:278;:::o;3447:443::-;3651:1;3644:5;:8;;;3640:19;;;3654:5;;;3640:19;3680:5;3674:25;;;3700:10;3712:4;3718:6;3674:51;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3674:51:2;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3674:51:2;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;3674:51:2;;;;;;;;;;;;;;;;3673:52;3669:63;;;3727:5;;;3669:63;3770:42;3778:6;:13;3785:5;3778:13;;;;;;;;;;;;;;;:25;3792:10;3778:25;;;;;;;;;;;;;;;;3805:6;3770:7;:42::i;:::-;3742:6;:13;3749:5;3742:13;;;;;;;;;;;;;;;:25;3756:10;3742:25;;;;;;;;;;;;;;;:70;;;;3822:61;3830:5;3837:10;3849:6;3857;:13;3864:5;3857:13;;;;;;;;;;;;;;;:25;3871:10;3857:25;;;;;;;;;;;;;;;;3822:61;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3447:443;;:::o;7895:329::-;8075:4;8091:12;8106:72;8113:4;8119:8;8129:9;8140;8151:10;8163:7;8172:5;8106:72;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;8106:72:2;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;8106:72:2;;;;;;;;;;;;;;;;8091:87;;8195:10;:16;8206:4;8195:16;;;;;;;;;;;;;;;:22;8212:4;8195:22;;;;;;;;;;;;;;;;;;8188:29;;7895:329;;;;;;;;;;;;;:::o;594:60::-;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;2448:152::-;2514:5;;;;;;;;;;;2500:19;;:10;:19;;;;2496:30;;;2521:5;;;2496:30;2551:7;;2540:8;:18;2536:29;;;2560:5;;;2536:29;2585:8;2575:7;:18;;;;2448:152;:::o;430:19::-;;;;:::o;2788:188::-;2858:5;;;;;;;;;;;2844:19;;:10;:19;;;;2840:30;;;2865:5;;;2840:30;2897:9;;2884:10;:22;:46;;;;2923:7;;2910:10;:20;2884:46;2880:57;;;2932:5;;;2880:57;2959:10;2947:9;:22;;;;2788:188;:::o;280:25::-;;;;;;;;;;;;;:::o;6729:443::-;6935:4;6998:6;6970;:16;6977:8;6970:16;;;;;;;;;;;;;;;:24;6987:6;6970:24;;;;;;;;;;;;;;;;:34;;:150;;;;;7114:6;7020:90;7036:8;7046:9;7057;7068:10;7080:7;7089:5;7096:4;7102:1;7105;7108;7020:15;:90::i;:::-;:100;;6970:150;6955:175;6951:193;;;7139:5;7132:12;;;;6951:193;7161:4;7154:11;;6729:443;;;;;;;;;;;;;;;:::o;2314:128::-;2389:5;;;;;;;;;;;2375:19;;:10;:19;;;;2371:30;;;2396:5;;;2371:30;2424:11;2411:10;;:24;;;;;;;;;;;;;;;;;;2314:128;:::o;538:21::-;;;;:::o;2606:176::-;2672:5;;;;;;;;;;;2658:19;;:10;:19;;;;2654:30;;;2679:5;;;2654:30;2709:7;;2698:8;:18;:42;;;;2731:9;;2720:8;:20;2698:42;2694:53;;;2742:5;;;2694:53;2767:8;2757:7;:18;;;;2606:176;:::o;2038:108::-;2103:5;;;;;;;;;;;2089:19;;:10;:19;;;;2085:30;;;2110:5;;;2085:30;2133:6;2125:5;;:14;;;;;;;;;;;;;;;;;;2038:108;:::o;3896:357::-;3968:1;3961:5;:8;;;3957:19;;;3971:5;;;3957:19;4018:6;3990;:13;3997:5;3990:13;;;;;;;;;;;;;;;:25;4004:10;3990:25;;;;;;;;;;;;;;;;:34;3986:45;;;4026:5;;;3986:45;4069:42;4077:6;:13;4084:5;4077:13;;;;;;;;;;;;;;;:25;4091:10;4077:25;;;;;;;;;;;;;;;;4104:6;4069:7;:42::i;:::-;4041:6;:13;4048:5;4041:13;;;;;;;;;;;;;;;:25;4055:10;4041:25;;;;;;;;;;;;;;;:70;;;;4132:5;4126:21;;;4148:10;4160:6;4126:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4126:41:2;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;4126:41:2;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;4126:41:2;;;;;;;;;;;;;;;;4125:42;4121:53;;;4169:5;;;4121:53;4184:62;4193:5;4200:10;4212:6;4220;:13;4227:5;4220:13;;;;;;;;;;;;;;;:25;4234:10;4220:25;;;;;;;;;;;;;;;;4184:62;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3896:357;;:::o;742:60::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;484:19::-;;;;:::o;2982:175::-;3043:41;3051:6;:9;3058:1;3051:9;;;;;;;;;;;;;:21;3061:10;3051:21;;;;;;;;;;;;;;;;3074:9;3043:7;:41::i;:::-;3019:6;:9;3026:1;3019:9;;;;;;;;;;;;;:21;3029:10;3019:21;;;;;;;;;;;;;;;:65;;;;3094:56;3102:1;3105:10;3117:9;3128:6;:9;3135:1;3128:9;;;;;;;;;;;;;:21;3138:10;3128:21;;;;;;;;;;;;;;;;3094:56;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2982:175::o;2152:156::-;2241:5;;;;;;;;;;;2227:19;;:10;:19;;;;2223:30;;;2248:5;;;2223:30;2283:18;2263:17;;:38;;;;;;;;;;;;;;;;;;2152:156;:::o;348:32::-;;;;;;;;;;;;;:::o;4259:115::-;4325:4;4348:6;:13;4355:5;4348:13;;;;;;;;;;;;;;;:19;4362:4;4348:19;;;;;;;;;;;;;;;;4341:26;;4259:115;;;;:::o;234:20::-;;;;;;;;;;;;;:::o;7178:711::-;7361:4;7377:12;7657:15;7727;7392:72;7399:4;7405:8;7415:9;7426;7437:10;7449:7;7458:5;7392:72;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;7392:72:2;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;7392:72:2;;;;;;;;;;;;;;;;7377:87;;7494:6;:12;7501:4;7494:12;;;;;;;;;;;;;;;:18;7507:4;7494:18;;;;;;;;;;;;;;;;;;;;;;;;;;;:93;;;;7583:4;7516:71;;:63;7567:4;7526:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7573:1;7575;7577;7516:63;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;7516:63:2;;;;;;;;:71;;;7494:93;7493:134;;;;;7620:7;7604:12;:23;;7493:134;7478:159;7474:173;;;7646:1;7639:8;;;;7474:173;7675:42;7683:9;7694:10;:16;7705:4;7694:16;;;;;;;;;;;;;;;:22;7711:4;7694:22;;;;;;;;;;;;;;;;;;7675:7;:42::i;:::-;7657:60;;7791:10;7745:43;7753:6;:17;7760:9;7753:17;;;;;;;;;;;;;;;:23;7771:4;7753:23;;;;;;;;;;;;;;;;7778:9;7745:7;:43::i;:::-;:56;;;;;;;;7727:74;;7826:10;7815;:21;7811:44;;;7845:10;7838:17;;;;7811:44;7872:10;7865:17;;7178:711;;;;;;;;;;;;;;;;:::o;536:166:3:-;616:7;639:6;652:1;648;:5;639:14;;675:1;670;:6;;663:14;;;;;;694:1;687:8;;536:166;;;;;:::o;5545:1178:2:-;5683:16;5748;5813:18;5889:17;5730:7;5702:24;5710:6;5718:7;;5702;:24::i;:::-;:36;;;;;;;;5683:55;;5795:7;5767:24;5775:6;5783:7;;5767;:24::i;:::-;:36;;;;;;;;5748:55;;5834:1;5813:22;;5870:3;5849:17;;;;;;;;;;;:24;;;;5845:277;;;5923:17;;;;;;;;;;;5909:45;;;5955:4;5909:51;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;5909:51:2;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;5909:51:2;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;5909:51:2;;;;;;;;;;;;;;;;5889:71;;5992:1;5978:12;:15;5974:75;;;6041:7;6011:26;6019:6;6027:9;;6011:7;:26::i;:::-;:38;;;;;;;;5995:54;;5974:75;6081:1;6067:12;:15;6063:48;;;6100:11;6084:27;;6063:48;5845:277;6162:67;6170:6;:16;6177:8;6170:16;;;;;;;;;;;;;;;:28;6187:10;6170:28;;;;;;;;;;;;;;;;6200;6208:6;6216:11;6200:7;:28::i;:::-;6162:7;:67::i;:::-;6131:6;:16;6138:8;6131:16;;;;;;;;;;;;;;;:28;6148:10;6131:28;;;;;;;;;;;;;;;:98;;;;6264:85;6272:6;:16;6279:8;6272:16;;;;;;;;;;;;;;;:22;6289:4;6272:22;;;;;;;;;;;;;;;;6296:52;6304:30;6312:6;6320:13;6304:7;:30::i;:::-;6336:11;6296:7;:52::i;:::-;6264:7;:85::i;:::-;6239:6;:16;6246:8;6239:16;;;;;;;;;;;;;;;:22;6256:4;6239:22;;;;;;;;;;;;;;;:110;;;;6390:96;6398:6;:16;6405:8;6398:16;;;;;;;;;;;;;;;:28;6415:10;;;;;;;;;;;6398:28;;;;;;;;;;;;;;;;6428:57;6436:33;6444:11;6457;6436:7;:33::i;:::-;6471:13;6428:7;:57::i;:::-;6390:7;:96::i;:::-;6359:6;:16;6366:8;6359:16;;;;;;;;;;;;;;;:28;6376:10;;;;;;;;;;;6359:28;;;;;;;;;;;;;;;:127;;;;6522:73;6530:6;:17;6537:9;6530:17;;;;;;;;;;;;;;;:23;6548:4;6530:23;;;;;;;;;;;;;;;;6585:9;6555:27;6563:10;6575:6;6555:7;:27::i;:::-;:39;;;;;;;;6522:7;:73::i;:::-;6496:6;:17;6503:9;6496:17;;;;;;;;;;;;;;;:23;6514:4;6496:23;;;;;;;;;;;;;;;:99;;;;6637:79;6645:6;:17;6652:9;6645:17;;;;;;;;;;;;;;;:29;6663:10;6645:29;;;;;;;;;;;;;;;;6706:9;6676:27;6684:10;6696:6;6676:7;:27::i;:::-;:39;;;;;;;;6637:7;:79::i;:::-;6605:6;:17;6612:9;6605:17;;;;;;;;;;;;;;;:29;6623:10;6605:29;;;;;;;;;;;;;;;:111;;;;5545:1178;;;;;;;;;;:::o;384:146:3:-;464:7;499:1;494;:6;;487:14;;;;;;522:1;518;:5;511:12;;384:146;;;;:::o;50:180::-;130:7;153:6;166:1;162;:5;153:14;;189:1;184;:6;:20;;;;203:1;198;194;:5;;;;;;;;:10;184:20;177:28;;;;;;222:1;215:8;;50:180;;;;;:::o", + "sources": [ + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/tokens/Token/Token.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/tutorials/EtherDelta/AccountLevels.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/tutorials/EtherDelta/EtherDelta.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/utils/SafeMath/SafeMath.sol" + ] + } + } +}
\ No newline at end of file diff --git a/packages/contract-wrappers/test/artifacts/Exchange.json b/packages/contract-wrappers/test/artifacts/Exchange.json new file mode 100644 index 000000000..fcdabbb2a --- /dev/null +++ b/packages/contract-wrappers/test/artifacts/Exchange.json @@ -0,0 +1,631 @@ +{ + "contract_name": "Exchange", + "networks": { + "50": { + "solc_version": "0.4.23", + "source_tree_hash": "0xed7525b123061d69ae37377fac4a2f71e09eaa0e91a9bcf12359a60cd61aadac", + "optimizer_enabled": false, + "abi": [ + { + "constant": true, + "inputs": [ + { + "name": "numerator", + "type": "uint256" + }, + { + "name": "denominator", + "type": "uint256" + }, + { + "name": "target", + "type": "uint256" + } + ], + "name": "isRoundingError", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "name": "filled", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "name": "cancelled", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5][]" + }, + { + "name": "orderValues", + "type": "uint256[6][]" + }, + { + "name": "fillTakerTokenAmount", + "type": "uint256" + }, + { + "name": "shouldThrowOnInsufficientBalanceOrAllowance", + "type": "bool" + }, + { + "name": "v", + "type": "uint8[]" + }, + { + "name": "r", + "type": "bytes32[]" + }, + { + "name": "s", + "type": "bytes32[]" + } + ], + "name": "fillOrdersUpTo", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5]" + }, + { + "name": "orderValues", + "type": "uint256[6]" + }, + { + "name": "cancelTakerTokenAmount", + "type": "uint256" + } + ], + "name": "cancelOrder", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "ZRX_TOKEN_CONTRACT", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5][]" + }, + { + "name": "orderValues", + "type": "uint256[6][]" + }, + { + "name": "fillTakerTokenAmounts", + "type": "uint256[]" + }, + { + "name": "v", + "type": "uint8[]" + }, + { + "name": "r", + "type": "bytes32[]" + }, + { + "name": "s", + "type": "bytes32[]" + } + ], + "name": "batchFillOrKillOrders", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5]" + }, + { + "name": "orderValues", + "type": "uint256[6]" + }, + { + "name": "fillTakerTokenAmount", + "type": "uint256" + }, + { + "name": "v", + "type": "uint8" + }, + { + "name": "r", + "type": "bytes32" + }, + { + "name": "s", + "type": "bytes32" + } + ], + "name": "fillOrKillOrder", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "getUnavailableTakerTokenAmount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "signer", + "type": "address" + }, + { + "name": "hash", + "type": "bytes32" + }, + { + "name": "v", + "type": "uint8" + }, + { + "name": "r", + "type": "bytes32" + }, + { + "name": "s", + "type": "bytes32" + } + ], + "name": "isValidSignature", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "numerator", + "type": "uint256" + }, + { + "name": "denominator", + "type": "uint256" + }, + { + "name": "target", + "type": "uint256" + } + ], + "name": "getPartialAmount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "TOKEN_TRANSFER_PROXY_CONTRACT", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5][]" + }, + { + "name": "orderValues", + "type": "uint256[6][]" + }, + { + "name": "fillTakerTokenAmounts", + "type": "uint256[]" + }, + { + "name": "shouldThrowOnInsufficientBalanceOrAllowance", + "type": "bool" + }, + { + "name": "v", + "type": "uint8[]" + }, + { + "name": "r", + "type": "bytes32[]" + }, + { + "name": "s", + "type": "bytes32[]" + } + ], + "name": "batchFillOrders", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5][]" + }, + { + "name": "orderValues", + "type": "uint256[6][]" + }, + { + "name": "cancelTakerTokenAmounts", + "type": "uint256[]" + } + ], + "name": "batchCancelOrders", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5]" + }, + { + "name": "orderValues", + "type": "uint256[6]" + }, + { + "name": "fillTakerTokenAmount", + "type": "uint256" + }, + { + "name": "shouldThrowOnInsufficientBalanceOrAllowance", + "type": "bool" + }, + { + "name": "v", + "type": "uint8" + }, + { + "name": "r", + "type": "bytes32" + }, + { + "name": "s", + "type": "bytes32" + } + ], + "name": "fillOrder", + "outputs": [ + { + "name": "filledTakerTokenAmount", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5]" + }, + { + "name": "orderValues", + "type": "uint256[6]" + } + ], + "name": "getOrderHash", + "outputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "EXTERNAL_QUERY_GAS_LIMIT", + "outputs": [ + { + "name": "", + "type": "uint16" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "VERSION", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "name": "_zrxToken", + "type": "address" + }, + { + "name": "_tokenTransferProxy", + "type": "address" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "maker", + "type": "address" + }, + { + "indexed": false, + "name": "taker", + "type": "address" + }, + { + "indexed": true, + "name": "feeRecipient", + "type": "address" + }, + { + "indexed": false, + "name": "makerToken", + "type": "address" + }, + { + "indexed": false, + "name": "takerToken", + "type": "address" + }, + { + "indexed": false, + "name": "filledMakerTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "name": "filledTakerTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "name": "paidMakerFee", + "type": "uint256" + }, + { + "indexed": false, + "name": "paidTakerFee", + "type": "uint256" + }, + { + "indexed": true, + "name": "tokens", + "type": "bytes32" + }, + { + "indexed": false, + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "LogFill", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "maker", + "type": "address" + }, + { + "indexed": true, + "name": "feeRecipient", + "type": "address" + }, + { + "indexed": false, + "name": "makerToken", + "type": "address" + }, + { + "indexed": false, + "name": "takerToken", + "type": "address" + }, + { + "indexed": false, + "name": "cancelledMakerTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "name": "cancelledTakerTokenAmount", + "type": "uint256" + }, + { + "indexed": true, + "name": "tokens", + "type": "bytes32" + }, + { + "indexed": false, + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "LogCancel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "errorId", + "type": "uint8" + }, + { + "indexed": true, + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "LogError", + "type": "event" + } + ], + "bytecode": "0x608060405234801561001057600080fd5b50604051604080612d998339810180604052810190808051906020019092919080519060200190929190505050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050612cca806100cf6000396000f3006080604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806314df96ee14610101578063288cdc911461015a5780632ac126221461019f578063363349be146101e4578063394c21e7146103f85780633b30ba59146104975780634f150787146104ee578063741bcc931461071b5780637e9abb50146107cf5780638163681e1461081457806398024a8b146108a6578063add1cbc5146108fb578063b7b2c7d614610952578063baa0181d14610b8b578063bc61394a14610cef578063cfc4d0ec14610dc3578063f06bbf7514610e60578063ffa1ad7414610e93575b600080fd5b34801561010d57600080fd5b50610140600480360381019080803590602001909291908035906020019092919080359060200190929190505050610f23565b604051808215151515815260200191505060405180910390f35b34801561016657600080fd5b506101896004803603810190808035600019169060200190929190505050610f7b565b6040518082815260200191505060405180910390f35b3480156101ab57600080fd5b506101ce6004803603810190808035600019169060200190929190505050610f93565b6040518082815260200191505060405180910390f35b3480156101f057600080fd5b506103e260048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561027257848483905060a00201600580602002604051908101604052809291908260056020028082843782019150505050508152602001906001019061022d565b5050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156102f157848483905060c0020160068060200260405190810160405280929190826006602002808284378201915050505050815260200190600101906102ac565b5050505050919291929080359060200190929190803515159060200190929190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050610fab565b6040518082815260200191505060405180910390f35b34801561040457600080fd5b506104816004803603810190808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091929192908060c0019060068060200260405190810160405280929190826006602002808284378201915050505050919291929080359060200190929190505050611110565b6040518082815260200191505060405180910390f35b3480156104a357600080fd5b506104ac6115f8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104fa57600080fd5b5061071960048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561057c57848483905060a002016005806020026040519081016040528092919082600560200280828437820191505050505081526020019060010190610537565b5050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156105fb57848483905060c0020160068060200260405190810160405280929190826006602002808284378201915050505050815260200190600101906105b6565b505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929050505061161d565b005b34801561072757600080fd5b506107cd6004803603810190808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091929192908060c0019060068060200260405190810160405280929190826006602002808284378201915050505050919291929080359060200190929190803560ff169060200190929190803560001916906020019092919080356000191690602001909291905050506116da565b005b3480156107db57600080fd5b506107fe60048036038101908080356000191690602001909291905050506116ff565b6040518082815260200191505060405180910390f35b34801561082057600080fd5b5061088c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035600019169060200190929190803560ff16906020019092919080356000191690602001909291908035600019169060200190929190505050611748565b604051808215151515815260200191505060405180910390f35b3480156108b257600080fd5b506108e5600480360381019080803590602001909291908035906020019092919080359060200190929190505050611849565b6040518082815260200191505060405180910390f35b34801561090757600080fd5b50610910611867565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561095e57600080fd5b50610b8960048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156109e057848483905060a00201600580602002604051908101604052809291908260056020028082843782019150505050508152602001906001019061099b565b5050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610a5f57848483905060c002016006806020026040519081016040528092919082600660200280828437820191505050505081526020019060010190610a1a565b505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080351515906020019092919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929050505061188d565b005b348015610b9757600080fd5b50610ced60048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610c1957848483905060a002016005806020026040519081016040528092919082600560200280828437820191505050505081526020019060010190610bd4565b5050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610c9857848483905060c002016006806020026040519081016040528092919082600660200280828437820191505050505081526020019060010190610c53565b505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929050505061194d565b005b348015610cfb57600080fd5b50610dad6004803603810190808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091929192908060c0019060068060200260405190810160405280929190826006602002808284378201915050505050919291929080359060200190929190803515159060200190929190803560ff169060200190929190803560001916906020019092919080356000191690602001909291905050506119c0565b6040518082815260200191505060405180910390f35b348015610dcf57600080fd5b50610e426004803603810190808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091929192908060c00190600680602002604051908101604052809291908260066020028082843782019150505050509192919290505050612160565b60405180826000191660001916815260200191505060405180910390f35b348015610e6c57600080fd5b50610e7561240b565b604051808261ffff1661ffff16815260200191505060405180910390f35b348015610e9f57600080fd5b50610ea8612411565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610ee8578082015181840152602081019050610ecd565b50505050905090810190601f168015610f155780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b600080600084801515610f3257fe5b86850991506000821415610f495760009250610f72565b610f68610f5983620f424061244a565b610f63888761244a565b61247d565b90506103e8811192505b50509392505050565b60026020528060005260406000206000915090505481565b60036020528060005260406000206000915090505481565b6000806000809150600090505b895181101561110057896000815181101515610fd057fe5b906020019060200201516003600581101515610fe857fe5b602002015173ffffffffffffffffffffffffffffffffffffffff168a8281518110151561101157fe5b90602001906020020151600360058110151561102957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1614151561105057600080fd5b6110e4826110df8c8481518110151561106557fe5b906020019060200201518c8581518110151561107d57fe5b906020019060200201516110918d88612498565b8c8c888151811015156110a057fe5b906020019060200201518c898151811015156110b857fe5b906020019060200201518c8a8151811015156110d057fe5b906020019060200201516119c0565b6124b1565b9150878214156110f357611100565b8080600101915050610fb8565b8192505050979650505050505050565b600061111a612bd2565b6000806101606040519081016040528088600060058110151561113957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200188600160058110151561116857fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200188600260058110151561119757fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018860036005811015156111c657fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018860046005811015156111f557fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200187600060068110151561122457fe5b6020020151815260200187600160068110151561123d57fe5b6020020151815260200187600260068110151561125657fe5b6020020151815260200187600360068110151561126f57fe5b6020020151815260200187600460068110151561128857fe5b6020020151815260200161129c8989612160565b6000191681525092503373ffffffffffffffffffffffffffffffffffffffff16836000015173ffffffffffffffffffffffffffffffffffffffff161415156112e357600080fd5b60008360a001511180156112fb575060008360c00151115b80156113075750600085115b151561131257600080fd5b8261012001514210151561136f57826101400151600019166000600381111561133757fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a3600093506115ee565b61138a8360c001516113858561014001516116ff565b612498565b915061139685836124cf565b905060008114156113f05782610140015160001916600160038111156113b857fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a3600093506115ee565b61141a600360008561014001516000191660001916815260200190815260200160002054826124b1565b60036000856101400151600019166000191681526020019081526020016000208190555082604001518360600151604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140192505050604051809103902060001916836080015173ffffffffffffffffffffffffffffffffffffffff16846000015173ffffffffffffffffffffffffffffffffffffffff167f67d66f160bc93d925d05dae1794c90d2d6d6688b29b84ff069398a9b0458713186604001518760600151611552878a60c001518b60a00151611849565b878a6101400151604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200183815260200182600019166000191681526020019550505050505060405180910390a48093505b5050509392505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008090505b86518110156116d1576116c4878281518110151561163d57fe5b90602001906020020151878381518110151561165557fe5b90602001906020020151878481518110151561166d57fe5b90602001906020020151878581518110151561168557fe5b90602001906020020151878681518110151561169d57fe5b9060200190602002015187878151811015156116b557fe5b906020019060200201516116da565b8080600101915050611623565b50505050505050565b836116eb87878760008888886119c0565b1415156116f757600080fd5b505050505050565b600061174160026000846000191660001916815260200190815260200160002054600360008560001916600019168152602001908152602001600020546124b1565b9050919050565b600060018560405180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040518091039020858585604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1158015611806573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614905095945050505050565b600061185e611858858461244a565b8461247d565b90509392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008090505b87518110156119435761193588828151811015156118ad57fe5b9060200190602002015188838151811015156118c557fe5b9060200190602002015188848151811015156118dd57fe5b906020019060200201518888868151811015156118f657fe5b90602001906020020151888781518110151561190e57fe5b90602001906020020151888881518110151561192657fe5b906020019060200201516119c0565b508080600101915050611893565b5050505050505050565b60008090505b83518110156119ba576119ac848281518110151561196d57fe5b90602001906020020151848381518110151561198557fe5b90602001906020020151848481518110151561199d57fe5b90602001906020020151611110565b508080600101915050611953565b50505050565b60006119ca612bd2565b600080600080610160604051908101604052808e60006005811015156119ec57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e6001600581101515611a1b57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e6002600581101515611a4a57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e6003600581101515611a7957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e6004600581101515611aa857fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018d6000600681101515611ad757fe5b602002015181526020018d6001600681101515611af057fe5b602002015181526020018d6002600681101515611b0957fe5b602002015181526020018d6003600681101515611b2257fe5b602002015181526020018d6004600681101515611b3b57fe5b60200201518152602001611b4f8f8f612160565b600019168152509450600073ffffffffffffffffffffffffffffffffffffffff16856020015173ffffffffffffffffffffffffffffffffffffffff161480611bc657503373ffffffffffffffffffffffffffffffffffffffff16856020015173ffffffffffffffffffffffffffffffffffffffff16145b1515611bd157600080fd5b60008560a00151118015611be9575060008560c00151115b8015611bf5575060008b115b1515611c0057600080fd5b611c1685600001518661014001518b8b8b611748565b1515611c2157600080fd5b84610120015142101515611c7e578461014001516000191660006003811115611c4657fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612150565b611c998560c00151611c948761014001516116ff565b612498565b9350611ca58b856124cf565b95506000861415611cff578461014001516000191660016003811115611cc757fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612150565b611d12868660c001518760a00151610f23565b15611d66578461014001516000191660026003811115611d2e57fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612150565b89158015611d7b5750611d7985876124e8565b155b15611dce5784610140015160001916600380811115611d9657fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612150565b611de1868660c001518760a00151611849565b9250611e0d600260008761014001516000191660001916815260200190815260200160002054876124b1565b600260008761014001516000191660001916815260200190815260200160002081905550611e45856040015186600001513386612838565b1515611e5057600080fd5b611e64856060015133876000015189612838565b1515611e6f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16856080015173ffffffffffffffffffffffffffffffffffffffff16141515611f6e5760008560e001511115611f0c57611ec9868660c001518760e00151611849565b9150611f006000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168660000151876080015185612838565b1515611f0b57600080fd5b5b60008561010001511115611f6d57611f2e868660c00151876101000151611849565b9050611f616000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1633876080015184612838565b1515611f6c57600080fd5b5b5b84604001518560600151604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140192505050604051809103902060001916856080015173ffffffffffffffffffffffffffffffffffffffff16866000015173ffffffffffffffffffffffffffffffffffffffff167f0d0b9391970d9a25552f37d436d2aae2925e2bfe1b2a923754bada030c498cb33389604001518a60600151898d8a8a8f6101400151604051808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200186815260200185815260200184815260200183815260200182600019166000191681526020019850505050505050505060405180910390a48595505b5050505050979650505050505050565b60003083600060058110151561217257fe5b602002015184600160058110151561218657fe5b602002015185600260058110151561219a57fe5b60200201518660036005811015156121ae57fe5b60200201518760046005811015156121c257fe5b60200201518760006006811015156121d657fe5b60200201518860016006811015156121ea57fe5b60200201518960026006811015156121fe57fe5b60200201518a600360068110151561221257fe5b60200201518b600460068110151561222657fe5b60200201518c600560068110151561223a57fe5b6020020151604051808d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018781526020018681526020018581526020018481526020018381526020018281526020019c505050505050505050505050506040518091039020905092915050565b61138781565b6040805190810160405280600581526020017f312e302e3000000000000000000000000000000000000000000000000000000081525081565b6000808284029050600084148061246b575082848281151561246857fe5b04145b151561247357fe5b8091505092915050565b600080828481151561248b57fe5b0490508091505092915050565b60008282111515156124a657fe5b818303905092915050565b60008082840190508381101515156124c557fe5b8091505092915050565b60008183106124de57816124e0565b825b905092915050565b600080600080600080600080600033975061250c8a8c60c001518d60a00151611849565b9650600073ffffffffffffffffffffffffffffffffffffffff168b6080015173ffffffffffffffffffffffffffffffffffffffff161415156127b9576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168b6040015173ffffffffffffffffffffffffffffffffffffffff161495506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168b6060015173ffffffffffffffffffffffffffffffffffffffff161494506126078a8c60c001518d60e00151611849565b935061261d8a8c60c001518d6101000151611849565b92508561262a5783612635565b61263487856124b1565b5b915084612642578261264d565b61264c8a846124b1565b5b90508161267f6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168d600001516129ac565b10806126b85750816126b66000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168d60000151612a94565b105b806126ec5750806126ea6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168a6129ac565b105b8061272057508061271e6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168a612a94565b105b1561272e576000985061282a565b8515801561276757508661274a8c604001518d600001516129ac565b10806127665750866127648c604001518d60000151612a94565b105b5b15612775576000985061282a565b841580156127a657508961278d8c606001518a6129ac565b10806127a55750896127a38c606001518a612a94565b105b5b156127b4576000985061282a565b612825565b866127cc8c604001518d600001516129ac565b10806127e85750866127e68c604001518d60000151612a94565b105b806127ff5750896127fd8c606001518a6129ac565b105b806128165750896128148c606001518a612a94565b105b15612824576000985061282a565b5b600198505b505050505050505092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166315dacbea868686866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001945050505050602060405180830381600087803b15801561296757600080fd5b505af115801561297b573d6000803e3d6000fd5b505050506040513d602081101561299157600080fd5b81019080805190602001909291905050509050949350505050565b60008273ffffffffffffffffffffffffffffffffffffffff166370a0823161138761ffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600088803b158015612a5057600080fd5b5087f1158015612a64573d6000803e3d6000fd5b50505050506040513d6020811015612a7b57600080fd5b8101908080519060200190929190505050905092915050565b60008273ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e61138761ffff1684600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600088803b158015612b8e57600080fd5b5087f1158015612ba2573d6000803e3d6000fd5b50505050506040513d6020811015612bb957600080fd5b8101908080519060200190929190505050905092915050565b61016060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160008152602001600081526020016000801916815250905600a165627a7a723058206db1dd4ff1c5f2173efa193203148df8afcdded6484e455bda1f40b9c72622070029", + "runtime_bytecode": "0x6080604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806314df96ee14610101578063288cdc911461015a5780632ac126221461019f578063363349be146101e4578063394c21e7146103f85780633b30ba59146104975780634f150787146104ee578063741bcc931461071b5780637e9abb50146107cf5780638163681e1461081457806398024a8b146108a6578063add1cbc5146108fb578063b7b2c7d614610952578063baa0181d14610b8b578063bc61394a14610cef578063cfc4d0ec14610dc3578063f06bbf7514610e60578063ffa1ad7414610e93575b600080fd5b34801561010d57600080fd5b50610140600480360381019080803590602001909291908035906020019092919080359060200190929190505050610f23565b604051808215151515815260200191505060405180910390f35b34801561016657600080fd5b506101896004803603810190808035600019169060200190929190505050610f7b565b6040518082815260200191505060405180910390f35b3480156101ab57600080fd5b506101ce6004803603810190808035600019169060200190929190505050610f93565b6040518082815260200191505060405180910390f35b3480156101f057600080fd5b506103e260048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561027257848483905060a00201600580602002604051908101604052809291908260056020028082843782019150505050508152602001906001019061022d565b5050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156102f157848483905060c0020160068060200260405190810160405280929190826006602002808284378201915050505050815260200190600101906102ac565b5050505050919291929080359060200190929190803515159060200190929190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050610fab565b6040518082815260200191505060405180910390f35b34801561040457600080fd5b506104816004803603810190808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091929192908060c0019060068060200260405190810160405280929190826006602002808284378201915050505050919291929080359060200190929190505050611110565b6040518082815260200191505060405180910390f35b3480156104a357600080fd5b506104ac6115f8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104fa57600080fd5b5061071960048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561057c57848483905060a002016005806020026040519081016040528092919082600560200280828437820191505050505081526020019060010190610537565b5050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156105fb57848483905060c0020160068060200260405190810160405280929190826006602002808284378201915050505050815260200190600101906105b6565b505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929050505061161d565b005b34801561072757600080fd5b506107cd6004803603810190808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091929192908060c0019060068060200260405190810160405280929190826006602002808284378201915050505050919291929080359060200190929190803560ff169060200190929190803560001916906020019092919080356000191690602001909291905050506116da565b005b3480156107db57600080fd5b506107fe60048036038101908080356000191690602001909291905050506116ff565b6040518082815260200191505060405180910390f35b34801561082057600080fd5b5061088c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035600019169060200190929190803560ff16906020019092919080356000191690602001909291908035600019169060200190929190505050611748565b604051808215151515815260200191505060405180910390f35b3480156108b257600080fd5b506108e5600480360381019080803590602001909291908035906020019092919080359060200190929190505050611849565b6040518082815260200191505060405180910390f35b34801561090757600080fd5b50610910611867565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561095e57600080fd5b50610b8960048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156109e057848483905060a00201600580602002604051908101604052809291908260056020028082843782019150505050508152602001906001019061099b565b5050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610a5f57848483905060c002016006806020026040519081016040528092919082600660200280828437820191505050505081526020019060010190610a1a565b505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080351515906020019092919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929050505061188d565b005b348015610b9757600080fd5b50610ced60048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610c1957848483905060a002016005806020026040519081016040528092919082600560200280828437820191505050505081526020019060010190610bd4565b5050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610c9857848483905060c002016006806020026040519081016040528092919082600660200280828437820191505050505081526020019060010190610c53565b505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929050505061194d565b005b348015610cfb57600080fd5b50610dad6004803603810190808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091929192908060c0019060068060200260405190810160405280929190826006602002808284378201915050505050919291929080359060200190929190803515159060200190929190803560ff169060200190929190803560001916906020019092919080356000191690602001909291905050506119c0565b6040518082815260200191505060405180910390f35b348015610dcf57600080fd5b50610e426004803603810190808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091929192908060c00190600680602002604051908101604052809291908260066020028082843782019150505050509192919290505050612160565b60405180826000191660001916815260200191505060405180910390f35b348015610e6c57600080fd5b50610e7561240b565b604051808261ffff1661ffff16815260200191505060405180910390f35b348015610e9f57600080fd5b50610ea8612411565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610ee8578082015181840152602081019050610ecd565b50505050905090810190601f168015610f155780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b600080600084801515610f3257fe5b86850991506000821415610f495760009250610f72565b610f68610f5983620f424061244a565b610f63888761244a565b61247d565b90506103e8811192505b50509392505050565b60026020528060005260406000206000915090505481565b60036020528060005260406000206000915090505481565b6000806000809150600090505b895181101561110057896000815181101515610fd057fe5b906020019060200201516003600581101515610fe857fe5b602002015173ffffffffffffffffffffffffffffffffffffffff168a8281518110151561101157fe5b90602001906020020151600360058110151561102957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1614151561105057600080fd5b6110e4826110df8c8481518110151561106557fe5b906020019060200201518c8581518110151561107d57fe5b906020019060200201516110918d88612498565b8c8c888151811015156110a057fe5b906020019060200201518c898151811015156110b857fe5b906020019060200201518c8a8151811015156110d057fe5b906020019060200201516119c0565b6124b1565b9150878214156110f357611100565b8080600101915050610fb8565b8192505050979650505050505050565b600061111a612bd2565b6000806101606040519081016040528088600060058110151561113957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200188600160058110151561116857fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200188600260058110151561119757fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018860036005811015156111c657fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018860046005811015156111f557fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200187600060068110151561122457fe5b6020020151815260200187600160068110151561123d57fe5b6020020151815260200187600260068110151561125657fe5b6020020151815260200187600360068110151561126f57fe5b6020020151815260200187600460068110151561128857fe5b6020020151815260200161129c8989612160565b6000191681525092503373ffffffffffffffffffffffffffffffffffffffff16836000015173ffffffffffffffffffffffffffffffffffffffff161415156112e357600080fd5b60008360a001511180156112fb575060008360c00151115b80156113075750600085115b151561131257600080fd5b8261012001514210151561136f57826101400151600019166000600381111561133757fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a3600093506115ee565b61138a8360c001516113858561014001516116ff565b612498565b915061139685836124cf565b905060008114156113f05782610140015160001916600160038111156113b857fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a3600093506115ee565b61141a600360008561014001516000191660001916815260200190815260200160002054826124b1565b60036000856101400151600019166000191681526020019081526020016000208190555082604001518360600151604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140192505050604051809103902060001916836080015173ffffffffffffffffffffffffffffffffffffffff16846000015173ffffffffffffffffffffffffffffffffffffffff167f67d66f160bc93d925d05dae1794c90d2d6d6688b29b84ff069398a9b0458713186604001518760600151611552878a60c001518b60a00151611849565b878a6101400151604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200183815260200182600019166000191681526020019550505050505060405180910390a48093505b5050509392505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008090505b86518110156116d1576116c4878281518110151561163d57fe5b90602001906020020151878381518110151561165557fe5b90602001906020020151878481518110151561166d57fe5b90602001906020020151878581518110151561168557fe5b90602001906020020151878681518110151561169d57fe5b9060200190602002015187878151811015156116b557fe5b906020019060200201516116da565b8080600101915050611623565b50505050505050565b836116eb87878760008888886119c0565b1415156116f757600080fd5b505050505050565b600061174160026000846000191660001916815260200190815260200160002054600360008560001916600019168152602001908152602001600020546124b1565b9050919050565b600060018560405180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040518091039020858585604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1158015611806573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614905095945050505050565b600061185e611858858461244a565b8461247d565b90509392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008090505b87518110156119435761193588828151811015156118ad57fe5b9060200190602002015188838151811015156118c557fe5b9060200190602002015188848151811015156118dd57fe5b906020019060200201518888868151811015156118f657fe5b90602001906020020151888781518110151561190e57fe5b90602001906020020151888881518110151561192657fe5b906020019060200201516119c0565b508080600101915050611893565b5050505050505050565b60008090505b83518110156119ba576119ac848281518110151561196d57fe5b90602001906020020151848381518110151561198557fe5b90602001906020020151848481518110151561199d57fe5b90602001906020020151611110565b508080600101915050611953565b50505050565b60006119ca612bd2565b600080600080610160604051908101604052808e60006005811015156119ec57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e6001600581101515611a1b57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e6002600581101515611a4a57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e6003600581101515611a7957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e6004600581101515611aa857fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018d6000600681101515611ad757fe5b602002015181526020018d6001600681101515611af057fe5b602002015181526020018d6002600681101515611b0957fe5b602002015181526020018d6003600681101515611b2257fe5b602002015181526020018d6004600681101515611b3b57fe5b60200201518152602001611b4f8f8f612160565b600019168152509450600073ffffffffffffffffffffffffffffffffffffffff16856020015173ffffffffffffffffffffffffffffffffffffffff161480611bc657503373ffffffffffffffffffffffffffffffffffffffff16856020015173ffffffffffffffffffffffffffffffffffffffff16145b1515611bd157600080fd5b60008560a00151118015611be9575060008560c00151115b8015611bf5575060008b115b1515611c0057600080fd5b611c1685600001518661014001518b8b8b611748565b1515611c2157600080fd5b84610120015142101515611c7e578461014001516000191660006003811115611c4657fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612150565b611c998560c00151611c948761014001516116ff565b612498565b9350611ca58b856124cf565b95506000861415611cff578461014001516000191660016003811115611cc757fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612150565b611d12868660c001518760a00151610f23565b15611d66578461014001516000191660026003811115611d2e57fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612150565b89158015611d7b5750611d7985876124e8565b155b15611dce5784610140015160001916600380811115611d9657fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612150565b611de1868660c001518760a00151611849565b9250611e0d600260008761014001516000191660001916815260200190815260200160002054876124b1565b600260008761014001516000191660001916815260200190815260200160002081905550611e45856040015186600001513386612838565b1515611e5057600080fd5b611e64856060015133876000015189612838565b1515611e6f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16856080015173ffffffffffffffffffffffffffffffffffffffff16141515611f6e5760008560e001511115611f0c57611ec9868660c001518760e00151611849565b9150611f006000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168660000151876080015185612838565b1515611f0b57600080fd5b5b60008561010001511115611f6d57611f2e868660c00151876101000151611849565b9050611f616000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1633876080015184612838565b1515611f6c57600080fd5b5b5b84604001518560600151604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140192505050604051809103902060001916856080015173ffffffffffffffffffffffffffffffffffffffff16866000015173ffffffffffffffffffffffffffffffffffffffff167f0d0b9391970d9a25552f37d436d2aae2925e2bfe1b2a923754bada030c498cb33389604001518a60600151898d8a8a8f6101400151604051808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200186815260200185815260200184815260200183815260200182600019166000191681526020019850505050505050505060405180910390a48595505b5050505050979650505050505050565b60003083600060058110151561217257fe5b602002015184600160058110151561218657fe5b602002015185600260058110151561219a57fe5b60200201518660036005811015156121ae57fe5b60200201518760046005811015156121c257fe5b60200201518760006006811015156121d657fe5b60200201518860016006811015156121ea57fe5b60200201518960026006811015156121fe57fe5b60200201518a600360068110151561221257fe5b60200201518b600460068110151561222657fe5b60200201518c600560068110151561223a57fe5b6020020151604051808d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018781526020018681526020018581526020018481526020018381526020018281526020019c505050505050505050505050506040518091039020905092915050565b61138781565b6040805190810160405280600581526020017f312e302e3000000000000000000000000000000000000000000000000000000081525081565b6000808284029050600084148061246b575082848281151561246857fe5b04145b151561247357fe5b8091505092915050565b600080828481151561248b57fe5b0490508091505092915050565b60008282111515156124a657fe5b818303905092915050565b60008082840190508381101515156124c557fe5b8091505092915050565b60008183106124de57816124e0565b825b905092915050565b600080600080600080600080600033975061250c8a8c60c001518d60a00151611849565b9650600073ffffffffffffffffffffffffffffffffffffffff168b6080015173ffffffffffffffffffffffffffffffffffffffff161415156127b9576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168b6040015173ffffffffffffffffffffffffffffffffffffffff161495506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168b6060015173ffffffffffffffffffffffffffffffffffffffff161494506126078a8c60c001518d60e00151611849565b935061261d8a8c60c001518d6101000151611849565b92508561262a5783612635565b61263487856124b1565b5b915084612642578261264d565b61264c8a846124b1565b5b90508161267f6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168d600001516129ac565b10806126b85750816126b66000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168d60000151612a94565b105b806126ec5750806126ea6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168a6129ac565b105b8061272057508061271e6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168a612a94565b105b1561272e576000985061282a565b8515801561276757508661274a8c604001518d600001516129ac565b10806127665750866127648c604001518d60000151612a94565b105b5b15612775576000985061282a565b841580156127a657508961278d8c606001518a6129ac565b10806127a55750896127a38c606001518a612a94565b105b5b156127b4576000985061282a565b612825565b866127cc8c604001518d600001516129ac565b10806127e85750866127e68c604001518d60000151612a94565b105b806127ff5750896127fd8c606001518a6129ac565b105b806128165750896128148c606001518a612a94565b105b15612824576000985061282a565b5b600198505b505050505050505092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166315dacbea868686866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001945050505050602060405180830381600087803b15801561296757600080fd5b505af115801561297b573d6000803e3d6000fd5b505050506040513d602081101561299157600080fd5b81019080805190602001909291905050509050949350505050565b60008273ffffffffffffffffffffffffffffffffffffffff166370a0823161138761ffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600088803b158015612a5057600080fd5b5087f1158015612a64573d6000803e3d6000fd5b50505050506040513d6020811015612a7b57600080fd5b8101908080519060200190929190505050905092915050565b60008273ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e61138761ffff1684600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600088803b158015612b8e57600080fd5b5087f1158015612ba2573d6000803e3d6000fd5b50505050506040513d6020811015612bb957600080fd5b8101908080519060200190929190505050905092915050565b61016060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160008152602001600081526020016000801916815250905600a165627a7a723058206db1dd4ff1c5f2173efa193203148df8afcdded6484e455bda1f40b9c72622070029", + "updated_at": 1525776872378, + "source_map": "995:22775:0:-;;;2959:174;8:9:-1;5:2;;;30:1;27;20:12;5:2;2959:174:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3056:9;3035:18;;:30;;;;;;;;;;;;;;;;;;3107:19;3075:29;;:51;;;;;;;;;;;;;;;;;;2959:174;;995:22775;;;;;;", + "source_map_runtime": "995:22775:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18076:458;;8:9:-1;5:2;;;30:1;27;20:12;5:2;18076:458:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1736:39;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1736:39:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1781:42;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1781:42:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;14311:989;;8:9:-1;5:2;;;30:1;27;20:12;5:2;14311:989:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8299:1942;;8:9:-1;5:2;;;30:1;27;20:12;5:2;8299:1942:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1565:33;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1565:33:0;;;;;;;;;;;;;;;;;;;;;;;;;;;13062:512;;8:9:-1;5:2;;;30:1;27;20:12;5:2;13062:512:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10862:419;;8:9:-1;5:2;;;30:1;27;20:12;5:2;10862:419:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;19208:190;;8:9:-1;5:2;;;30:1;27;20:12;5:2;19208:190:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;17487:350;;8:9:-1;5:2;;;30:1;27;20:12;5:2;17487:350:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18783:204;;8:9:-1;5:2;;;30:1;27;20:12;5:2;18783:204:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1604:44;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1604:44:0;;;;;;;;;;;;;;;;;;;;;;;;;;;11912:619;;8:9:-1;5:2;;;30:1;27;20:12;5:2;11912:619:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;15658:381;;8:9:-1;5:2;;;30:1;27;20:12;5:2;15658:381:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3838:4043;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3838:4043:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;16449:706;;8:9:-1;5:2;;;30:1;27;20:12;5:2;16449:706:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1455:54;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1455:54:0;;;;;;;;;;;;;;;;;;;;;;;;;;;1409:40;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1409:40:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;1409:40:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18076:458;18197:4;18217:14;18347:30;18260:11;18234:38;;;;;;;18249:9;18241:6;18234:38;18217:55;;18299:1;18286:9;:14;18282:32;;;18309:5;18302:12;;;;18282:32;18380:98;18401:27;18409:9;18420:7;18401;:27::i;:::-;18442:26;18450:9;18461:6;18442:7;:26::i;:::-;18380:7;:98::i;:::-;18347:131;;18523:4;18495:25;:32;18488:39;;18076:458;;;;;;;;:::o;1736:39::-;;;;;;;;;;;;;;;;;:::o;1781:42::-;;;;;;;;;;;;;;;;;:::o;14311:989::-;14590:4;14610:27;14656:6;14640:1;14610:31;;14665:1;14656:10;;14651:604;14672:14;:21;14668:1;:25;14651:604;;;14746:14;14761:1;14746:17;;;;;;;;;;;;;;;;;;14764:1;14746:20;;;;;;;;;;;;;14722:44;;:14;14737:1;14722:17;;;;;;;;;;;;;;;;;;14740:1;14722:20;;;;;;;;;;;;;:44;;;14714:53;;;;;;;;14852:321;14860:22;14884:288;14911:14;14926:1;14911:17;;;;;;;;;;;;;;;;;;14946:11;14958:1;14946:14;;;;;;;;;;;;;;;;;;14978:53;14986:20;15008:22;14978:7;:53::i;:::-;15049:43;15110:1;15112;15110:4;;;;;;;;;;;;;;;;;;15132:1;15134;15132:4;;;;;;;;;;;;;;;;;;15154:1;15156;15154:4;;;;;;;;;;;;;;;;;;14884:9;:288::i;:::-;14852:7;:321::i;:::-;14827:346;;15217:20;15191:22;:46;15187:57;;;15239:5;;15187:57;14695:3;;;;;;;14651:604;;;15271:22;15264:29;;14311:989;;;;;;;;;;;:::o;8299:1942::-;8454:4;8474:18;;:::i;:::-;9334:30;9457;8495:512;;;;;;;;;8522:14;8537:1;8522:17;;;;;;;;;;;;;8495:512;;;;;;8560:14;8575:1;8560:17;;;;;;;;;;;;;8495:512;;;;;;8603:14;8618:1;8603:17;;;;;;;;;;;;;8495:512;;;;;;8646:14;8661:1;8646:17;;;;;;;;;;;;;8495:512;;;;;;8691:14;8706:1;8691:17;;;;;;;;;;;;;8495:512;;;;;;8740:11;8752:1;8740:14;;;;;;;;;;;;;8495:512;;;;8786:11;8798:1;8786:14;;;;;;;;;;;;;8495:512;;;;8824:11;8836:1;8824:14;;;;;;;;;;;;;8495:512;;;;8862:11;8874:1;8862:14;;;;;;;;;;;;;8495:512;;;;8916:11;8928:1;8916:14;;;;;;;;;;;;;8495:512;;;;8955:41;8968:14;8984:11;8955:12;:41::i;:::-;8495:512;;;;;;8474:533;;9041:10;9026:25;;:5;:11;;;:25;;;9018:34;;;;;;;;9095:1;9070:5;:22;;;:26;:56;;;;;9125:1;9100:5;:22;;;:26;9070:56;:86;;;;;9155:1;9130:22;:26;9070:86;9062:95;;;;;;;;9191:5;:30;;;9172:15;:49;;9168:156;;;9275:5;:15;;;9237:54;;;9252:20;9246:27;;;;;;;;9237:54;;;;;;;;;;;;9312:1;9305:8;;;;9168:156;9367:80;9375:5;:22;;;9399:47;9430:5;:15;;;9399:30;:47::i;:::-;9367:7;:80::i;:::-;9334:113;;9490:57;9497:22;9521:25;9490:6;:57::i;:::-;9457:90;;9590:1;9561:25;:30;9557:155;;;9663:5;:15;;;9607:72;;;9622:38;9616:45;;;;;;;;9607:72;;;;;;;;;;;;9700:1;9693:8;;;;9557:155;9751:62;9759:9;:26;9769:5;:15;;;9759:26;;;;;;;;;;;;;;;;;;9787:25;9751:7;:62::i;:::-;9722:9;:26;9732:5;:15;;;9722:26;;;;;;;;;;;;;;;;;:91;;;;10118:5;:16;;;10136:5;:16;;;10108:45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9824:368;;;9872:5;:18;;;9824:368;;9847:5;:11;;;9824:368;;;9904:5;:16;;;9934:5;:16;;;9964:91;9981:25;10008:5;:22;;;10032:5;:22;;;9964:16;:91::i;:::-;10069:25;10167:5;:15;;;9824:368;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10209:25;10202:32;;8299:1942;;;;;;;;;:::o;1565:33::-;;;;;;;;;;;;;:::o;13062:512::-;13295:6;13304:1;13295:10;;13290:278;13311:14;:21;13307:1;:25;13290:278;;;13353:204;13386:14;13401:1;13386:17;;;;;;;;;;;;;;;;;;13421:11;13433:1;13421:14;;;;;;;;;;;;;;;;;;13453:21;13475:1;13453:24;;;;;;;;;;;;;;;;;;13495:1;13497;13495:4;;;;;;;;;;;;;;;;;;13517:1;13519;13517:4;;;;;;;;;;;;;;;;;;13539:1;13541;13539:4;;;;;;;;;;;;;;;;;;13353:15;:204::i;:::-;13334:3;;;;;;;13290:278;;;13062:512;;;;;;;:::o;10862:419::-;11253:20;11079:170;11102:14;11130:11;11155:20;11189:5;11208:1;11223;11238;11079:9;:170::i;:::-;:194;11071:203;;;;;;;;10862:419;;;;;;:::o;19208:190::-;19316:4;19343:48;19351:6;:17;19358:9;19351:17;;;;;;;;;;;;;;;;;;19370:9;:20;19380:9;19370:20;;;;;;;;;;;;;;;;;;19343:7;:48::i;:::-;19336:55;;19208:190;;;:::o;17487:350::-;17664:4;17701:129;17770:4;17724:51;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;17789:1;17804;17819;17701:129;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;17701:129:0;;;;;;;;17691:139;;:6;:139;;;17684:146;;17487:350;;;;;;;:::o;18783:204::-;18905:4;18932:48;18940:26;18948:9;18959:6;18940:7;:26::i;:::-;18968:11;18932:7;:48::i;:::-;18925:55;;18783:204;;;;;:::o;1604:44::-;;;;;;;;;;;;;:::o;11912:619::-;12197:6;12206:1;12197:10;;12192:333;12213:14;:21;12209:1;:25;12192:333;;;12255:259;12282:14;12297:1;12282:17;;;;;;;;;;;;;;;;;;12317:11;12329:1;12317:14;;;;;;;;;;;;;;;;;;12349:21;12371:1;12349:24;;;;;;;;;;;;;;;;;;12391:43;12452:1;12454;12452:4;;;;;;;;;;;;;;;;;;12474:1;12476;12474:4;;;;;;;;;;;;;;;;;;12496:1;12498;12496:4;;;;;;;;;;;;;;;;;;12255:9;:259::i;:::-;;12236:3;;;;;;;12192:333;;;11912:619;;;;;;;;:::o;15658:381::-;15828:6;15837:1;15828:10;;15823:210;15844:14;:21;15840:1;:25;15823:210;;;15886:136;15915:14;15930:1;15915:17;;;;;;;;;;;;;;;;;;15950:11;15962:1;15950:14;;;;;;;;;;;;;;;;;;15982:23;16006:1;15982:26;;;;;;;;;;;;;;;;;;15886:11;:136::i;:::-;;15867:3;;;;;;;15823:210;;;15658:381;;;;:::o;3838:4043::-;4120:27;4163:18;;:::i;:::-;5194:30;6015:27;6143:17;6170;4184:512;;;;;;;;;4211:14;4226:1;4211:17;;;;;;;;;;;;;4184:512;;;;;;4249:14;4264:1;4249:17;;;;;;;;;;;;;4184:512;;;;;;4292:14;4307:1;4292:17;;;;;;;;;;;;;4184:512;;;;;;4335:14;4350:1;4335:17;;;;;;;;;;;;;4184:512;;;;;;4380:14;4395:1;4380:17;;;;;;;;;;;;;4184:512;;;;;;4429:11;4441:1;4429:14;;;;;;;;;;;;;4184:512;;;;4475:11;4487:1;4475:14;;;;;;;;;;;;;4184:512;;;;4513:11;4525:1;4513:14;;;;;;;;;;;;;4184:512;;;;4551:11;4563:1;4551:14;;;;;;;;;;;;;4184:512;;;;4605:11;4617:1;4605:14;;;;;;;;;;;;;4184:512;;;;4644:41;4657:14;4673:11;4644:12;:41::i;:::-;4184:512;;;;;;4163:533;;4738:1;4715:25;;:5;:11;;;:25;;;:54;;;;4759:10;4744:25;;:5;:11;;;:25;;;4715:54;4707:63;;;;;;;;4813:1;4788:5;:22;;;:26;:56;;;;;4843:1;4818:5;:22;;;:26;4788:56;:84;;;;;4871:1;4848:20;:24;4788:84;4780:93;;;;;;;;4891:125;4921:5;:11;;;4946:5;:15;;;4975:1;4990;5005;4891:16;:125::i;:::-;4883:134;;;;;;;;5051:5;:30;;;5032:15;:49;;5028:156;;;5135:5;:15;;;5097:54;;;5112:20;5106:27;;;;;;;;5097:54;;;;;;;;;;;;5172:1;5165:8;;;;5028:156;5227:80;5235:5;:22;;;5259:47;5290:5;:15;;;5259:30;:47::i;:::-;5227:7;:80::i;:::-;5194:113;;5342:55;5349:20;5371:25;5342:6;:55::i;:::-;5317:80;;5437:1;5411:22;:27;5407:152;;;5510:5;:15;;;5454:72;;;5469:38;5463:45;;;;;;;;5454:72;;;;;;;;;;;;5547:1;5540:8;;;;5407:152;5573:87;5589:22;5613:5;:22;;;5637:5;:22;;;5573:15;:87::i;:::-;5569:205;;;5725:5;:15;;;5676:65;;;5691:31;5685:38;;;;;;;;5676:65;;;;;;;;;;;;5762:1;5755:8;;;;5569:205;5789:43;5788:44;:94;;;;;5837:45;5852:5;5859:22;5837:14;:45::i;:::-;5836:46;5788:94;5784:221;;;5956:5;:15;;;5898:74;;;5913:40;5907:47;;;;;;;;5898:74;;;;;;;;;;;;5993:1;5986:8;;;;5784:221;6045:88;6062:22;6086:5;:22;;;6110:5;:22;;;6045:16;:88::i;:::-;6015:118;;6223:56;6231:6;:23;6238:5;:15;;;6231:23;;;;;;;;;;;;;;;;;;6256:22;6223:7;:56::i;:::-;6197:6;:23;6204:5;:15;;;6197:23;;;;;;;;;;;;;;;;;:82;;;;6297:154;6340:5;:16;;;6370:5;:11;;;6395:10;6419:22;6297:29;:154::i;:::-;6289:163;;;;;;;;6470:154;6513:5;:16;;;6543:10;6567:5;:11;;;6592:22;6470:29;:154::i;:::-;6462:163;;;;;;;;6669:1;6639:32;;:5;:18;;;:32;;;;6635:820;;;6708:1;6691:5;:14;;;:18;6687:373;;;6744:80;6761:22;6785:5;:22;;;6809:5;:14;;;6744:16;:80::i;:::-;6729:95;;6850:194;6901:18;;;;;;;;;;;6941:5;:11;;;6974:5;:18;;;7014:12;6850:29;:194::i;:::-;6842:203;;;;;;;;6687:373;7094:1;7077:5;:14;;;:18;7073:372;;;7130:80;7147:22;7171:5;:22;;;7195:5;:14;;;7130:16;:80::i;:::-;7115:95;;7236:193;7287:18;;;;;;;;;;;7327:10;7359:5;:18;;;7399:12;7236:29;:193::i;:::-;7228:202;;;;;;;;7073:372;6635:820;7761:5;:16;;;7779:5;:16;;;7751:45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7465:370;;;7535:5;:18;;;7465:370;;7486:5;:11;;;7465:370;;;7511:10;7567:5;:16;;;7597:5;:16;;;7627:22;7663;7699:12;7725;7810:5;:15;;;7465:370;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7852:22;7845:29;;3838:4043;;;;;;;;;;;;;;;:::o;16449:706::-;16568:7;16629:4;16648:14;16663:1;16648:17;;;;;;;;;;;;;16688:14;16703:1;16688:17;;;;;;;;;;;;;16728:14;16743:1;16728:17;;;;;;;;;;;;;16773:14;16788:1;16773:17;;;;;;;;;;;;;16818:14;16833:1;16818:17;;;;;;;;;;;;;16865:11;16877:1;16865:14;;;;;;;;;;;;;16916:11;16928:1;16916:14;;;;;;;;;;;;;16967:11;16979:1;16967:14;;;;;;;;;;;;;17010:11;17022:1;17010:14;;;;;;;;;;;;;17053:11;17065:1;17053:14;;;;;;;;;;;;;17112:11;17124:1;17112:14;;;;;;;;;;;;;16598:550;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;16591:557;;16449:706;;;;:::o;1455:54::-;1505:4;1455:54;:::o;1409:40::-;;;;;;;;;;;;;;;;;;;;:::o;53:184:3:-;137:7;160:6;173:1;169;:5;160:14;;196:1;191;:6;:20;;;;210:1;205;201;:5;;;;;;;;:10;191:20;184:28;;;;;;229:1;222:8;;53:184;;;;;:::o;243:146::-;327:7;350:6;363:1;359;:5;;;;;;;;350:14;;381:1;374:8;;243:146;;;;;:::o;395:150::-;479:7;514:1;509;:6;;502:14;;;;;;537:1;533;:5;526:12;;395:150;;;;:::o;551:170::-;635:7;658:6;671:1;667;:5;658:14;;694:1;689;:6;;682:14;;;;;;713:1;706:8;;551:170;;;;;:::o;1156:139::-;1245:7;1279:1;1275;:5;:13;;1287:1;1275:13;;;1283:1;1275:13;1268:20;;1156:139;;;;:::o;20288:2363:0:-;20537:4;20557:13;20593:25;20770:20;20845;20920:17;21032;21144:21;21258;20573:10;20557:26;;20621:86;20638:20;20660:5;:22;;;20684:5;:22;;;20621:16;:86::i;:::-;20593:114;;20752:1;20722:32;;:5;:18;;;:32;;;;20718:1904;;;20813:18;;;;;;;;;;;20793:38;;:5;:16;;;:38;;;20770:61;;20888:18;;;;;;;;;;;20868:38;;:5;:16;;;:38;;;20845:61;;20940:78;20957:20;20979:5;:22;;;21003:5;:14;;;20940:16;:78::i;:::-;20920:98;;21052:78;21069:20;21091:5;:22;;;21115:5;:14;;;21052:16;:78::i;:::-;21032:98;;21168:15;:76;;21232:12;21168:76;;;21186:43;21194:20;21216:12;21186:7;:43::i;:::-;21168:76;21144:100;;21282:15;:76;;21346:12;21282:76;;;21300:43;21308:20;21330:12;21300:7;:43::i;:::-;21282:76;21258:100;;21426:16;21380:43;21391:18;;;;;;;;;;;21411:5;:11;;;21380:10;:43::i;:::-;:62;:146;;;;21510:16;21462:45;21475:18;;;;;;;;;;;21495:5;:11;;;21462:12;:45::i;:::-;:64;21380:146;:222;;;;21586:16;21546:37;21557:18;;;;;;;;;;;21577:5;21546:10;:37::i;:::-;:56;21380:222;:300;;;;21664:16;21622:39;21635:18;;;;;;;;;;;21655:5;21622:12;:39::i;:::-;:58;21380:300;21373:334;;;21702:5;21695:12;;;;21373:334;21727:15;21726:16;:236;;;;;21794:20;21750:41;21761:5;:16;;;21779:5;:11;;;21750:10;:41::i;:::-;:64;:211;;;;21941:20;21895:43;21908:5;:16;;;21926:5;:11;;;21895:12;:43::i;:::-;:66;21750:211;21726:236;21722:267;;;21984:5;21977:12;;;;21722:267;22008:15;22007:16;:224;;;;;22069:20;22031:35;22042:5;:16;;;22060:5;22031:10;:35::i;:::-;:58;:199;;;;22210:20;22170:37;22183:5;:16;;;22201:5;22170:12;:37::i;:::-;:60;22031:199;22007:224;22003:255;;;22253:5;22246:12;;;;22003:255;20718:1904;;;22326:20;22282:41;22293:5;:16;;;22311:5;:11;;;22282:10;:41::i;:::-;:64;:153;;;;22415:20;22369:43;22382:5;:16;;;22400:5;:11;;;22369:12;:43::i;:::-;:66;22282:153;:234;;;;22496:20;22458:35;22469:5;:16;;;22487:5;22458:10;:35::i;:::-;:58;22282:234;:317;;;;22579:20;22539:37;22552:5;:16;;;22570:5;22539:12;:37::i;:::-;:60;22282:317;22275:347;;;22617:5;22610:12;;;;22275:347;20718:1904;22640:4;22633:11;;20288:2363;;;;;;;;;;;;;:::o;19762:279::-;19921:4;19967:29;;;;;;;;;;;19948:62;;;20011:5;20018:4;20024:2;20028:5;19948:86;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;19948:86:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;19948:86:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;19948:86:0;;;;;;;;;;;;;;;;19941:93;;19762:279;;;;;;:::o;22821:339::-;23032:4;23065:5;23059:22;;;1505:4;23059:52;;23112:5;23059:59;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;23059:59:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;23059:59:0;;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;23059:59:0;;;;;;;;;;;;;;;;23052:66;;22821:339;;;;:::o;23396:372::-;23609:4;23642:5;23636:22;;;1505:4;23636:52;;23689:5;23696:29;;;;;;;;;;;23636:90;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;23636:90:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;23636:90:0;;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;23636:90:0;;;;;;;;;;;;;;;;23629:97;;23396:372;;;;:::o;995:22775::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", + "sources": [ + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/protocol/Exchange/Exchange.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/protocol/TokenTransferProxy/TokenTransferProxy.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/previous/Ownable/Ownable_v1.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/previous/SafeMath/SafeMath_v1.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/previous/Token/Token_v1.sol" + ] + } + } +}
\ No newline at end of file diff --git a/packages/contract-wrappers/test/artifacts/MaliciousToken.json b/packages/contract-wrappers/test/artifacts/MaliciousToken.json new file mode 100644 index 000000000..d25e22692 --- /dev/null +++ b/packages/contract-wrappers/test/artifacts/MaliciousToken.json @@ -0,0 +1,195 @@ +{ + "contract_name": "MaliciousToken", + "networks": { + "50": { + "solc_version": "0.4.23", + "source_tree_hash": "0xd31259e791da9de56d06674f846caf98d2108f325bb5d4d38689f336b8105e93", + "optimizer_enabled": false, + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "_spender", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_from", + "type": "address" + }, + { + "indexed": true, + "name": "_to", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "name": "_spender", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + } + ], + "bytecode": "0x60806040526001600360006101000a81548160ff021916908360ff16021790555034801561002c57600080fd5b506109cf8061003c6000396000f300608060405260043610610078576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063095ea7b31461007d57806318160ddd146100e257806323b872dd1461010d57806370a0823114610192578063a9059cbb146101e9578063dd62ed3e1461024e575b600080fd5b34801561008957600080fd5b506100c8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506102c5565b604051808215151515815260200191505060405180910390f35b3480156100ee57600080fd5b506100f76103b7565b6040518082815260200191505060405180910390f35b34801561011957600080fd5b50610178600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506103bd565b604051808215151515815260200191505060405180910390f35b34801561019e57600080fd5b506101d3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506106b0565b6040518082815260200191505060405180910390f35b3480156101f557600080fd5b50610234600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610700565b604051808215151515815260200191505060405180910390f35b34801561025a57600080fd5b506102af600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108e0565b6040518082815260200191505060405180910390f35b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60025481565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610489575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b801561051357506000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110155b151561051e57600080fd5b816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60006106ba61096f565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156107ce57506000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110155b15156107d957600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006108ea61096f565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6003600081819054906101000a900460ff168092919060010191906101000a81548160ff021916908360ff160217905550505600a165627a7a72305820bc0db764b650e2de614b2ca0caf080bff979bfafef8676588d84cbce5ed22d400029", + "runtime_bytecode": "0x608060405260043610610078576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063095ea7b31461007d57806318160ddd146100e257806323b872dd1461010d57806370a0823114610192578063a9059cbb146101e9578063dd62ed3e1461024e575b600080fd5b34801561008957600080fd5b506100c8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506102c5565b604051808215151515815260200191505060405180910390f35b3480156100ee57600080fd5b506100f76103b7565b6040518082815260200191505060405180910390f35b34801561011957600080fd5b50610178600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506103bd565b604051808215151515815260200191505060405180910390f35b34801561019e57600080fd5b506101d3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506106b0565b6040518082815260200191505060405180910390f35b3480156101f557600080fd5b50610234600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610700565b604051808215151515815260200191505060405180910390f35b34801561025a57600080fd5b506102af600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108e0565b6040518082815260200191505060405180910390f35b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60025481565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610489575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b801561051357506000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110155b151561051e57600080fd5b816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60006106ba61096f565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156107ce57506000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110155b15156107d957600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006108ea61096f565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6003600081819054906101000a900460ff168092919060010191906101000a81548160ff021916908360ff160217905550505600a165627a7a72305820bc0db764b650e2de614b2ca0caf080bff979bfafef8676588d84cbce5ed22d400029", + "updated_at": 1525776882742, + "source_map": "96:556:0:-;;;162:1;140:23;;;;;;;;;;;;;;;;;;;;96:556;8:9:-1;5:2;;;30:1;27;20:12;5:2;96:556:0;;;;;;;", + "source_map_runtime": "96:556:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;853:214:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;853:214:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1472:23;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1472:23:1;;;;;;;;;;;;;;;;;;;;;;;435:412;;8:9:-1;5:2;;;30:1;27;20:12;5:2;435:412:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;303:157:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;303:157:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;107:322:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;107:322:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;466:184:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;466:184:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;853:214:1;933:4;985:6;953:7;:19;961:10;953:19;;;;;;;;;;;;;;;:29;973:8;953:29;;;;;;;;;;;;;;;:38;;;;1022:8;1001:38;;1010:10;1001:38;;;1032:6;1001:38;;;;;;;;;;;;;;;;;;1056:4;1049:11;;853:214;;;;:::o;1472:23::-;;;;:::o;435:412::-;530:4;577:6;558:8;:15;567:5;558:15;;;;;;;;;;;;;;;;:25;;:65;;;;;617:6;587:7;:14;595:5;587:14;;;;;;;;;;;;;;;:26;602:10;587:26;;;;;;;;;;;;;;;;:36;;558:65;:108;;;;;653:8;:13;662:3;653:13;;;;;;;;;;;;;;;;643:6;627:8;:13;636:3;627:13;;;;;;;;;;;;;;;;:22;:39;;558:108;550:117;;;;;;;;694:6;677:8;:13;686:3;677:13;;;;;;;;;;;;;;;;:23;;;;;;;;;;;729:6;710:8;:15;719:5;710:15;;;;;;;;;;;;;;;;:25;;;;;;;;;;;775:6;745:7;:14;753:5;745:14;;;;;;;;;;;;;;;:26;760:10;745:26;;;;;;;;;;;;;;;;:36;;;;;;;;;;;807:3;791:28;;800:5;791:28;;;812:6;791:28;;;;;;;;;;;;;;;;;;836:4;829:11;;435:412;;;;;:::o;303:157:0:-;387:4;407:13;:11;:13::i;:::-;437:8;:16;446:6;437:16;;;;;;;;;;;;;;;;430:23;;303:157;;;:::o;107:322:1:-;183:4;235:6;211:8;:20;220:10;211:20;;;;;;;;;;;;;;;;:30;;:73;;;;;271:8;:13;280:3;271:13;;;;;;;;;;;;;;;;261:6;245:8;:13;254:3;245:13;;;;;;;;;;;;;;;;:22;:39;;211:73;203:82;;;;;;;;319:6;295:8;:20;304:10;295:20;;;;;;;;;;;;;;;;:30;;;;;;;;;;;352:6;335:8;:13;344:3;335:13;;;;;;;;;;;;;;;;:23;;;;;;;;;;;389:3;368:33;;377:10;368:33;;;394:6;368:33;;;;;;;;;;;;;;;;;;418:4;411:11;;107:322;;;;:::o;466:184:0:-;568:4;588:13;:11;:13::i;:::-;618:7;:15;626:6;618:15;;;;;;;;;;;;;;;:25;634:8;618:25;;;;;;;;;;;;;;;;611:32;;466:184;;;;:::o;221:76::-;275:13;;:15;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;221:76::o", + "sources": [ + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/test/MaliciousToken/MaliciousToken.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/tokens/ERC20Token/ERC20Token.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/tokens/Token/Token.sol" + ] + } + } +}
\ No newline at end of file diff --git a/packages/contract-wrappers/test/artifacts/MultiSigWallet.json b/packages/contract-wrappers/test/artifacts/MultiSigWallet.json new file mode 100644 index 000000000..b6c19d125 --- /dev/null +++ b/packages/contract-wrappers/test/artifacts/MultiSigWallet.json @@ -0,0 +1,551 @@ +{ + "contract_name": "MultiSigWallet", + "networks": { + "50": { + "solc_version": "0.4.23", + "source_tree_hash": "0xe4dcaad5ebc708ef4258ff1a4152c7b94956a61f99db39fb7ae3003cc7087234", + "optimizer_enabled": false, + "abi": [ + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "owners", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "owner", + "type": "address" + } + ], + "name": "removeOwner", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "transactionId", + "type": "uint256" + } + ], + "name": "revokeConfirmation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "isOwner", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + }, + { + "name": "", + "type": "address" + } + ], + "name": "confirmations", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "pending", + "type": "bool" + }, + { + "name": "executed", + "type": "bool" + } + ], + "name": "getTransactionCount", + "outputs": [ + { + "name": "count", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "owner", + "type": "address" + } + ], + "name": "addOwner", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "transactionId", + "type": "uint256" + } + ], + "name": "isConfirmed", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "transactionId", + "type": "uint256" + } + ], + "name": "getConfirmationCount", + "outputs": [ + { + "name": "count", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "transactions", + "outputs": [ + { + "name": "destination", + "type": "address" + }, + { + "name": "value", + "type": "uint256" + }, + { + "name": "data", + "type": "bytes" + }, + { + "name": "executed", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getOwners", + "outputs": [ + { + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "from", + "type": "uint256" + }, + { + "name": "to", + "type": "uint256" + }, + { + "name": "pending", + "type": "bool" + }, + { + "name": "executed", + "type": "bool" + } + ], + "name": "getTransactionIds", + "outputs": [ + { + "name": "_transactionIds", + "type": "uint256[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "transactionId", + "type": "uint256" + } + ], + "name": "getConfirmations", + "outputs": [ + { + "name": "_confirmations", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "transactionCount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_required", + "type": "uint256" + } + ], + "name": "changeRequirement", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "transactionId", + "type": "uint256" + } + ], + "name": "confirmTransaction", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "destination", + "type": "address" + }, + { + "name": "value", + "type": "uint256" + }, + { + "name": "data", + "type": "bytes" + } + ], + "name": "submitTransaction", + "outputs": [ + { + "name": "transactionId", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "MAX_OWNER_COUNT", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "required", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "owner", + "type": "address" + }, + { + "name": "newOwner", + "type": "address" + } + ], + "name": "replaceOwner", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "transactionId", + "type": "uint256" + } + ], + "name": "executeTransaction", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "name": "_owners", + "type": "address[]" + }, + { + "name": "_required", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "name": "transactionId", + "type": "uint256" + } + ], + "name": "Confirmation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "name": "transactionId", + "type": "uint256" + } + ], + "name": "Revocation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "transactionId", + "type": "uint256" + } + ], + "name": "Submission", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "transactionId", + "type": "uint256" + } + ], + "name": "Execution", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "transactionId", + "type": "uint256" + } + ], + "name": "ExecutionFailure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "name": "value", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "owner", + "type": "address" + } + ], + "name": "OwnerAddition", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "owner", + "type": "address" + } + ], + "name": "OwnerRemoval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "required", + "type": "uint256" + } + ], + "name": "RequirementChange", + "type": "event" + } + ], + "bytecode": "0x60806040523480156200001157600080fd5b5060405162002385380380620023858339810180604052810190808051820192919060200180519060200190929190505050600082518260328211806200005757508181115b80620000635750600081145b806200006f5750600082145b156200007a57600080fd5b600092505b8451831015620001b1576002600086858151811015156200009c57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680620001285750600085848151811015156200010657fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff16145b156200013357600080fd5b60016002600087868151811015156200014857fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555082806001019350506200007f565b8460039080519060200190620001c9929190620001dc565b50836004819055505050505050620002b1565b82805482825590600052602060002090810192821562000258579160200282015b82811115620002575782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555091602001919060010190620001fd565b5b5090506200026791906200026b565b5090565b620002ae91905b80821115620002aa57600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555060010162000272565b5090565b90565b6120c480620002c16000396000f30060806040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c2714610177578063173825d9146101e457806320ea8d86146102275780632f54bf6e146102545780633411c81c146102af57806354741525146103145780637065cb4814610363578063784547a7146103a65780638b51d13f146103eb5780639ace38c21461042c578063a0e67e2b14610517578063a8abe69a14610583578063b5dc40c314610627578063b77bf600146106a9578063ba51a6df146106d4578063c01a8c8414610701578063c64274741461072e578063d74f8edd146107d5578063dc8452cd14610800578063e20056e61461082b578063ee22610b1461088e575b6000341115610175573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34801561018357600080fd5b506101a2600480360381019080803590602001909291905050506108bb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101f057600080fd5b50610225600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108f9565b005b34801561023357600080fd5b5061025260048036038101908080359060200190929190505050610b92565b005b34801561026057600080fd5b50610295600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d38565b604051808215151515815260200191505060405180910390f35b3480156102bb57600080fd5b506102fa60048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d58565b604051808215151515815260200191505060405180910390f35b34801561032057600080fd5b5061034d600480360381019080803515159060200190929190803515159060200190929190505050610d87565b6040518082815260200191505060405180910390f35b34801561036f57600080fd5b506103a4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e19565b005b3480156103b257600080fd5b506103d160048036038101908080359060200190929190505050611012565b604051808215151515815260200191505060405180910390f35b3480156103f757600080fd5b50610416600480360381019080803590602001909291905050506110f7565b6040518082815260200191505060405180910390f35b34801561043857600080fd5b50610457600480360381019080803590602001909291905050506111c2565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b838110156104d95780820151818401526020810190506104be565b50505050905090810190601f1680156105065780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561052357600080fd5b5061052c6112b7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561056f578082015181840152602081019050610554565b505050509050019250505060405180910390f35b34801561058f57600080fd5b506105d06004803603810190808035906020019092919080359060200190929190803515159060200190929190803515159060200190929190505050611345565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106135780820151818401526020810190506105f8565b505050509050019250505060405180910390f35b34801561063357600080fd5b50610652600480360381019080803590602001909291905050506114b6565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561069557808201518184015260208101905061067a565b505050509050019250505060405180910390f35b3480156106b557600080fd5b506106be6116f3565b6040518082815260200191505060405180910390f35b3480156106e057600080fd5b506106ff600480360381019080803590602001909291905050506116f9565b005b34801561070d57600080fd5b5061072c600480360381019080803590602001909291905050506117ab565b005b34801561073a57600080fd5b506107bf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611984565b6040518082815260200191505060405180910390f35b3480156107e157600080fd5b506107ea6119a3565b6040518082815260200191505060405180910390f35b34801561080c57600080fd5b506108156119a8565b6040518082815260200191505060405180910390f35b34801561083757600080fd5b5061088c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119ae565b005b34801561089a57600080fd5b506108b960048036038101908080359060200190929190505050611cc1565b005b6003818154811015156108ca57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561093557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561098e57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610b13578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a2157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610b06576003600160038054905003815481101515610a7f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610ab957fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b13565b81806001019250506109eb565b6001600381818054905003915081610b2b9190611fc7565b506003805490506004541115610b4a57610b496003805490506116f9565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610beb57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610c5657600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff1615610c8457600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b600554811015610e1257838015610dc6575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610df95750828015610df8575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610e05576001820191505b8080600101915050610d8f565b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e5357600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610eab57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff161415610ed057600080fd5b6001600380549050016004546032821180610eea57508181115b80610ef55750600081145b80610f005750600082145b15610f0a57600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038590806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b6003805490508110156110ef5760016000858152602001908152602001600020600060038381548110151561105057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156110cf576001820191505b6004548214156110e257600192506110f0565b808060010191505061101f565b5b5050919050565b600080600090505b6003805490508110156111bc5760016000848152602001908152602001600020600060038381548110151561113057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156111af576001820191505b80806001019150506110ff565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561129a5780601f1061126f5761010080835404028352916020019161129a565b820191906000526020600020905b81548152906001019060200180831161127d57829003601f168201915b5050505050908060030160009054906101000a900460ff16905084565b6060600380548060200260200160405190810160405280929190818152602001828054801561133b57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116112f1575b5050505050905090565b60608060008060055460405190808252806020026020018201604052801561137c5781602001602082028038833980820191505090505b50925060009150600090505b600554811015611428578580156113bf575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806113f257508480156113f1575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b1561141b5780838381518110151561140657fe5b90602001906020020181815250506001820191505b8080600101915050611388565b8787036040519080825280602002602001820160405280156114595781602001602082028038833980820191505090505b5093508790505b868110156114ab57828181518110151561147657fe5b906020019060200201518489830381518110151561149057fe5b90602001906020020181815250508080600101915050611460565b505050949350505050565b6060806000806003805490506040519080825280602002602001820160405280156114f05781602001602082028038833980820191505090505b50925060009150600090505b60038054905081101561163d5760016000868152602001908152602001600020600060038381548110151561152d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611630576003818154811015156115b457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156115ed57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b80806001019150506114fc565b8160405190808252806020026020018201604052801561166c5781602001602082028038833980820191505090505b509350600090505b818110156116eb57828181518110151561168a57fe5b9060200190602002015184828151811015156116a257fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611674565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561173357600080fd5b60038054905081603282118061174857508181115b806117535750600081145b8061175e5750600082145b1561176857600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561180457600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561185e57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156118c857600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361197d85611cc1565b5050505050565b6000611991848484611e77565b905061199c816117ab565b9392505050565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119ea57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611a4357600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611a9b57600080fd5b600092505b600380549050831015611b84578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611ad357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611b775783600384815481101515611b2a57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611b84565b8280600101935050611aa0565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b60008160008082815260200190815260200160002060030160009054906101000a900460ff1615611cf157600080fd5b611cfa83611012565b15611e7257600080848152602001908152602001600020915060018260030160006101000a81548160ff0219169083151502179055508160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168260010154836002016040518082805460018160011615610100020316600290048015611dd95780601f10611dae57610100808354040283529160200191611dd9565b820191906000526020600020905b815481529060010190602001808311611dbc57829003601f168201915b505091505060006040518083038185875af19250505015611e2657827f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2611e71565b827f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008260030160006101000a81548160ff0219169083151502179055505b5b505050565b60008360008173ffffffffffffffffffffffffffffffffffffffff161415611e9e57600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190611f5d929190611ff3565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b815481835581811115611fee57818360005260206000209182019101611fed9190612073565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061203457805160ff1916838001178555612062565b82800160010185558215612062579182015b82811115612061578251825591602001919060010190612046565b5b50905061206f9190612073565b5090565b61209591905b80821115612091576000816000905550600101612079565b5090565b905600a165627a7a7230582032e9ac30c99806e1f9fc009a8eac402375156fbc84f1211a8d4ac07fbd5614c00029", + "runtime_bytecode": "0x60806040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c2714610177578063173825d9146101e457806320ea8d86146102275780632f54bf6e146102545780633411c81c146102af57806354741525146103145780637065cb4814610363578063784547a7146103a65780638b51d13f146103eb5780639ace38c21461042c578063a0e67e2b14610517578063a8abe69a14610583578063b5dc40c314610627578063b77bf600146106a9578063ba51a6df146106d4578063c01a8c8414610701578063c64274741461072e578063d74f8edd146107d5578063dc8452cd14610800578063e20056e61461082b578063ee22610b1461088e575b6000341115610175573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34801561018357600080fd5b506101a2600480360381019080803590602001909291905050506108bb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101f057600080fd5b50610225600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108f9565b005b34801561023357600080fd5b5061025260048036038101908080359060200190929190505050610b92565b005b34801561026057600080fd5b50610295600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d38565b604051808215151515815260200191505060405180910390f35b3480156102bb57600080fd5b506102fa60048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d58565b604051808215151515815260200191505060405180910390f35b34801561032057600080fd5b5061034d600480360381019080803515159060200190929190803515159060200190929190505050610d87565b6040518082815260200191505060405180910390f35b34801561036f57600080fd5b506103a4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e19565b005b3480156103b257600080fd5b506103d160048036038101908080359060200190929190505050611012565b604051808215151515815260200191505060405180910390f35b3480156103f757600080fd5b50610416600480360381019080803590602001909291905050506110f7565b6040518082815260200191505060405180910390f35b34801561043857600080fd5b50610457600480360381019080803590602001909291905050506111c2565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b838110156104d95780820151818401526020810190506104be565b50505050905090810190601f1680156105065780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561052357600080fd5b5061052c6112b7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561056f578082015181840152602081019050610554565b505050509050019250505060405180910390f35b34801561058f57600080fd5b506105d06004803603810190808035906020019092919080359060200190929190803515159060200190929190803515159060200190929190505050611345565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106135780820151818401526020810190506105f8565b505050509050019250505060405180910390f35b34801561063357600080fd5b50610652600480360381019080803590602001909291905050506114b6565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561069557808201518184015260208101905061067a565b505050509050019250505060405180910390f35b3480156106b557600080fd5b506106be6116f3565b6040518082815260200191505060405180910390f35b3480156106e057600080fd5b506106ff600480360381019080803590602001909291905050506116f9565b005b34801561070d57600080fd5b5061072c600480360381019080803590602001909291905050506117ab565b005b34801561073a57600080fd5b506107bf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611984565b6040518082815260200191505060405180910390f35b3480156107e157600080fd5b506107ea6119a3565b6040518082815260200191505060405180910390f35b34801561080c57600080fd5b506108156119a8565b6040518082815260200191505060405180910390f35b34801561083757600080fd5b5061088c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119ae565b005b34801561089a57600080fd5b506108b960048036038101908080359060200190929190505050611cc1565b005b6003818154811015156108ca57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561093557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561098e57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610b13578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a2157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610b06576003600160038054905003815481101515610a7f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610ab957fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b13565b81806001019250506109eb565b6001600381818054905003915081610b2b9190611fc7565b506003805490506004541115610b4a57610b496003805490506116f9565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610beb57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610c5657600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff1615610c8457600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b600554811015610e1257838015610dc6575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610df95750828015610df8575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610e05576001820191505b8080600101915050610d8f565b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e5357600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610eab57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff161415610ed057600080fd5b6001600380549050016004546032821180610eea57508181115b80610ef55750600081145b80610f005750600082145b15610f0a57600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038590806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b6003805490508110156110ef5760016000858152602001908152602001600020600060038381548110151561105057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156110cf576001820191505b6004548214156110e257600192506110f0565b808060010191505061101f565b5b5050919050565b600080600090505b6003805490508110156111bc5760016000848152602001908152602001600020600060038381548110151561113057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156111af576001820191505b80806001019150506110ff565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561129a5780601f1061126f5761010080835404028352916020019161129a565b820191906000526020600020905b81548152906001019060200180831161127d57829003601f168201915b5050505050908060030160009054906101000a900460ff16905084565b6060600380548060200260200160405190810160405280929190818152602001828054801561133b57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116112f1575b5050505050905090565b60608060008060055460405190808252806020026020018201604052801561137c5781602001602082028038833980820191505090505b50925060009150600090505b600554811015611428578580156113bf575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806113f257508480156113f1575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b1561141b5780838381518110151561140657fe5b90602001906020020181815250506001820191505b8080600101915050611388565b8787036040519080825280602002602001820160405280156114595781602001602082028038833980820191505090505b5093508790505b868110156114ab57828181518110151561147657fe5b906020019060200201518489830381518110151561149057fe5b90602001906020020181815250508080600101915050611460565b505050949350505050565b6060806000806003805490506040519080825280602002602001820160405280156114f05781602001602082028038833980820191505090505b50925060009150600090505b60038054905081101561163d5760016000868152602001908152602001600020600060038381548110151561152d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611630576003818154811015156115b457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156115ed57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b80806001019150506114fc565b8160405190808252806020026020018201604052801561166c5781602001602082028038833980820191505090505b509350600090505b818110156116eb57828181518110151561168a57fe5b9060200190602002015184828151811015156116a257fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611674565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561173357600080fd5b60038054905081603282118061174857508181115b806117535750600081145b8061175e5750600082145b1561176857600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561180457600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561185e57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156118c857600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361197d85611cc1565b5050505050565b6000611991848484611e77565b905061199c816117ab565b9392505050565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119ea57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611a4357600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611a9b57600080fd5b600092505b600380549050831015611b84578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611ad357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611b775783600384815481101515611b2a57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611b84565b8280600101935050611aa0565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b60008160008082815260200190815260200160002060030160009054906101000a900460ff1615611cf157600080fd5b611cfa83611012565b15611e7257600080848152602001908152602001600020915060018260030160006101000a81548160ff0219169083151502179055508160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168260010154836002016040518082805460018160011615610100020316600290048015611dd95780601f10611dae57610100808354040283529160200191611dd9565b820191906000526020600020905b815481529060010190602001808311611dbc57829003601f168201915b505091505060006040518083038185875af19250505015611e2657827f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2611e71565b827f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008260030160006101000a81548160ff0219169083151502179055505b5b505050565b60008360008173ffffffffffffffffffffffffffffffffffffffff161415611e9e57600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190611f5d929190611ff3565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b815481835581811115611fee57818360005260206000209182019101611fed9190612073565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061203457805160ff1916838001178555612062565b82800160010185558215612062579182015b82811115612061578251825591602001919060010190612046565b5b50905061206f9190612073565b5090565b61209591905b80821115612091576000816000905550600101612079565b5090565b905600a165627a7a7230582032e9ac30c99806e1f9fc009a8eac402375156fbc84f1211a8d4ac07fbd5614c00029", + "updated_at": 1525776879097, + "source_map": "186:11249:0:-;;;2814:370;8:9:-1;5:2;;;30:1;27;20:12;5:2;2814:370:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2959:6;2913:7;:14;2929:9;256:2;2236:10;:28;:66;;;;2292:10;2280:9;:22;2236:66;:96;;;;2331:1;2318:9;:14;2236:96;:127;;;;2362:1;2348:10;:15;2236:127;2229:153;;;2377:5;;;2229:153;2966:1;2959:8;;2954:168;2971:7;:14;2969:1;:16;2954:168;;;3010:7;:19;3018:7;3026:1;3018:10;;;;;;;;;;;;;;;;;;3010:19;;;;;;;;;;;;;;;;;;;;;;;;;:38;;;;3047:1;3033:7;3041:1;3033:10;;;;;;;;;;;;;;;;;;:15;;;3010:38;3006:65;;;3066:5;;;3006:65;3107:4;3085:7;:19;3093:7;3101:1;3093:10;;;;;;;;;;;;;;;;;;3085:19;;;;;;;;;;;;;;;;:26;;;;;;;;;;;;;;;;;;2987:3;;;;;;;2954:168;;;3140:7;3131:6;:16;;;;;;;;;;;;:::i;:::-;;3168:9;3157:8;:20;;;;2814:370;;;;;186:11249;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;", + "source_map_runtime": "186:11249:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2519:1;2507:9;:13;2503:61;;;2542:10;2534:30;;;2554:9;2534:30;;;;;;;;;;;;;;;;;;2503:61;186:11249;936:23;;8:9:-1;5:2;;;30:1;27;20:12;5:2;936:23:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3711:460;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3711:460:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;6274:291;;8:9:-1;5:2;;;30:1;27;20:12;5:2;6274:291:0;;;;;;;;;;;;;;;;;;;;;;;;;;890:40;;8:9:-1;5:2;;;30:1;27;20:12;5:2;890:40:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;820:64;;8:9:-1;5:2;;;30:1;27;20:12;5:2;820:64:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9136:319;;8:9:-1;5:2;;;30:1;27;20:12;5:2;9136:319:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3311:277;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3311:277:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;7304:337;;8:9:-1;5:2;;;30:1;27;20:12;5:2;7304:337:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8622:252;;8:9:-1;5:2;;;30:1;27;20:12;5:2;8622:252:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;765:49;;8:9:-1;5:2;;;30:1;27;20:12;5:2;765:49:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;765:49:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9539:115;;8:9:-1;5:2;;;30:1;27;20:12;5:2;9539:115:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;9539:115:0;;;;;;;;;;;;;;;;;10757:676;;8:9:-1;5:2;;;30:1;27;20:12;5:2;10757:676:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;10757:676:0;;;;;;;;;;;;;;;;;9833:575;;8:9:-1;5:2;;;30:1;27;20:12;5:2;9833:575:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;9833:575:0;;;;;;;;;;;;;;;;;991:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;991:28:0;;;;;;;;;;;;;;;;;;;;;;;4990:207;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4990:207:0;;;;;;;;;;;;;;;;;;;;;;;;;;5806:344;;8:9:-1;5:2;;;30:1;27;20:12;5:2;5806:344:0;;;;;;;;;;;;;;;;;;;;;;;;;;5456:244;;8:9:-1;5:2;;;30:1;27;20:12;5:2;5456:244:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;217:41;;8:9:-1;5:2;;;30:1;27;20:12;5:2;217:41:0;;;;;;;;;;;;;;;;;;;;;;;965:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;965:20:0;;;;;;;;;;;;;;;;;;;;;;;4370:449;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4370:449:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6679:474;;8:9:-1;5:2;;;30:1;27;20:12;5:2;6679:474:0;;;;;;;;;;;;;;;;;;;;;;;;;;936:23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;3711:460::-;3859:6;1208:4;1186:27;;:10;:27;;;;1182:50;;;1227:5;;;1182:50;3801:5;1420:7;:14;1428:5;1420:14;;;;;;;;;;;;;;;;;;;;;;;;;1419:15;1415:38;;;1448:5;;;1415:38;3839:5;3822:7;:14;3830:5;3822:14;;;;;;;;;;;;;;;;:22;;;;;;;;;;;;;;;;;;3866:1;3859:8;;3854:170;3887:1;3871:6;:13;;;;:17;3869:1;:19;3854:170;;;3924:5;3911:18;;:6;3918:1;3911:9;;;;;;;;;;;;;;;;;;;;;;;;;;;:18;;;3907:117;;;3961:6;3984:1;3968:6;:13;;;;:17;3961:25;;;;;;;;;;;;;;;;;;;;;;;;;;;3949:6;3956:1;3949:9;;;;;;;;;;;;;;;;;;:37;;;;;;;;;;;;;;;;;;4004:5;;3907:117;3890:3;;;;;;;3854:170;;;4050:1;4033:6;:18;;;;;;;;;;;;;;:::i;:::-;;4076:6;:13;;;;4065:8;;:24;4061:74;;;4103:32;4121:6;:13;;;;4103:17;:32::i;:::-;4061:74;4158:5;4145:19;;;;;;;;;;;;1242:1;3711:460;;:::o;6274:291::-;6357:10;1420:7;:14;1428:5;1420:14;;;;;;;;;;;;;;;;;;;;;;;;;1419:15;1415:38;;;1448:5;;;1415:38;6387:13;6402:10;1694:13;:28;1708:13;1694:28;;;;;;;;;;;:35;1723:5;1694:35;;;;;;;;;;;;;;;;;;;;;;;;;1693:36;1689:59;;;1743:5;;;1689:59;6434:13;1976:12;:27;1989:13;1976:27;;;;;;;;;;;:36;;;;;;;;;;;;1972:59;;;2026:5;;;1972:59;6506:5;6463:13;:28;6477:13;6463:28;;;;;;;;;;;:40;6492:10;6463:40;;;;;;;;;;;;;;;;:48;;;;;;;;;;;;;;;;;;6544:13;6532:10;6521:37;;;;;;;;;;;;1758:1;1463;;6274:291;;:::o;890:40::-;;;;;;;;;;;;;;;;;;;;;;:::o;820:64::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;9136:319::-;9243:10;9274:6;9281:1;9274:8;;9269:179;9286:16;;9284:1;:18;9269:179;;;9328:7;:36;;;;;9340:12;:15;9353:1;9340:15;;;;;;;;;;;:24;;;;;;;;;;;;9339:25;9328:36;:92;;;;9384:8;:36;;;;;9396:12;:15;9409:1;9396:15;;;;;;;;;;;:24;;;;;;;;;;;;9384:36;9328:92;9321:127;;;9447:1;9438:10;;;;9321:127;9304:3;;;;;;;9269:179;;;9136:319;;;;;:::o;3311:277::-;1208:4;1186:27;;:10;:27;;;;1182:50;;;1227:5;;;1182:50;3404:5;1312:7;:14;1320:5;1312:14;;;;;;;;;;;;;;;;;;;;;;;;;1308:37;;;1340:5;;;1308:37;3427:5;2116:1;2104:8;:13;;;2100:36;;;2131:5;;;2100:36;3475:1;3459:6;:13;;;;:17;3478:8;;256:2;2236:10;:28;:66;;;;2292:10;2280:9;:22;2236:66;:96;;;;2331:1;2318:9;:14;2236:96;:127;;;;2362:1;2348:10;:15;2236:127;2229:153;;;2377:5;;;2229:153;3519:4;3502:7;:14;3510:5;3502:14;;;;;;;;;;;;;;;;:21;;;;;;;;;;;;;;;;;;3533:6;3545:5;3533:18;;39:1:-1;33:3;27:10;23:18;57:10;52:3;45:23;79:10;72:17;;0:93;3533:18:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3575:5;3561:20;;;;;;;;;;;;2146:1;;1355;1242;3311:277;:::o;7304:337::-;7394:4;7414:10;7443:6;7427:1;7414:14;;7450:1;7443:8;;7438:197;7455:6;:13;;;;7453:1;:15;7438:197;;;7493:13;:28;7507:13;7493:28;;;;;;;;;;;:39;7522:6;7529:1;7522:9;;;;;;;;;;;;;;;;;;;;;;;;;;;7493:39;;;;;;;;;;;;;;;;;;;;;;;;;7489:71;;;7559:1;7550:10;;;;7489:71;7587:8;;7578:5;:17;7574:50;;;7620:4;7613:11;;;;7574:50;7470:3;;;;;;;7438:197;;;7304:337;;;;;;:::o;8622:252::-;8721:10;8752:6;8759:1;8752:8;;8747:120;8764:6;:13;;;;8762:1;:15;8747:120;;;8800:13;:28;8814:13;8800:28;;;;;;;;;;;:39;8829:6;8836:1;8829:9;;;;;;;;;;;;;;;;;;;;;;;;;;;8800:39;;;;;;;;;;;;;;;;;;;;;;;;;8796:71;;;8866:1;8857:10;;;;8796:71;8779:3;;;;;;;8747:120;;;8622:252;;;;:::o;765:49::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;9539:115::-;9609:9;9641:6;9634:13;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9539:115;:::o;10757:676::-;10882:22;10920:32;10993:10;11017:6;10966:16;;10955:28;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;10955:28:0;;;;10920:63;;11006:1;10993:14;;11040:1;11038:3;;11033:250;11045:16;;11043:1;:18;11033:250;;;11087:7;:36;;;;;11099:12;:15;11112:1;11099:15;;;;;;;;;;;:24;;;;;;;;;;;;11098:25;11087:36;:92;;;;11143:8;:36;;;;;11155:12;:15;11168:1;11155:15;;;;;;;;;;;:24;;;;;;;;;;;;11143:36;11087:92;11080:203;;;11239:1;11211:18;11230:5;11211:25;;;;;;;;;;;;;;;;;:29;;;;;11267:1;11258:10;;;;11080:203;11063:3;;;;;;;11033:250;;;11326:4;11321:2;:9;11310:21;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;11310:21:0;;;;11292:39;;11348:4;11346:6;;11341:85;11356:2;11354:1;:4;11341:85;;;11405:18;11424:1;11405:21;;;;;;;;;;;;;;;;;;11377:15;11397:4;11393:1;:8;11377:25;;;;;;;;;;;;;;;;;:49;;;;;11360:3;;;;;;;11341:85;;;10757:676;;;;;;;;;:::o;9833:575::-;9928:24;9968:34;10043:10;10067:6;10019;:13;;;;10005:28;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;10005:28:0;;;;9968:65;;10056:1;10043:14;;10090:1;10088:3;;10083:186;10095:6;:13;;;;10093:1;:15;10083:186;;;10131:13;:28;10145:13;10131:28;;;;;;;;;;;:39;10160:6;10167:1;10160:9;;;;;;;;;;;;;;;;;;;;;;;;;;;10131:39;;;;;;;;;;;;;;;;;;;;;;;;;10127:142;;;10217:6;10224:1;10217:9;;;;;;;;;;;;;;;;;;;;;;;;;;;10190:17;10208:5;10190:24;;;;;;;;;;;;;;;;;:36;;;;;;;;;;;10253:1;10244:10;;;;10127:142;10110:3;;;;;;;10083:186;;;10309:5;10295:20;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;10295:20:0;;;;10278:37;;10332:1;10330:3;;10325:76;10337:5;10335:1;:7;10325:76;;;10381:17;10399:1;10381:20;;;;;;;;;;;;;;;;;;10361:14;10376:1;10361:17;;;;;;;;;;;;;;;;;:40;;;;;;;;;;;10344:3;;;;;;;10325:76;;;9833:575;;;;;;:::o;991:28::-;;;;:::o;4990:207::-;1208:4;1186:27;;:10;:27;;;;1182:50;;;1227:5;;;1182:50;5092:6;:13;;;;5107:9;256:2;2236:10;:28;:66;;;;2292:10;2280:9;:22;2236:66;:96;;;;2331:1;2318:9;:14;2236:96;:127;;;;2362:1;2348:10;:15;2236:127;2229:153;;;2377:5;;;2229:153;5143:9;5132:8;:20;;;;5162:28;5180:9;5162:28;;;;;;;;;;;;;;;;;;1242:1;;4990:207;:::o;5806:344::-;5889:10;1420:7;:14;1428:5;1420:14;;;;;;;;;;;;;;;;;;;;;;;;;1419:15;1415:38;;;1448:5;;;1415:38;5927:13;1581:1;1538:12;:27;1551:13;1538:27;;;;;;;;;;;:39;;;;;;;;;;;;:44;;;1534:67;;;1596:5;;;1534:67;5963:13;5978:10;1843:13;:28;1857:13;1843:28;;;;;;;;;;;:35;1872:5;1843:35;;;;;;;;;;;;;;;;;;;;;;;;;1839:58;;;1892:5;;;1839:58;6047:4;6004:13;:28;6018:13;6004:28;;;;;;;;;;;:40;6033:10;6004:40;;;;;;;;;;;;;;;;:47;;;;;;;;;;;;;;;;;;6086:13;6074:10;6061:39;;;;;;;;;;;;6110:33;6129:13;6110:18;:33::i;:::-;1611:1;;1463;5806:344;;:::o;5456:244::-;5560:18;5610:40;5625:11;5638:5;5645:4;5610:14;:40::i;:::-;5594:56;;5660:33;5679:13;5660:18;:33::i;:::-;5456:244;;;;;:::o;217:41::-;256:2;217:41;:::o;965:20::-;;;;:::o;4370:449::-;4541:6;1208:4;1186:27;;:10;:27;;;;1182:50;;;1227:5;;;1182:50;4479:5;1420:7;:14;1428:5;1420:14;;;;;;;;;;;;;;;;;;;;;;;;;1419:15;1415:38;;;1448:5;;;1415:38;4512:8;1312:7;:14;1320:5;1312:14;;;;;;;;;;;;;;;;;;;;;;;;;1308:37;;;1340:5;;;1308:37;4548:1;4541:8;;4536:149;4553:6;:13;;;;4551:1;:15;4536:149;;;4602:5;4589:18;;:6;4596:1;4589:9;;;;;;;;;;;;;;;;;;;;;;;;;;;:18;;;4585:100;;;4639:8;4627:6;4634:1;4627:9;;;;;;;;;;;;;;;;;;:20;;;;;;;;;;;;;;;;;;4665:5;;4585:100;4568:3;;;;;;;4536:149;;;4711:5;4694:7;:14;4702:5;4694:14;;;;;;;;;;;;;;;;:22;;;;;;;;;;;;;;;;;;4746:4;4726:7;:17;4734:8;4726:17;;;;;;;;;;;;;;;;:24;;;;;;;;;;;;;;;;;;4773:5;4760:19;;;;;;;;;;;;4803:8;4789:23;;;;;;;;;;;;1463:1;1242;4370:449;;;:::o;6679:474::-;6837:14;6762:13;1976:12;:27;1989:13;1976:27;;;;;;;;;;;:36;;;;;;;;;;;;1972:59;;;2026:5;;;1972:59;6795:26;6807:13;6795:11;:26::i;:::-;6791:356;;;6854:12;:27;6867:13;6854:27;;;;;;;;;;;6837:44;;6909:4;6895:2;:11;;;:18;;;;;;;;;;;;;;;;;;6931:2;:14;;;;;;;;;;;;:19;;6957:2;:8;;;6967:2;:7;;6931:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6927:210;;;7003:13;6993:24;;;;;;;;;;6927:210;;;7071:13;7054:31;;;;;;;;;;7117:5;7103:2;:11;;;:19;;;;;;;;;;;;;;;;;;6927:210;6791:356;6679:474;;;:::o;7974:451::-;8106:18;8076:11;2116:1;2104:8;:13;;;2100:36;;;2131:5;;;2100:36;8156:16;;8140:32;;8212:140;;;;;;;;;8251:11;8212:140;;;;;;8283:5;8212:140;;;;8308:4;8212:140;;;;8336:5;8212:140;;;;;8182:12;:27;8195:13;8182:27;;;;;;;;;;;:170;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8382:1;8362:16;;:21;;;;;;;;;;;8404:13;8393:25;;;;;;;;;;7974:451;;;;;;:::o;186:11249::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", + "sources": [ + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/multisig/MultiSigWallet/MultiSigWallet.sol" + ] + } + } +}
\ No newline at end of file diff --git a/packages/contract-wrappers/test/artifacts/MultiSigWalletWithTimeLock.json b/packages/contract-wrappers/test/artifacts/MultiSigWalletWithTimeLock.json new file mode 100644 index 000000000..d96c8925c --- /dev/null +++ b/packages/contract-wrappers/test/artifacts/MultiSigWalletWithTimeLock.json @@ -0,0 +1,632 @@ +{ + "contract_name": "MultiSigWalletWithTimeLock", + "networks": { + "50": { + "solc_version": "0.4.23", + "source_tree_hash": "0xbb079315d5a2798ed8399ea2a110cefcc083e33684ad5f5698cd3f582568c4c6", + "optimizer_enabled": false, + "abi": [ + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "owners", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "owner", + "type": "address" + } + ], + "name": "removeOwner", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "transactionId", + "type": "uint256" + } + ], + "name": "revokeConfirmation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "isOwner", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + }, + { + "name": "", + "type": "address" + } + ], + "name": "confirmations", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "secondsTimeLocked", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "pending", + "type": "bool" + }, + { + "name": "executed", + "type": "bool" + } + ], + "name": "getTransactionCount", + "outputs": [ + { + "name": "count", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "owner", + "type": "address" + } + ], + "name": "addOwner", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "transactionId", + "type": "uint256" + } + ], + "name": "isConfirmed", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_secondsTimeLocked", + "type": "uint256" + } + ], + "name": "changeTimeLock", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "transactionId", + "type": "uint256" + } + ], + "name": "getConfirmationCount", + "outputs": [ + { + "name": "count", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "transactions", + "outputs": [ + { + "name": "destination", + "type": "address" + }, + { + "name": "value", + "type": "uint256" + }, + { + "name": "data", + "type": "bytes" + }, + { + "name": "executed", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getOwners", + "outputs": [ + { + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "from", + "type": "uint256" + }, + { + "name": "to", + "type": "uint256" + }, + { + "name": "pending", + "type": "bool" + }, + { + "name": "executed", + "type": "bool" + } + ], + "name": "getTransactionIds", + "outputs": [ + { + "name": "_transactionIds", + "type": "uint256[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "transactionId", + "type": "uint256" + } + ], + "name": "getConfirmations", + "outputs": [ + { + "name": "_confirmations", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "transactionCount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_required", + "type": "uint256" + } + ], + "name": "changeRequirement", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "transactionId", + "type": "uint256" + } + ], + "name": "confirmTransaction", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "destination", + "type": "address" + }, + { + "name": "value", + "type": "uint256" + }, + { + "name": "data", + "type": "bytes" + } + ], + "name": "submitTransaction", + "outputs": [ + { + "name": "transactionId", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "confirmationTimes", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "MAX_OWNER_COUNT", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "required", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "owner", + "type": "address" + }, + { + "name": "newOwner", + "type": "address" + } + ], + "name": "replaceOwner", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "transactionId", + "type": "uint256" + } + ], + "name": "executeTransaction", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "name": "_owners", + "type": "address[]" + }, + { + "name": "_required", + "type": "uint256" + }, + { + "name": "_secondsTimeLocked", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "transactionId", + "type": "uint256" + }, + { + "indexed": false, + "name": "confirmationTime", + "type": "uint256" + } + ], + "name": "ConfirmationTimeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "secondsTimeLocked", + "type": "uint256" + } + ], + "name": "TimeLockChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "name": "transactionId", + "type": "uint256" + } + ], + "name": "Confirmation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "name": "transactionId", + "type": "uint256" + } + ], + "name": "Revocation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "transactionId", + "type": "uint256" + } + ], + "name": "Submission", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "transactionId", + "type": "uint256" + } + ], + "name": "Execution", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "transactionId", + "type": "uint256" + } + ], + "name": "ExecutionFailure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "name": "value", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "owner", + "type": "address" + } + ], + "name": "OwnerAddition", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "owner", + "type": "address" + } + ], + "name": "OwnerRemoval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "required", + "type": "uint256" + } + ], + "name": "RequirementChange", + "type": "event" + } + ], + "bytecode": "0x60806040523480156200001157600080fd5b50604051620025af380380620025af8339810180604052810190808051820192919060200180519060200190929190805190602001909291905050508282600082518260328211806200006357508181115b806200006f5750600081145b806200007b5750600082145b156200008657600080fd5b600092505b8451831015620001bd57600260008685815181101515620000a857fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680620001345750600085848151811015156200011257fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff16145b156200013f57600080fd5b60016002600087868151811015156200015457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555082806001019350506200008b565b8460039080519060200190620001d5929190620001f2565b5083600481905550505050505080600681905550505050620002c7565b8280548282559060005260206000209081019282156200026e579160200282015b828111156200026d5782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509160200191906001019062000213565b5b5090506200027d919062000281565b5090565b620002c491905b80821115620002c057600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555060010162000288565b5090565b90565b6122d880620002d76000396000f30060806040526004361061013e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c2714610198578063173825d91461020557806320ea8d86146102485780632f54bf6e146102755780633411c81c146102d057806337bd78a01461033557806354741525146103605780637065cb48146103af578063784547a7146103f25780637ad28c51146104375780638b51d13f146104645780639ace38c2146104a5578063a0e67e2b14610590578063a8abe69a146105fc578063b5dc40c3146106a0578063b77bf60014610722578063ba51a6df1461074d578063c01a8c841461077a578063c6427474146107a7578063d38f2d821461084e578063d74f8edd1461088f578063dc8452cd146108ba578063e20056e6146108e5578063ee22610b14610948575b6000341115610196573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b3480156101a457600080fd5b506101c360048036038101908080359060200190929190505050610975565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561021157600080fd5b50610246600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109b3565b005b34801561025457600080fd5b5061027360048036038101908080359060200190929190505050610c4c565b005b34801561028157600080fd5b506102b6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e09565b604051808215151515815260200191505060405180910390f35b3480156102dc57600080fd5b5061031b60048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e29565b604051808215151515815260200191505060405180910390f35b34801561034157600080fd5b5061034a610e58565b6040518082815260200191505060405180910390f35b34801561036c57600080fd5b50610399600480360381019080803515159060200190929190803515159060200190929190505050610e5e565b6040518082815260200191505060405180910390f35b3480156103bb57600080fd5b506103f0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ef0565b005b3480156103fe57600080fd5b5061041d600480360381019080803590602001909291905050506110e9565b604051808215151515815260200191505060405180910390f35b34801561044357600080fd5b50610462600480360381019080803590602001909291905050506111ce565b005b34801561047057600080fd5b5061048f60048036038101908080359060200190929190505050611249565b6040518082815260200191505060405180910390f35b3480156104b157600080fd5b506104d060048036038101908080359060200190929190505050611314565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b83811015610552578082015181840152602081019050610537565b50505050905090810190601f16801561057f5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561059c57600080fd5b506105a5611409565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105e85780820151818401526020810190506105cd565b505050509050019250505060405180910390f35b34801561060857600080fd5b506106496004803603810190808035906020019092919080359060200190929190803515159060200190929190803515159060200190929190505050611497565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561068c578082015181840152602081019050610671565b505050509050019250505060405180910390f35b3480156106ac57600080fd5b506106cb60048036038101908080359060200190929190505050611608565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561070e5780820151818401526020810190506106f3565b505050509050019250505060405180910390f35b34801561072e57600080fd5b50610737611845565b6040518082815260200191505060405180910390f35b34801561075957600080fd5b506107786004803603810190808035906020019092919050505061184b565b005b34801561078657600080fd5b506107a5600480360381019080803590602001909291905050506118fd565b005b3480156107b357600080fd5b50610838600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611afd565b6040518082815260200191505060405180910390f35b34801561085a57600080fd5b5061087960048036038101908080359060200190929190505050611b1c565b6040518082815260200191505060405180910390f35b34801561089b57600080fd5b506108a4611b34565b6040518082815260200191505060405180910390f35b3480156108c657600080fd5b506108cf611b39565b6040518082815260200191505060405180910390f35b3480156108f157600080fd5b50610946600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b3f565b005b34801561095457600080fd5b5061097360048036038101908080359060200190929190505050611e52565b005b60038181548110151561098457fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109ef57600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610a4857600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610bcd578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610adb57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610bc0576003600160038054905003815481101515610b3957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610b7357fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610bcd565b8180600101925050610aa5565b6001600381818054905003915081610be591906121db565b506003805490506004541115610c0457610c0360038054905061184b565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610ca557600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610d1057600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff1615610d3e57600080fd5b84610d48816110e9565b151515610d5457600080fd5b60006001600088815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550853373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a3505050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60065481565b600080600090505b600554811015610ee957838015610e9d575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610ed05750828015610ecf575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610edc576001820191505b8080600101915050610e66565b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f2a57600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610f8257600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff161415610fa757600080fd5b6001600380549050016004546032821180610fc157508181115b80610fcc5750600081145b80610fd75750600082145b15610fe157600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038590806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b6003805490508110156111c65760016000858152602001908152602001600020600060038381548110151561112757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156111a6576001820191505b6004548214156111b957600192506111c7565b80806001019150506110f6565b5b5050919050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561120857600080fd5b806006819055507fd1c9101a34feff75cccef14a28785a0279cb0b49c1f321f21f5f422e746b4377816040518082815260200191505060405180910390a150565b600080600090505b60038054905081101561130e5760016000848152602001908152602001600020600060038381548110151561128257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611301576001820191505b8080600101915050611251565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156113ec5780601f106113c1576101008083540402835291602001916113ec565b820191906000526020600020905b8154815290600101906020018083116113cf57829003601f168201915b5050505050908060030160009054906101000a900460ff16905084565b6060600380548060200260200160405190810160405280929190818152602001828054801561148d57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611443575b5050505050905090565b6060806000806005546040519080825280602002602001820160405280156114ce5781602001602082028038833980820191505090505b50925060009150600090505b60055481101561157a57858015611511575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806115445750848015611543575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b1561156d5780838381518110151561155857fe5b90602001906020020181815250506001820191505b80806001019150506114da565b8787036040519080825280602002602001820160405280156115ab5781602001602082028038833980820191505090505b5093508790505b868110156115fd5782818151811015156115c857fe5b90602001906020020151848983038151811015156115e257fe5b906020019060200201818152505080806001019150506115b2565b505050949350505050565b6060806000806003805490506040519080825280602002602001820160405280156116425781602001602082028038833980820191505090505b50925060009150600090505b60038054905081101561178f5760016000868152602001908152602001600020600060038381548110151561167f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156117825760038181548110151561170657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16838381518110151561173f57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b808060010191505061164e565b816040519080825280602002602001820160405280156117be5781602001602082028038833980820191505090505b509350600090505b8181101561183d5782818151811015156117dc57fe5b9060200190602002015184828151811015156117f457fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505080806001019150506117c6565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561188557600080fd5b60038054905081603282118061189a57508181115b806118a55750600081145b806118b05750600082145b156118ba57600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561195657600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156119b057600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611a1a57600080fd5b84611a24816110e9565b151515611a3057600080fd5b600180600088815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550853373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a3611ae5866110e9565b15611af557611af48642612037565b5b505050505050565b6000611b0a84848461208b565b9050611b15816118fd565b9392505050565b60076020528060005260406000206000915090505481565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b7b57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611bd457600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611c2c57600080fd5b600092505b600380549050831015611d15578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611c6457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611d085783600384815481101515611cbb57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611d15565b8280600101935050611c31565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b60008160008082815260200190815260200160002060030160009054906101000a900460ff1615611e8257600080fd5b82611e8c816110e9565b1515611e9757600080fd5b836006546007600083815260200190815260200160002054014210151515611ebe57600080fd5b600080868152602001908152602001600020935060018460030160006101000a81548160ff0219169083151502179055508360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168460010154856002016040518082805460018160011615610100020316600290048015611f985780601f10611f6d57610100808354040283529160200191611f98565b820191906000526020600020905b815481529060010190602001808311611f7b57829003601f168201915b505091505060006040518083038185875af19250505015611fe557847f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2612030565b847f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008460030160006101000a81548160ff0219169083151502179055505b5050505050565b806007600084815260200190815260200160002081905550817f0b237afe65f1514fd7ea3f923ea4fe792bdd07000a912b6cd1602a8e7f573c8d826040518082815260200191505060405180910390a25050565b60008360008173ffffffffffffffffffffffffffffffffffffffff1614156120b257600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190612171929190612207565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b815481835581811115612202578183600052602060002091820191016122019190612287565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061224857805160ff1916838001178555612276565b82800160010185558215612276579182015b8281111561227557825182559160200191906001019061225a565b5b5090506122839190612287565b5090565b6122a991905b808211156122a557600081600090555060010161228d565b5090565b905600a165627a7a72305820aeb5a7eedfc8d07781104066dd2b65dd89d9c303a9e3d07fead227d3ec0e69d00029", + "runtime_bytecode": "0x60806040526004361061013e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c2714610198578063173825d91461020557806320ea8d86146102485780632f54bf6e146102755780633411c81c146102d057806337bd78a01461033557806354741525146103605780637065cb48146103af578063784547a7146103f25780637ad28c51146104375780638b51d13f146104645780639ace38c2146104a5578063a0e67e2b14610590578063a8abe69a146105fc578063b5dc40c3146106a0578063b77bf60014610722578063ba51a6df1461074d578063c01a8c841461077a578063c6427474146107a7578063d38f2d821461084e578063d74f8edd1461088f578063dc8452cd146108ba578063e20056e6146108e5578063ee22610b14610948575b6000341115610196573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b3480156101a457600080fd5b506101c360048036038101908080359060200190929190505050610975565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561021157600080fd5b50610246600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109b3565b005b34801561025457600080fd5b5061027360048036038101908080359060200190929190505050610c4c565b005b34801561028157600080fd5b506102b6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e09565b604051808215151515815260200191505060405180910390f35b3480156102dc57600080fd5b5061031b60048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e29565b604051808215151515815260200191505060405180910390f35b34801561034157600080fd5b5061034a610e58565b6040518082815260200191505060405180910390f35b34801561036c57600080fd5b50610399600480360381019080803515159060200190929190803515159060200190929190505050610e5e565b6040518082815260200191505060405180910390f35b3480156103bb57600080fd5b506103f0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ef0565b005b3480156103fe57600080fd5b5061041d600480360381019080803590602001909291905050506110e9565b604051808215151515815260200191505060405180910390f35b34801561044357600080fd5b50610462600480360381019080803590602001909291905050506111ce565b005b34801561047057600080fd5b5061048f60048036038101908080359060200190929190505050611249565b6040518082815260200191505060405180910390f35b3480156104b157600080fd5b506104d060048036038101908080359060200190929190505050611314565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b83811015610552578082015181840152602081019050610537565b50505050905090810190601f16801561057f5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561059c57600080fd5b506105a5611409565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105e85780820151818401526020810190506105cd565b505050509050019250505060405180910390f35b34801561060857600080fd5b506106496004803603810190808035906020019092919080359060200190929190803515159060200190929190803515159060200190929190505050611497565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561068c578082015181840152602081019050610671565b505050509050019250505060405180910390f35b3480156106ac57600080fd5b506106cb60048036038101908080359060200190929190505050611608565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561070e5780820151818401526020810190506106f3565b505050509050019250505060405180910390f35b34801561072e57600080fd5b50610737611845565b6040518082815260200191505060405180910390f35b34801561075957600080fd5b506107786004803603810190808035906020019092919050505061184b565b005b34801561078657600080fd5b506107a5600480360381019080803590602001909291905050506118fd565b005b3480156107b357600080fd5b50610838600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611afd565b6040518082815260200191505060405180910390f35b34801561085a57600080fd5b5061087960048036038101908080359060200190929190505050611b1c565b6040518082815260200191505060405180910390f35b34801561089b57600080fd5b506108a4611b34565b6040518082815260200191505060405180910390f35b3480156108c657600080fd5b506108cf611b39565b6040518082815260200191505060405180910390f35b3480156108f157600080fd5b50610946600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b3f565b005b34801561095457600080fd5b5061097360048036038101908080359060200190929190505050611e52565b005b60038181548110151561098457fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109ef57600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610a4857600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610bcd578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610adb57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610bc0576003600160038054905003815481101515610b3957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610b7357fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610bcd565b8180600101925050610aa5565b6001600381818054905003915081610be591906121db565b506003805490506004541115610c0457610c0360038054905061184b565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610ca557600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610d1057600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff1615610d3e57600080fd5b84610d48816110e9565b151515610d5457600080fd5b60006001600088815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550853373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a3505050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60065481565b600080600090505b600554811015610ee957838015610e9d575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610ed05750828015610ecf575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610edc576001820191505b8080600101915050610e66565b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f2a57600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610f8257600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff161415610fa757600080fd5b6001600380549050016004546032821180610fc157508181115b80610fcc5750600081145b80610fd75750600082145b15610fe157600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038590806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b6003805490508110156111c65760016000858152602001908152602001600020600060038381548110151561112757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156111a6576001820191505b6004548214156111b957600192506111c7565b80806001019150506110f6565b5b5050919050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561120857600080fd5b806006819055507fd1c9101a34feff75cccef14a28785a0279cb0b49c1f321f21f5f422e746b4377816040518082815260200191505060405180910390a150565b600080600090505b60038054905081101561130e5760016000848152602001908152602001600020600060038381548110151561128257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611301576001820191505b8080600101915050611251565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156113ec5780601f106113c1576101008083540402835291602001916113ec565b820191906000526020600020905b8154815290600101906020018083116113cf57829003601f168201915b5050505050908060030160009054906101000a900460ff16905084565b6060600380548060200260200160405190810160405280929190818152602001828054801561148d57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611443575b5050505050905090565b6060806000806005546040519080825280602002602001820160405280156114ce5781602001602082028038833980820191505090505b50925060009150600090505b60055481101561157a57858015611511575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806115445750848015611543575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b1561156d5780838381518110151561155857fe5b90602001906020020181815250506001820191505b80806001019150506114da565b8787036040519080825280602002602001820160405280156115ab5781602001602082028038833980820191505090505b5093508790505b868110156115fd5782818151811015156115c857fe5b90602001906020020151848983038151811015156115e257fe5b906020019060200201818152505080806001019150506115b2565b505050949350505050565b6060806000806003805490506040519080825280602002602001820160405280156116425781602001602082028038833980820191505090505b50925060009150600090505b60038054905081101561178f5760016000868152602001908152602001600020600060038381548110151561167f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156117825760038181548110151561170657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16838381518110151561173f57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b808060010191505061164e565b816040519080825280602002602001820160405280156117be5781602001602082028038833980820191505090505b509350600090505b8181101561183d5782818151811015156117dc57fe5b9060200190602002015184828151811015156117f457fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505080806001019150506117c6565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561188557600080fd5b60038054905081603282118061189a57508181115b806118a55750600081145b806118b05750600082145b156118ba57600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561195657600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156119b057600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611a1a57600080fd5b84611a24816110e9565b151515611a3057600080fd5b600180600088815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550853373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a3611ae5866110e9565b15611af557611af48642612037565b5b505050505050565b6000611b0a84848461208b565b9050611b15816118fd565b9392505050565b60076020528060005260406000206000915090505481565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b7b57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611bd457600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611c2c57600080fd5b600092505b600380549050831015611d15578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611c6457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611d085783600384815481101515611cbb57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611d15565b8280600101935050611c31565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b60008160008082815260200190815260200160002060030160009054906101000a900460ff1615611e8257600080fd5b82611e8c816110e9565b1515611e9757600080fd5b836006546007600083815260200190815260200160002054014210151515611ebe57600080fd5b600080868152602001908152602001600020935060018460030160006101000a81548160ff0219169083151502179055508360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168460010154856002016040518082805460018160011615610100020316600290048015611f985780601f10611f6d57610100808354040283529160200191611f98565b820191906000526020600020905b815481529060010190602001808311611f7b57829003601f168201915b505091505060006040518083038185875af19250505015611fe557847f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2612030565b847f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008460030160006101000a81548160ff0219169083151502179055505b5050505050565b806007600084815260200190815260200160002081905550817f0b237afe65f1514fd7ea3f923ea4fe792bdd07000a912b6cd1602a8e7f573c8d826040518082815260200191505060405180910390a25050565b60008360008173ffffffffffffffffffffffffffffffffffffffff1614156120b257600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190612171929190612207565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b815481835581811115612202578183600052602060002091820191016122019190612287565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061224857805160ff1916838001178555612276565b82800160010185558215612276579182015b8281111561227557825182559160200191906001019061225a565b5b5090506122839190612287565b5090565b6122a991905b808211156122a557600081600090555060010161228d565b5090565b905600a165627a7a72305820aeb5a7eedfc8d07781104066dd2b65dd89d9c303a9e3d07fead227d3ec0e69d00029", + "updated_at": 1525776880463, + "source_map": "855:3594:1:-;;;1904:213;8:9:-1;5:2;;;30:1;27;20:12;5:2;1904:213:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2038:7;2047:9;2959:6:0;2913:7;:14;2929:9;256:2;2236:10;:28;:66;;;;2292:10;2280:9;:22;2236:66;:96;;;;2331:1;2318:9;:14;2236:96;:127;;;;2362:1;2348:10;:15;2236:127;2229:153;;;2377:5;;;2229:153;2966:1;2959:8;;2954:168;2971:7;:14;2969:1;:16;2954:168;;;3010:7;:19;3018:7;3026:1;3018:10;;;;;;;;;;;;;;;;;;3010:19;;;;;;;;;;;;;;;;;;;;;;;;;:38;;;;3047:1;3033:7;3041:1;3033:10;;;;;;;;;;;;;;;;;;:15;;;3010:38;3006:65;;;3066:5;;;3006:65;3107:4;3085:7;:19;3093:7;3101:1;3093:10;;;;;;;;;;;;;;;;;;3085:19;;;;;;;;;;;;;;;;:26;;;;;;;;;;;;;;;;;;2987:3;;;;;;;2954:168;;;3140:7;3131:6;:16;;;;;;;;;;;;:::i;:::-;;3168:9;3157:8;:20;;;;2814:370;;;;;2092:18:1;2072:17;:38;;;;1904:213;;;855:3594;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;", + "source_map_runtime": "855:3594:1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2519:1:0;2507:9;:13;2503:61;;;2542:10;2534:30;;;2554:9;2534:30;;;;;;;;;;;;;;;;;;2503:61;855:3594:1;936:23:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;936:23:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3711:460;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3711:460:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;3196:332:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3196:332:1;;;;;;;;;;;;;;;;;;;;;;;;;;890:40:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;890:40:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;820:64;;8:9:-1;5:2;;;30:1;27;20:12;5:2;820:64:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1049:29:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1049:29:1;;;;;;;;;;;;;;;;;;;;;;;9136:319:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;9136:319:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3311:277;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3311:277:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;7304:337;;8:9:-1;5:2;;;30:1;27;20:12;5:2;7304:337:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2321:186:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2321:186:1;;;;;;;;;;;;;;;;;;;;;;;;;;8622:252:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;8622:252:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;765:49;;8:9:-1;5:2;;;30:1;27;20:12;5:2;765:49:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;765:49:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9539:115;;8:9:-1;5:2;;;30:1;27;20:12;5:2;9539:115:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;9539:115:0;;;;;;;;;;;;;;;;;10757:676;;8:9:-1;5:2;;;30:1;27;20:12;5:2;10757:676:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;10757:676:0;;;;;;;;;;;;;;;;;9833:575;;8:9:-1;5:2;;;30:1;27;20:12;5:2;9833:575:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;9833:575:0;;;;;;;;;;;;;;;;;991:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;991:28:0;;;;;;;;;;;;;;;;;;;;;;;4990:207;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4990:207:0;;;;;;;;;;;;;;;;;;;;;;;;;;2613:459:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2613:459:1;;;;;;;;;;;;;;;;;;;;;;;;;;5456:244:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;5456:244:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1085:47:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1085:47:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;217:41:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;217:41:0;;;;;;;;;;;;;;;;;;;;;;;965:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;965:20:0;;;;;;;;;;;;;;;;;;;;;;;4370:449;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4370:449:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3642:472:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3642:472:1;;;;;;;;;;;;;;;;;;;;;;;;;;936:23:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;3711:460::-;3859:6;1208:4;1186:27;;:10;:27;;;;1182:50;;;1227:5;;;1182:50;3801:5;1420:7;:14;1428:5;1420:14;;;;;;;;;;;;;;;;;;;;;;;;;1419:15;1415:38;;;1448:5;;;1415:38;3839:5;3822:7;:14;3830:5;3822:14;;;;;;;;;;;;;;;;:22;;;;;;;;;;;;;;;;;;3866:1;3859:8;;3854:170;3887:1;3871:6;:13;;;;:17;3869:1;:19;3854:170;;;3924:5;3911:18;;:6;3918:1;3911:9;;;;;;;;;;;;;;;;;;;;;;;;;;;:18;;;3907:117;;;3961:6;3984:1;3968:6;:13;;;;:17;3961:25;;;;;;;;;;;;;;;;;;;;;;;;;;;3949:6;3956:1;3949:9;;;;;;;;;;;;;;;;;;:37;;;;;;;;;;;;;;;;;;4004:5;;3907:117;3890:3;;;;;;;3854:170;;;4050:1;4033:6;:18;;;;;;;;;;;;;;:::i;:::-;;4076:6;:13;;;;4065:8;;:24;4061:74;;;4103:32;4121:6;:13;;;;4103:17;:32::i;:::-;4061:74;4158:5;4145:19;;;;;;;;;;;;1242:1;3711:460;;:::o;3196:332:1:-;3279:10;1420:7:0;:14;1428:5;1420:14;;;;;;;;;;;;;;;;;;;;;;;;;1419:15;1415:38;;;1448:5;;;1415:38;3309:13:1;3324:10;1694:13:0;:28;1708:13;1694:28;;;;;;;;;;;:35;1723:5;1694:35;;;;;;;;;;;;;;;;;;;;;;;;;1693:36;1689:59;;;1743:5;;;1689:59;3356:13:1;1976:12:0;:27;1989:13;1976:27;;;;;;;;;;;:36;;;;;;;;;;;;1972:59;;;2026:5;;;1972:59;3397:13:1;1205:26;1217:13;1205:11;:26::i;:::-;1204:27;1196:36;;;;;;;;3469:5;3426:13;:28;3440:13;3426:28;;;;;;;;;;;:40;3455:10;3426:40;;;;;;;;;;;;;;;;:48;;;;;;;;;;;;;;;;;;3507:13;3495:10;3484:37;;;;;;;;;;;;2041:1:0;1758;1463;;3196:332:1;;:::o;890:40:0:-;;;;;;;;;;;;;;;;;;;;;;:::o;820:64::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;1049:29:1:-;;;;:::o;9136:319:0:-;9243:10;9274:6;9281:1;9274:8;;9269:179;9286:16;;9284:1;:18;9269:179;;;9328:7;:36;;;;;9340:12;:15;9353:1;9340:15;;;;;;;;;;;:24;;;;;;;;;;;;9339:25;9328:36;:92;;;;9384:8;:36;;;;;9396:12;:15;9409:1;9396:15;;;;;;;;;;;:24;;;;;;;;;;;;9384:36;9328:92;9321:127;;;9447:1;9438:10;;;;9321:127;9304:3;;;;;;;9269:179;;;9136:319;;;;;:::o;3311:277::-;1208:4;1186:27;;:10;:27;;;;1182:50;;;1227:5;;;1182:50;3404:5;1312:7;:14;1320:5;1312:14;;;;;;;;;;;;;;;;;;;;;;;;;1308:37;;;1340:5;;;1308:37;3427:5;2116:1;2104:8;:13;;;2100:36;;;2131:5;;;2100:36;3475:1;3459:6;:13;;;;:17;3478:8;;256:2;2236:10;:28;:66;;;;2292:10;2280:9;:22;2236:66;:96;;;;2331:1;2318:9;:14;2236:96;:127;;;;2362:1;2348:10;:15;2236:127;2229:153;;;2377:5;;;2229:153;3519:4;3502:7;:14;3510:5;3502:14;;;;;;;;;;;;;;;;:21;;;;;;;;;;;;;;;;;;3533:6;3545:5;3533:18;;39:1:-1;33:3;27:10;23:18;57:10;52:3;45:23;79:10;72:17;;0:93;3533:18:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3575:5;3561:20;;;;;;;;;;;;2146:1;;1355;1242;3311:277;:::o;7304:337::-;7394:4;7414:10;7443:6;7427:1;7414:14;;7450:1;7443:8;;7438:197;7455:6;:13;;;;7453:1;:15;7438:197;;;7493:13;:28;7507:13;7493:28;;;;;;;;;;;:39;7522:6;7529:1;7522:9;;;;;;;;;;;;;;;;;;;;;;;;;;;7493:39;;;;;;;;;;;;;;;;;;;;;;;;;7489:71;;;7559:1;7550:10;;;;7489:71;7587:8;;7578:5;:17;7574:50;;;7620:4;7613:11;;;;7574:50;7470:3;;;;;;;7438:197;;;7304:337;;;;;;:::o;2321:186:1:-;1208:4:0;1186:27;;:10;:27;;;;1182:50;;;1227:5;;;1182:50;2438:18:1;2418:17;:38;;;;2466:34;2481:18;2466:34;;;;;;;;;;;;;;;;;;2321:186;:::o;8622:252:0:-;8721:10;8752:6;8759:1;8752:8;;8747:120;8764:6;:13;;;;8762:1;:15;8747:120;;;8800:13;:28;8814:13;8800:28;;;;;;;;;;;:39;8829:6;8836:1;8829:9;;;;;;;;;;;;;;;;;;;;;;;;;;;8800:39;;;;;;;;;;;;;;;;;;;;;;;;;8796:71;;;8866:1;8857:10;;;;8796:71;8779:3;;;;;;;8747:120;;;8622:252;;;;:::o;765:49::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;9539:115::-;9609:9;9641:6;9634:13;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9539:115;:::o;10757:676::-;10882:22;10920:32;10993:10;11017:6;10966:16;;10955:28;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;10955:28:0;;;;10920:63;;11006:1;10993:14;;11040:1;11038:3;;11033:250;11045:16;;11043:1;:18;11033:250;;;11087:7;:36;;;;;11099:12;:15;11112:1;11099:15;;;;;;;;;;;:24;;;;;;;;;;;;11098:25;11087:36;:92;;;;11143:8;:36;;;;;11155:12;:15;11168:1;11155:15;;;;;;;;;;;:24;;;;;;;;;;;;11143:36;11087:92;11080:203;;;11239:1;11211:18;11230:5;11211:25;;;;;;;;;;;;;;;;;:29;;;;;11267:1;11258:10;;;;11080:203;11063:3;;;;;;;11033:250;;;11326:4;11321:2;:9;11310:21;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;11310:21:0;;;;11292:39;;11348:4;11346:6;;11341:85;11356:2;11354:1;:4;11341:85;;;11405:18;11424:1;11405:21;;;;;;;;;;;;;;;;;;11377:15;11397:4;11393:1;:8;11377:25;;;;;;;;;;;;;;;;;:49;;;;;11360:3;;;;;;;11341:85;;;10757:676;;;;;;;;;:::o;9833:575::-;9928:24;9968:34;10043:10;10067:6;10019;:13;;;;10005:28;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;10005:28:0;;;;9968:65;;10056:1;10043:14;;10090:1;10088:3;;10083:186;10095:6;:13;;;;10093:1;:15;10083:186;;;10131:13;:28;10145:13;10131:28;;;;;;;;;;;:39;10160:6;10167:1;10160:9;;;;;;;;;;;;;;;;;;;;;;;;;;;10131:39;;;;;;;;;;;;;;;;;;;;;;;;;10127:142;;;10217:6;10224:1;10217:9;;;;;;;;;;;;;;;;;;;;;;;;;;;10190:17;10208:5;10190:24;;;;;;;;;;;;;;;;;:36;;;;;;;;;;;10253:1;10244:10;;;;10127:142;10110:3;;;;;;;10083:186;;;10309:5;10295:20;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;10295:20:0;;;;10278:37;;10332:1;10330:3;;10325:76;10337:5;10335:1;:7;10325:76;;;10381:17;10399:1;10381:20;;;;;;;;;;;;;;;;;;10361:14;10376:1;10361:17;;;;;;;;;;;;;;;;;:40;;;;;;;;;;;10344:3;;;;;;;10325:76;;;9833:575;;;;;;:::o;991:28::-;;;;:::o;4990:207::-;1208:4;1186:27;;:10;:27;;;;1182:50;;;1227:5;;;1182:50;5092:6;:13;;;;5107:9;256:2;2236:10;:28;:66;;;;2292:10;2280:9;:22;2236:66;:96;;;;2331:1;2318:9;:14;2236:96;:127;;;;2362:1;2348:10;:15;2236:127;2229:153;;;2377:5;;;2229:153;5143:9;5132:8;:20;;;;5162:28;5180:9;5162:28;;;;;;;;;;;;;;;;;;1242:1;;4990:207;:::o;2613:459:1:-;2696:10;1420:7:0;:14;1428:5;1420:14;;;;;;;;;;;;;;;;;;;;;;;;;1419:15;1415:38;;;1448:5;;;1415:38;2734:13:1;1581:1:0;1538:12;:27;1551:13;1538:27;;;;;;;;;;;:39;;;;;;;;;;;;:44;;;1534:67;;;1596:5;;;1534:67;2770:13:1;2785:10;1843:13:0;:28;1857:13;1843:28;;;;;;;;;;;:35;1872:5;1843:35;;;;;;;;;;;;;;;;;;;;;;;;;1839:58;;;1892:5;;;1839:58;2823:13:1;1205:26;1217:13;1205:11;:26::i;:::-;1204:27;1196:36;;;;;;;;2895:4;2852:13;:28;2866:13;2852:28;;;;;;;;;;;:40;2881:10;2852:40;;;;;;;;;;;;;;;;:47;;;;;;;;;;;;;;;;;;2934:13;2922:10;2909:39;;;;;;;;;;;;2962:26;2974:13;2962:11;:26::i;:::-;2958:108;;;3004:51;3024:13;3039:15;3004:19;:51::i;:::-;2958:108;1907:1:0;1611;;1463;2613:459:1;;:::o;5456:244:0:-;5560:18;5610:40;5625:11;5638:5;5645:4;5610:14;:40::i;:::-;5594:56;;5660:33;5679:13;5660:18;:33::i;:::-;5456:244;;;;;:::o;1085:47:1:-;;;;;;;;;;;;;;;;;:::o;217:41:0:-;256:2;217:41;:::o;965:20::-;;;;:::o;4370:449::-;4541:6;1208:4;1186:27;;:10;:27;;;;1182:50;;;1227:5;;;1182:50;4479:5;1420:7;:14;1428:5;1420:14;;;;;;;;;;;;;;;;;;;;;;;;;1419:15;1415:38;;;1448:5;;;1415:38;4512:8;1312:7;:14;1320:5;1312:14;;;;;;;;;;;;;;;;;;;;;;;;;1308:37;;;1340:5;;;1308:37;4548:1;4541:8;;4536:149;4553:6;:13;;;;4551:1;:15;4536:149;;;4602:5;4589:18;;:6;4596:1;4589:9;;;;;;;;;;;;;;;;;;;;;;;;;;;:18;;;4585:100;;;4639:8;4627:6;4634:1;4627:9;;;;;;;;;;;;;;;;;;:20;;;;;;;;;;;;;;;;;;4665:5;;4585:100;4568:3;;;;;;;4536:149;;;4711:5;4694:7;:14;4702:5;4694:14;;;;;;;;;;;;;;;;:22;;;;;;;;;;;;;;;;;;4746:4;4726:7;:17;4734:8;4726:17;;;;;;;;;;;;;;;;:24;;;;;;;;;;;;;;;;;;4773:5;4760:19;;;;;;;;;;;;4803:8;4789:23;;;;;;;;;;;;1463:1;1242;4370:449;;;:::o;3642:472:1:-;3828:22;3725:13;1976:12:0;:27;1989:13;1976:27;;;;;;;;;;;:36;;;;;;;;;;;;1972:59;;;2026:5;;;1972:59;3763:13:1;1318:26;1330:13;1318:11;:26::i;:::-;1310:35;;;;;;;;3799:13;1483:17;;1448;:32;1466:13;1448:32;;;;;;;;;;;;:52;1429:15;:71;;1421:80;;;;;;;;3853:12;:27;3866:13;3853:27;;;;;;;;;;;3828:52;;3904:4;3890:2;:11;;;:18;;;;;;;;;;;;;;;;;;3922:2;:14;;;;;;;;;;;;:19;;3948:2;:8;;;3958:2;:7;;3922:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3918:190;;;3990:13;3980:24;;;;;;;;;;3918:190;;;4050:13;4033:31;;;;;;;;;;4092:5;4078:2;:11;;;:19;;;;;;;;;;;;;;;;;;3918:190;1355:1;2041::0;3642:472:1;;;:::o;4224:223::-;4362:16;4327:17;:32;4345:13;4327:32;;;;;;;;;;;:51;;;;4408:13;4388:52;4423:16;4388:52;;;;;;;;;;;;;;;;;;4224:223;;:::o;7974:451:0:-;8106:18;8076:11;2116:1;2104:8;:13;;;2100:36;;;2131:5;;;2100:36;8156:16;;8140:32;;8212:140;;;;;;;;;8251:11;8212:140;;;;;;8283:5;8212:140;;;;8308:4;8212:140;;;;8336:5;8212:140;;;;;8182:12;:27;8195:13;8182:27;;;;;;;;;;;:170;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8382:1;8362:16;;:21;;;;;;;;;;;8404:13;8393:25;;;;;;;;;;7974:451;;;;;;:::o;855:3594:1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", + "sources": [ + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/multisig/MultiSigWallet/MultiSigWallet.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/multisig/MultiSigWalletWithTimeLock/MultiSigWalletWithTimeLock.sol" + ] + } + } +}
\ No newline at end of file diff --git a/packages/contract-wrappers/test/artifacts/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.json b/packages/contract-wrappers/test/artifacts/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.json new file mode 100644 index 000000000..3489c4362 --- /dev/null +++ b/packages/contract-wrappers/test/artifacts/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.json @@ -0,0 +1,684 @@ +{ + "contract_name": "MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress", + "networks": { + "50": { + "solc_version": "0.4.23", + "source_tree_hash": "0x22f98f4bdfb835e87b3541309d2163fc6ef5da91bf84f4304b9b1052c93dfb0d", + "optimizer_enabled": false, + "abi": [ + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "owners", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "owner", + "type": "address" + } + ], + "name": "removeOwner", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "transactionId", + "type": "uint256" + } + ], + "name": "revokeConfirmation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "isOwner", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + }, + { + "name": "", + "type": "address" + } + ], + "name": "confirmations", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "secondsTimeLocked", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "pending", + "type": "bool" + }, + { + "name": "executed", + "type": "bool" + } + ], + "name": "getTransactionCount", + "outputs": [ + { + "name": "count", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "data", + "type": "bytes" + } + ], + "name": "isFunctionRemoveAuthorizedAddress", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "transactionId", + "type": "uint256" + } + ], + "name": "executeRemoveAuthorizedAddress", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "owner", + "type": "address" + } + ], + "name": "addOwner", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "transactionId", + "type": "uint256" + } + ], + "name": "isConfirmed", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_secondsTimeLocked", + "type": "uint256" + } + ], + "name": "changeTimeLock", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "transactionId", + "type": "uint256" + } + ], + "name": "getConfirmationCount", + "outputs": [ + { + "name": "count", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "transactions", + "outputs": [ + { + "name": "destination", + "type": "address" + }, + { + "name": "value", + "type": "uint256" + }, + { + "name": "data", + "type": "bytes" + }, + { + "name": "executed", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getOwners", + "outputs": [ + { + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "from", + "type": "uint256" + }, + { + "name": "to", + "type": "uint256" + }, + { + "name": "pending", + "type": "bool" + }, + { + "name": "executed", + "type": "bool" + } + ], + "name": "getTransactionIds", + "outputs": [ + { + "name": "_transactionIds", + "type": "uint256[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "TOKEN_TRANSFER_PROXY_CONTRACT", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "transactionId", + "type": "uint256" + } + ], + "name": "getConfirmations", + "outputs": [ + { + "name": "_confirmations", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "transactionCount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_required", + "type": "uint256" + } + ], + "name": "changeRequirement", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "transactionId", + "type": "uint256" + } + ], + "name": "confirmTransaction", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "destination", + "type": "address" + }, + { + "name": "value", + "type": "uint256" + }, + { + "name": "data", + "type": "bytes" + } + ], + "name": "submitTransaction", + "outputs": [ + { + "name": "transactionId", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "confirmationTimes", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "MAX_OWNER_COUNT", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "required", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "owner", + "type": "address" + }, + { + "name": "newOwner", + "type": "address" + } + ], + "name": "replaceOwner", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "transactionId", + "type": "uint256" + } + ], + "name": "executeTransaction", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "name": "_owners", + "type": "address[]" + }, + { + "name": "_required", + "type": "uint256" + }, + { + "name": "_secondsTimeLocked", + "type": "uint256" + }, + { + "name": "_tokenTransferProxy", + "type": "address" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "transactionId", + "type": "uint256" + }, + { + "indexed": false, + "name": "confirmationTime", + "type": "uint256" + } + ], + "name": "ConfirmationTimeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "secondsTimeLocked", + "type": "uint256" + } + ], + "name": "TimeLockChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "name": "transactionId", + "type": "uint256" + } + ], + "name": "Confirmation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "name": "transactionId", + "type": "uint256" + } + ], + "name": "Revocation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "transactionId", + "type": "uint256" + } + ], + "name": "Submission", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "transactionId", + "type": "uint256" + } + ], + "name": "Execution", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "transactionId", + "type": "uint256" + } + ], + "name": "ExecutionFailure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "name": "value", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "owner", + "type": "address" + } + ], + "name": "OwnerAddition", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "owner", + "type": "address" + } + ], + "name": "OwnerRemoval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "required", + "type": "uint256" + } + ], + "name": "RequirementChange", + "type": "event" + } + ], + "bytecode": "0x60806040523480156200001157600080fd5b5060405162002b9038038062002b90833981018060405281019080805182019291906020018051906020019092919080519060200190929190805190602001909291905050508383838282600082518260328211806200007057508181115b806200007c5750600081145b80620000885750600082145b156200009357600080fd5b600092505b8451831015620001ca57600260008685815181101515620000b557fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680620001415750600085848151811015156200011f57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff16145b156200014c57600080fd5b60016002600087868151811015156200016157fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550828060010193505062000098565b8460039080519060200190620001e292919062000244565b508360048190555050505050508060068190555050505080600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505062000319565b828054828255906000526020600020908101928215620002c0579160200282015b82811115620002bf5782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509160200191906001019062000265565b5b509050620002cf9190620002d3565b5090565b6200031691905b808211156200031257600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550600101620002da565b5090565b90565b61286780620003296000396000f30060806040526004361061015f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c27146101b9578063173825d91461022657806320ea8d86146102695780632f54bf6e146102965780633411c81c146102f157806337bd78a0146103565780635474152514610381578063553a48fd146103d05780635711b311146104515780637065cb481461047e578063784547a7146104c15780637ad28c51146105065780638b51d13f146105335780639ace38c214610574578063a0e67e2b1461065f578063a8abe69a146106cb578063add1cbc51461076f578063b5dc40c3146107c6578063b77bf60014610848578063ba51a6df14610873578063c01a8c84146108a0578063c6427474146108cd578063d38f2d8214610974578063d74f8edd146109b5578063dc8452cd146109e0578063e20056e614610a0b578063ee22610b14610a6e575b60003411156101b7573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b3480156101c557600080fd5b506101e460048036038101908080359060200190929190505050610a9b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561023257600080fd5b50610267600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ad9565b005b34801561027557600080fd5b5061029460048036038101908080359060200190929190505050610d72565b005b3480156102a257600080fd5b506102d7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f2f565b604051808215151515815260200191505060405180910390f35b3480156102fd57600080fd5b5061033c60048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f4f565b604051808215151515815260200191505060405180910390f35b34801561036257600080fd5b5061036b610f7e565b6040518082815260200191505060405180910390f35b34801561038d57600080fd5b506103ba600480360381019080803515159060200190929190803515159060200190929190505050610f84565b6040518082815260200191505060405180910390f35b3480156103dc57600080fd5b50610437600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611016565b604051808215151515815260200191505060405180910390f35b34801561045d57600080fd5b5061047c60048036038101908080359060200190929190505050611153565b005b34801561048a57600080fd5b506104bf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611459565b005b3480156104cd57600080fd5b506104ec60048036038101908080359060200190929190505050611652565b604051808215151515815260200191505060405180910390f35b34801561051257600080fd5b5061053160048036038101908080359060200190929190505050611737565b005b34801561053f57600080fd5b5061055e600480360381019080803590602001909291905050506117b2565b6040518082815260200191505060405180910390f35b34801561058057600080fd5b5061059f6004803603810190808035906020019092919050505061187d565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b83811015610621578082015181840152602081019050610606565b50505050905090810190601f16801561064e5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561066b57600080fd5b50610674611972565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106b757808201518184015260208101905061069c565b505050509050019250505060405180910390f35b3480156106d757600080fd5b506107186004803603810190808035906020019092919080359060200190929190803515159060200190929190803515159060200190929190505050611a00565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561075b578082015181840152602081019050610740565b505050509050019250505060405180910390f35b34801561077b57600080fd5b50610784611b71565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156107d257600080fd5b506107f160048036038101908080359060200190929190505050611b97565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610834578082015181840152602081019050610819565b505050509050019250505060405180910390f35b34801561085457600080fd5b5061085d611dd4565b6040518082815260200191505060405180910390f35b34801561087f57600080fd5b5061089e60048036038101908080359060200190929190505050611dda565b005b3480156108ac57600080fd5b506108cb60048036038101908080359060200190929190505050611e8c565b005b3480156108d957600080fd5b5061095e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061208c565b6040518082815260200191505060405180910390f35b34801561098057600080fd5b5061099f600480360381019080803590602001909291905050506120ab565b6040518082815260200191505060405180910390f35b3480156109c157600080fd5b506109ca6120c3565b6040518082815260200191505060405180910390f35b3480156109ec57600080fd5b506109f56120c8565b6040518082815260200191505060405180910390f35b348015610a1757600080fd5b50610a6c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506120ce565b005b348015610a7a57600080fd5b50610a99600480360381019080803590602001909291905050506123e1565b005b600381815481101515610aaa57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b1557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610b6e57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610cf3578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610c0157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610ce6576003600160038054905003815481101515610c5f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610c9957fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cf3565b8180600101925050610bcb565b6001600381818054905003915081610d0b919061276a565b506003805490506004541115610d2a57610d29600380549050611dda565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610dcb57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610e3657600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff1615610e6457600080fd5b84610e6e81611652565b151515610e7a57600080fd5b60006001600088815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550853373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a3505050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60065481565b600080600090505b60055481101561100f57838015610fc3575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610ff65750828015610ff5575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15611002576001820191505b8080600101915050610f8c565b5092915050565b600080600060405180807f72656d6f7665417574686f72697a656441646472657373286164647265737329815250602001905060405180910390209150600090505b600481101561114857818160048110151561106f57fe5b1a7f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191684828151811015156110c257fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614151561113b57600080fd5b8080600101915050611058565b600192505050919050565b60008160008082815260200190815260200160002060030160009054906101000a900460ff161561118357600080fd5b8261118d81611652565b151561119857600080fd5b8360008060008381526020019081526020016000209050600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561122f57600080fd5b6112d4816002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112ca5780601f1061129f576101008083540402835291602001916112ca565b820191906000526020600020905b8154815290600101906020018083116112ad57829003601f168201915b5050505050611016565b15156112df57600080fd5b600080878152602001908152602001600020945060018560030160006101000a81548160ff0219169083151502179055508460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1685600101548660020160405180828054600181600116156101000203166002900480156113b95780601f1061138e576101008083540402835291602001916113b9565b820191906000526020600020905b81548152906001019060200180831161139c57829003601f168201915b505091505060006040518083038185875af1925050501561140657857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2611451565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008560030160006101000a81548160ff0219169083151502179055505b505050505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561149357600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156114eb57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff16141561151057600080fd5b600160038054905001600454603282118061152a57508181115b806115355750600081145b806115405750600082145b1561154a57600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038590806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b60038054905081101561172f5760016000858152602001908152602001600020600060038381548110151561169057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561170f576001820191505b6004548214156117225760019250611730565b808060010191505061165f565b5b5050919050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561177157600080fd5b806006819055507fd1c9101a34feff75cccef14a28785a0279cb0b49c1f321f21f5f422e746b4377816040518082815260200191505060405180910390a150565b600080600090505b600380549050811015611877576001600084815260200190815260200160002060006003838154811015156117eb57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561186a576001820191505b80806001019150506117ba565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156119555780601f1061192a57610100808354040283529160200191611955565b820191906000526020600020905b81548152906001019060200180831161193857829003601f168201915b5050505050908060030160009054906101000a900460ff16905084565b606060038054806020026020016040519081016040528092919081815260200182805480156119f657602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116119ac575b5050505050905090565b606080600080600554604051908082528060200260200182016040528015611a375781602001602082028038833980820191505090505b50925060009150600090505b600554811015611ae357858015611a7a575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80611aad5750848015611aac575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15611ad657808383815181101515611ac157fe5b90602001906020020181815250506001820191505b8080600101915050611a43565b878703604051908082528060200260200182016040528015611b145781602001602082028038833980820191505090505b5093508790505b86811015611b66578281815181101515611b3157fe5b9060200190602002015184898303815181101515611b4b57fe5b90602001906020020181815250508080600101915050611b1b565b505050949350505050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606080600080600380549050604051908082528060200260200182016040528015611bd15781602001602082028038833980820191505090505b50925060009150600090505b600380549050811015611d1e57600160008681526020019081526020016000206000600383815481101515611c0e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611d1157600381815481101515611c9557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168383815181101515611cce57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b8080600101915050611bdd565b81604051908082528060200260200182016040528015611d4d5781602001602082028038833980820191505090505b509350600090505b81811015611dcc578281815181101515611d6b57fe5b906020019060200201518482815181101515611d8357fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611d55565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e1457600080fd5b600380549050816032821180611e2957508181115b80611e345750600081145b80611e3f5750600082145b15611e4957600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611ee557600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611f3f57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611fa957600080fd5b84611fb381611652565b151515611fbf57600080fd5b600180600088815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550853373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361207486611652565b156120845761208386426125c6565b5b505050505050565b600061209984848461261a565b90506120a481611e8c565b9392505050565b60076020528060005260406000206000915090505481565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561210a57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561216357600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156121bb57600080fd5b600092505b6003805490508310156122a4578473ffffffffffffffffffffffffffffffffffffffff166003848154811015156121f357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415612297578360038481548110151561224a57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506122a4565b82806001019350506121c0565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b60008160008082815260200190815260200160002060030160009054906101000a900460ff161561241157600080fd5b8261241b81611652565b151561242657600080fd5b83600654600760008381526020019081526020016000205401421015151561244d57600080fd5b600080868152602001908152602001600020935060018460030160006101000a81548160ff0219169083151502179055508360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1684600101548560020160405180828054600181600116156101000203166002900480156125275780601f106124fc57610100808354040283529160200191612527565b820191906000526020600020905b81548152906001019060200180831161250a57829003601f168201915b505091505060006040518083038185875af1925050501561257457847f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a26125bf565b847f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008460030160006101000a81548160ff0219169083151502179055505b5050505050565b806007600084815260200190815260200160002081905550817f0b237afe65f1514fd7ea3f923ea4fe792bdd07000a912b6cd1602a8e7f573c8d826040518082815260200191505060405180910390a25050565b60008360008173ffffffffffffffffffffffffffffffffffffffff16141561264157600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190612700929190612796565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b815481835581811115612791578183600052602060002091820191016127909190612816565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106127d757805160ff1916838001178555612805565b82800160010185558215612805579182015b828111156128045782518255916020019190600101906127e9565b5b5090506128129190612816565b5090565b61283891905b8082111561283457600081600090555060010161281c565b5090565b905600a165627a7a723058208fb04dd2ea83d777b56d0e2215974a355cbef67a7f12311e46776fad4896f6240029", + "runtime_bytecode": "0x60806040526004361061015f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c27146101b9578063173825d91461022657806320ea8d86146102695780632f54bf6e146102965780633411c81c146102f157806337bd78a0146103565780635474152514610381578063553a48fd146103d05780635711b311146104515780637065cb481461047e578063784547a7146104c15780637ad28c51146105065780638b51d13f146105335780639ace38c214610574578063a0e67e2b1461065f578063a8abe69a146106cb578063add1cbc51461076f578063b5dc40c3146107c6578063b77bf60014610848578063ba51a6df14610873578063c01a8c84146108a0578063c6427474146108cd578063d38f2d8214610974578063d74f8edd146109b5578063dc8452cd146109e0578063e20056e614610a0b578063ee22610b14610a6e575b60003411156101b7573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b3480156101c557600080fd5b506101e460048036038101908080359060200190929190505050610a9b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561023257600080fd5b50610267600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ad9565b005b34801561027557600080fd5b5061029460048036038101908080359060200190929190505050610d72565b005b3480156102a257600080fd5b506102d7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f2f565b604051808215151515815260200191505060405180910390f35b3480156102fd57600080fd5b5061033c60048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f4f565b604051808215151515815260200191505060405180910390f35b34801561036257600080fd5b5061036b610f7e565b6040518082815260200191505060405180910390f35b34801561038d57600080fd5b506103ba600480360381019080803515159060200190929190803515159060200190929190505050610f84565b6040518082815260200191505060405180910390f35b3480156103dc57600080fd5b50610437600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611016565b604051808215151515815260200191505060405180910390f35b34801561045d57600080fd5b5061047c60048036038101908080359060200190929190505050611153565b005b34801561048a57600080fd5b506104bf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611459565b005b3480156104cd57600080fd5b506104ec60048036038101908080359060200190929190505050611652565b604051808215151515815260200191505060405180910390f35b34801561051257600080fd5b5061053160048036038101908080359060200190929190505050611737565b005b34801561053f57600080fd5b5061055e600480360381019080803590602001909291905050506117b2565b6040518082815260200191505060405180910390f35b34801561058057600080fd5b5061059f6004803603810190808035906020019092919050505061187d565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b83811015610621578082015181840152602081019050610606565b50505050905090810190601f16801561064e5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561066b57600080fd5b50610674611972565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106b757808201518184015260208101905061069c565b505050509050019250505060405180910390f35b3480156106d757600080fd5b506107186004803603810190808035906020019092919080359060200190929190803515159060200190929190803515159060200190929190505050611a00565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561075b578082015181840152602081019050610740565b505050509050019250505060405180910390f35b34801561077b57600080fd5b50610784611b71565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156107d257600080fd5b506107f160048036038101908080359060200190929190505050611b97565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610834578082015181840152602081019050610819565b505050509050019250505060405180910390f35b34801561085457600080fd5b5061085d611dd4565b6040518082815260200191505060405180910390f35b34801561087f57600080fd5b5061089e60048036038101908080359060200190929190505050611dda565b005b3480156108ac57600080fd5b506108cb60048036038101908080359060200190929190505050611e8c565b005b3480156108d957600080fd5b5061095e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061208c565b6040518082815260200191505060405180910390f35b34801561098057600080fd5b5061099f600480360381019080803590602001909291905050506120ab565b6040518082815260200191505060405180910390f35b3480156109c157600080fd5b506109ca6120c3565b6040518082815260200191505060405180910390f35b3480156109ec57600080fd5b506109f56120c8565b6040518082815260200191505060405180910390f35b348015610a1757600080fd5b50610a6c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506120ce565b005b348015610a7a57600080fd5b50610a99600480360381019080803590602001909291905050506123e1565b005b600381815481101515610aaa57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b1557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610b6e57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610cf3578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610c0157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610ce6576003600160038054905003815481101515610c5f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610c9957fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cf3565b8180600101925050610bcb565b6001600381818054905003915081610d0b919061276a565b506003805490506004541115610d2a57610d29600380549050611dda565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610dcb57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610e3657600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff1615610e6457600080fd5b84610e6e81611652565b151515610e7a57600080fd5b60006001600088815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550853373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a3505050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60065481565b600080600090505b60055481101561100f57838015610fc3575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610ff65750828015610ff5575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15611002576001820191505b8080600101915050610f8c565b5092915050565b600080600060405180807f72656d6f7665417574686f72697a656441646472657373286164647265737329815250602001905060405180910390209150600090505b600481101561114857818160048110151561106f57fe5b1a7f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191684828151811015156110c257fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614151561113b57600080fd5b8080600101915050611058565b600192505050919050565b60008160008082815260200190815260200160002060030160009054906101000a900460ff161561118357600080fd5b8261118d81611652565b151561119857600080fd5b8360008060008381526020019081526020016000209050600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561122f57600080fd5b6112d4816002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112ca5780601f1061129f576101008083540402835291602001916112ca565b820191906000526020600020905b8154815290600101906020018083116112ad57829003601f168201915b5050505050611016565b15156112df57600080fd5b600080878152602001908152602001600020945060018560030160006101000a81548160ff0219169083151502179055508460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1685600101548660020160405180828054600181600116156101000203166002900480156113b95780601f1061138e576101008083540402835291602001916113b9565b820191906000526020600020905b81548152906001019060200180831161139c57829003601f168201915b505091505060006040518083038185875af1925050501561140657857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2611451565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008560030160006101000a81548160ff0219169083151502179055505b505050505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561149357600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156114eb57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff16141561151057600080fd5b600160038054905001600454603282118061152a57508181115b806115355750600081145b806115405750600082145b1561154a57600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038590806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b60038054905081101561172f5760016000858152602001908152602001600020600060038381548110151561169057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561170f576001820191505b6004548214156117225760019250611730565b808060010191505061165f565b5b5050919050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561177157600080fd5b806006819055507fd1c9101a34feff75cccef14a28785a0279cb0b49c1f321f21f5f422e746b4377816040518082815260200191505060405180910390a150565b600080600090505b600380549050811015611877576001600084815260200190815260200160002060006003838154811015156117eb57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561186a576001820191505b80806001019150506117ba565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156119555780601f1061192a57610100808354040283529160200191611955565b820191906000526020600020905b81548152906001019060200180831161193857829003601f168201915b5050505050908060030160009054906101000a900460ff16905084565b606060038054806020026020016040519081016040528092919081815260200182805480156119f657602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116119ac575b5050505050905090565b606080600080600554604051908082528060200260200182016040528015611a375781602001602082028038833980820191505090505b50925060009150600090505b600554811015611ae357858015611a7a575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80611aad5750848015611aac575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15611ad657808383815181101515611ac157fe5b90602001906020020181815250506001820191505b8080600101915050611a43565b878703604051908082528060200260200182016040528015611b145781602001602082028038833980820191505090505b5093508790505b86811015611b66578281815181101515611b3157fe5b9060200190602002015184898303815181101515611b4b57fe5b90602001906020020181815250508080600101915050611b1b565b505050949350505050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606080600080600380549050604051908082528060200260200182016040528015611bd15781602001602082028038833980820191505090505b50925060009150600090505b600380549050811015611d1e57600160008681526020019081526020016000206000600383815481101515611c0e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611d1157600381815481101515611c9557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168383815181101515611cce57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b8080600101915050611bdd565b81604051908082528060200260200182016040528015611d4d5781602001602082028038833980820191505090505b509350600090505b81811015611dcc578281815181101515611d6b57fe5b906020019060200201518482815181101515611d8357fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611d55565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e1457600080fd5b600380549050816032821180611e2957508181115b80611e345750600081145b80611e3f5750600082145b15611e4957600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611ee557600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611f3f57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611fa957600080fd5b84611fb381611652565b151515611fbf57600080fd5b600180600088815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550853373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361207486611652565b156120845761208386426125c6565b5b505050505050565b600061209984848461261a565b90506120a481611e8c565b9392505050565b60076020528060005260406000206000915090505481565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561210a57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561216357600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156121bb57600080fd5b600092505b6003805490508310156122a4578473ffffffffffffffffffffffffffffffffffffffff166003848154811015156121f357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415612297578360038481548110151561224a57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506122a4565b82806001019350506121c0565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b60008160008082815260200190815260200160002060030160009054906101000a900460ff161561241157600080fd5b8261241b81611652565b151561242657600080fd5b83600654600760008381526020019081526020016000205401421015151561244d57600080fd5b600080868152602001908152602001600020935060018460030160006101000a81548160ff0219169083151502179055508360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1684600101548560020160405180828054600181600116156101000203166002900480156125275780601f106124fc57610100808354040283529160200191612527565b820191906000526020600020905b81548152906001019060200180831161250a57829003601f168201915b505091505060006040518083038185875af1925050501561257457847f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a26125bf565b847f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008460030160006101000a81548160ff0219169083151502179055505b5050505050565b806007600084815260200190815260200160002081905550817f0b237afe65f1514fd7ea3f923ea4fe792bdd07000a912b6cd1602a8e7f573c8d826040518082815260200191505060405180910390a25050565b60008360008173ffffffffffffffffffffffffffffffffffffffff16141561264157600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190612700929190612796565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b815481835581811115612791578183600052602060002091820191016127909190612816565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106127d757805160ff1916838001178555612805565b82800160010185558215612805579182015b828111156128045782518255916020019190600101906127e9565b5b5090506128129190612816565b5090565b61283891905b8082111561283457600081600090555060010161281c565b5090565b905600a165627a7a723058208fb04dd2ea83d777b56d0e2215974a355cbef67a7f12311e46776fad4896f6240029", + "updated_at": 1525776882033, + "source_map": "714:2422:2:-;;;1582:349;8:9:-1;5:2;;;30:1;27;20:12;5:2;1582:349:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1819:7;1828:9;1839:18;2038:7:1;2047:9;2959:6:0;2913:7;:14;2929:9;256:2;2236:10;:28;:66;;;;2292:10;2280:9;:22;2236:66;:96;;;;2331:1;2318:9;:14;2236:96;:127;;;;2362:1;2348:10;:15;2236:127;2229:153;;;2377:5;;;2229:153;2966:1;2959:8;;2954:168;2971:7;:14;2969:1;:16;2954:168;;;3010:7;:19;3018:7;3026:1;3018:10;;;;;;;;;;;;;;;;;;3010:19;;;;;;;;;;;;;;;;;;;;;;;;;:38;;;;3047:1;3033:7;3041:1;3033:10;;;;;;;;;;;;;;;;;;:15;;;3010:38;3006:65;;;3066:5;;;3006:65;3107:4;3085:7;:19;3093:7;3101:1;3093:10;;;;;;;;;;;;;;;;;;3085:19;;;;;;;;;;;;;;;;:26;;;;;;;;;;;;;;;;;;2987:3;;;;;;;2954:168;;;3140:7;3131:6;:16;;;;;;;;;;;;:::i;:::-;;3168:9;3157:8;:20;;;;2814:370;;;;;2092:18:1;2072:17;:38;;;;1904:213;;;1905:19:2;1873:29;;:51;;;;;;;;;;;;;;;;;;1582:349;;;;714:2422;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;", + "source_map_runtime": "714:2422:2:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2519:1:0;2507:9;:13;2503:61;;;2542:10;2534:30;;;2554:9;2534:30;;;;;;;;;;;;;;;;;;2503:61;714:2422:2;936:23:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;936:23:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3711:460;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3711:460:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;3196:332:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3196:332:1;;;;;;;;;;;;;;;;;;;;;;;;;;890:40:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;890:40:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;820:64;;8:9:-1;5:2;;;30:1;27;20:12;5:2;820:64:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1049:29:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1049:29:1;;;;;;;;;;;;;;;;;;;;;;;9136:319:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;9136:319:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2774:360:2;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2774:360:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2058:502;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2058:502:2;;;;;;;;;;;;;;;;;;;;;;;;;;3311:277:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3311:277:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;7304:337;;8:9:-1;5:2;;;30:1;27;20:12;5:2;7304:337:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2321:186:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2321:186:1;;;;;;;;;;;;;;;;;;;;;;;;;;8622:252:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;8622:252:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;765:49;;8:9:-1;5:2;;;30:1;27;20:12;5:2;765:49:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;765:49:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9539:115;;8:9:-1;5:2;;;30:1;27;20:12;5:2;9539:115:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;9539:115:0;;;;;;;;;;;;;;;;;10757:676;;8:9:-1;5:2;;;30:1;27;20:12;5:2;10757:676:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;10757:676:0;;;;;;;;;;;;;;;;;816:44:2;;8:9:-1;5:2;;;30:1;27;20:12;5:2;816:44:2;;;;;;;;;;;;;;;;;;;;;;;;;;;9833:575:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;9833:575:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;9833:575:0;;;;;;;;;;;;;;;;;991:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;991:28:0;;;;;;;;;;;;;;;;;;;;;;;4990:207;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4990:207:0;;;;;;;;;;;;;;;;;;;;;;;;;;2613:459:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2613:459:1;;;;;;;;;;;;;;;;;;;;;;;;;;5456:244:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;5456:244:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1085:47:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1085:47:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;217:41:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;217:41:0;;;;;;;;;;;;;;;;;;;;;;;965:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;965:20:0;;;;;;;;;;;;;;;;;;;;;;;4370:449;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4370:449:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3642:472:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3642:472:1;;;;;;;;;;;;;;;;;;;;;;;;;;936:23:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;3711:460::-;3859:6;1208:4;1186:27;;:10;:27;;;;1182:50;;;1227:5;;;1182:50;3801:5;1420:7;:14;1428:5;1420:14;;;;;;;;;;;;;;;;;;;;;;;;;1419:15;1415:38;;;1448:5;;;1415:38;3839:5;3822:7;:14;3830:5;3822:14;;;;;;;;;;;;;;;;:22;;;;;;;;;;;;;;;;;;3866:1;3859:8;;3854:170;3887:1;3871:6;:13;;;;:17;3869:1;:19;3854:170;;;3924:5;3911:18;;:6;3918:1;3911:9;;;;;;;;;;;;;;;;;;;;;;;;;;;:18;;;3907:117;;;3961:6;3984:1;3968:6;:13;;;;:17;3961:25;;;;;;;;;;;;;;;;;;;;;;;;;;;3949:6;3956:1;3949:9;;;;;;;;;;;;;;;;;;:37;;;;;;;;;;;;;;;;;;4004:5;;3907:117;3890:3;;;;;;;3854:170;;;4050:1;4033:6;:18;;;;;;;;;;;;;;:::i;:::-;;4076:6;:13;;;;4065:8;;:24;4061:74;;;4103:32;4121:6;:13;;;;4103:17;:32::i;:::-;4061:74;4158:5;4145:19;;;;;;;;;;;;1242:1;3711:460;;:::o;3196:332:1:-;3279:10;1420:7:0;:14;1428:5;1420:14;;;;;;;;;;;;;;;;;;;;;;;;;1419:15;1415:38;;;1448:5;;;1415:38;3309:13:1;3324:10;1694:13:0;:28;1708:13;1694:28;;;;;;;;;;;:35;1723:5;1694:35;;;;;;;;;;;;;;;;;;;;;;;;;1693:36;1689:59;;;1743:5;;;1689:59;3356:13:1;1976:12:0;:27;1989:13;1976:27;;;;;;;;;;;:36;;;;;;;;;;;;1972:59;;;2026:5;;;1972:59;3397:13:1;1205:26;1217:13;1205:11;:26::i;:::-;1204:27;1196:36;;;;;;;;3469:5;3426:13;:28;3440:13;3426:28;;;;;;;;;;;:40;3455:10;3426:40;;;;;;;;;;;;;;;;:48;;;;;;;;;;;;;;;;;;3507:13;3495:10;3484:37;;;;;;;;;;;;2041:1:0;1758;1463;;3196:332:1;;:::o;890:40:0:-;;;;;;;;;;;;;;;;;;;;;;:::o;820:64::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;1049:29:1:-;;;;:::o;9136:319:0:-;9243:10;9274:6;9281:1;9274:8;;9269:179;9286:16;;9284:1;:18;9269:179;;;9328:7;:36;;;;;9340:12;:15;9353:1;9340:15;;;;;;;;;;;:24;;;;;;;;;;;;9339:25;9328:36;:92;;;;9384:8;:36;;;;;9396:12;:15;9409:1;9396:15;;;;;;;;;;;:24;;;;;;;;;;;;9384:36;9328:92;9321:127;;;9447:1;9438:10;;;;9321:127;9304:3;;;;;;;9269:179;;;9136:319;;;;;:::o;2774:360:2:-;2878:4;2898:39;3003:6;2947:40;;;;;;;;;;;;;;;;;;;2898:90;;3012:1;3003:10;;2998:109;3019:1;3015;:5;2998:109;;;3060:32;3093:1;3060:35;;;;;;;;;;;;3049:46;;;:4;3054:1;3049:7;;;;;;;;;;;;;;;;;;;;:46;;;;3041:55;;;;;;;;3022:3;;;;;;;2998:109;;;3123:4;3116:11;;2774:360;;;;;:::o;2058:502::-;2274:22;2153:13;1976:12:0;:27;1989:13;1976:27;;;;;;;;;;;:36;;;;;;;;;;;;1972:59;;;2026:5;;;1972:59;2191:13:2;1318:26:1;1330:13;1318:11;:26::i;:::-;1310:35;;;;;;;;2245:13:2;937:22;962:12;:27;975:13;962:27;;;;;;;;;;;937:52;;1025:29;;;;;;;;;;;1007:47;;:2;:14;;;;;;;;;;;;:47;;;999:56;;;;;;;;1073:42;1107:2;:7;;1073:42;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:33;:42::i;:::-;1065:51;;;;;;;;2299:12;:27;2312:13;2299:27;;;;;;;;;;;2274:52;;2350:4;2336:2;:11;;;:18;;;;;;;;;;;;;;;;;;2368:2;:14;;;;;;;;;;;;:19;;2394:2;:8;;;2404:2;:7;;2368:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2364:190;;;2436:13;2426:24;;;;;;;;;;2364:190;;;2496:13;2479:31;;;;;;;;;;2538:5;2524:2;:11;;;:19;;;;;;;;;;;;;;;;;;2364:190;1355:1:1;;2041::0;2058:502:2;;;:::o;3311:277:0:-;1208:4;1186:27;;:10;:27;;;;1182:50;;;1227:5;;;1182:50;3404:5;1312:7;:14;1320:5;1312:14;;;;;;;;;;;;;;;;;;;;;;;;;1308:37;;;1340:5;;;1308:37;3427:5;2116:1;2104:8;:13;;;2100:36;;;2131:5;;;2100:36;3475:1;3459:6;:13;;;;:17;3478:8;;256:2;2236:10;:28;:66;;;;2292:10;2280:9;:22;2236:66;:96;;;;2331:1;2318:9;:14;2236:96;:127;;;;2362:1;2348:10;:15;2236:127;2229:153;;;2377:5;;;2229:153;3519:4;3502:7;:14;3510:5;3502:14;;;;;;;;;;;;;;;;:21;;;;;;;;;;;;;;;;;;3533:6;3545:5;3533:18;;39:1:-1;33:3;27:10;23:18;57:10;52:3;45:23;79:10;72:17;;0:93;3533:18:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3575:5;3561:20;;;;;;;;;;;;2146:1;;1355;1242;3311:277;:::o;7304:337::-;7394:4;7414:10;7443:6;7427:1;7414:14;;7450:1;7443:8;;7438:197;7455:6;:13;;;;7453:1;:15;7438:197;;;7493:13;:28;7507:13;7493:28;;;;;;;;;;;:39;7522:6;7529:1;7522:9;;;;;;;;;;;;;;;;;;;;;;;;;;;7493:39;;;;;;;;;;;;;;;;;;;;;;;;;7489:71;;;7559:1;7550:10;;;;7489:71;7587:8;;7578:5;:17;7574:50;;;7620:4;7613:11;;;;7574:50;7470:3;;;;;;;7438:197;;;7304:337;;;;;;:::o;2321:186:1:-;1208:4:0;1186:27;;:10;:27;;;;1182:50;;;1227:5;;;1182:50;2438:18:1;2418:17;:38;;;;2466:34;2481:18;2466:34;;;;;;;;;;;;;;;;;;2321:186;:::o;8622:252:0:-;8721:10;8752:6;8759:1;8752:8;;8747:120;8764:6;:13;;;;8762:1;:15;8747:120;;;8800:13;:28;8814:13;8800:28;;;;;;;;;;;:39;8829:6;8836:1;8829:9;;;;;;;;;;;;;;;;;;;;;;;;;;;8800:39;;;;;;;;;;;;;;;;;;;;;;;;;8796:71;;;8866:1;8857:10;;;;8796:71;8779:3;;;;;;;8747:120;;;8622:252;;;;:::o;765:49::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;9539:115::-;9609:9;9641:6;9634:13;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9539:115;:::o;10757:676::-;10882:22;10920:32;10993:10;11017:6;10966:16;;10955:28;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;10955:28:0;;;;10920:63;;11006:1;10993:14;;11040:1;11038:3;;11033:250;11045:16;;11043:1;:18;11033:250;;;11087:7;:36;;;;;11099:12;:15;11112:1;11099:15;;;;;;;;;;;:24;;;;;;;;;;;;11098:25;11087:36;:92;;;;11143:8;:36;;;;;11155:12;:15;11168:1;11155:15;;;;;;;;;;;:24;;;;;;;;;;;;11143:36;11087:92;11080:203;;;11239:1;11211:18;11230:5;11211:25;;;;;;;;;;;;;;;;;:29;;;;;11267:1;11258:10;;;;11080:203;11063:3;;;;;;;11033:250;;;11326:4;11321:2;:9;11310:21;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;11310:21:0;;;;11292:39;;11348:4;11346:6;;11341:85;11356:2;11354:1;:4;11341:85;;;11405:18;11424:1;11405:21;;;;;;;;;;;;;;;;;;11377:15;11397:4;11393:1;:8;11377:25;;;;;;;;;;;;;;;;;:49;;;;;11360:3;;;;;;;11341:85;;;10757:676;;;;;;;;;:::o;816:44:2:-;;;;;;;;;;;;;:::o;9833:575:0:-;9928:24;9968:34;10043:10;10067:6;10019;:13;;;;10005:28;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;10005:28:0;;;;9968:65;;10056:1;10043:14;;10090:1;10088:3;;10083:186;10095:6;:13;;;;10093:1;:15;10083:186;;;10131:13;:28;10145:13;10131:28;;;;;;;;;;;:39;10160:6;10167:1;10160:9;;;;;;;;;;;;;;;;;;;;;;;;;;;10131:39;;;;;;;;;;;;;;;;;;;;;;;;;10127:142;;;10217:6;10224:1;10217:9;;;;;;;;;;;;;;;;;;;;;;;;;;;10190:17;10208:5;10190:24;;;;;;;;;;;;;;;;;:36;;;;;;;;;;;10253:1;10244:10;;;;10127:142;10110:3;;;;;;;10083:186;;;10309:5;10295:20;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;10295:20:0;;;;10278:37;;10332:1;10330:3;;10325:76;10337:5;10335:1;:7;10325:76;;;10381:17;10399:1;10381:20;;;;;;;;;;;;;;;;;;10361:14;10376:1;10361:17;;;;;;;;;;;;;;;;;:40;;;;;;;;;;;10344:3;;;;;;;10325:76;;;9833:575;;;;;;:::o;991:28::-;;;;:::o;4990:207::-;1208:4;1186:27;;:10;:27;;;;1182:50;;;1227:5;;;1182:50;5092:6;:13;;;;5107:9;256:2;2236:10;:28;:66;;;;2292:10;2280:9;:22;2236:66;:96;;;;2331:1;2318:9;:14;2236:96;:127;;;;2362:1;2348:10;:15;2236:127;2229:153;;;2377:5;;;2229:153;5143:9;5132:8;:20;;;;5162:28;5180:9;5162:28;;;;;;;;;;;;;;;;;;1242:1;;4990:207;:::o;2613:459:1:-;2696:10;1420:7:0;:14;1428:5;1420:14;;;;;;;;;;;;;;;;;;;;;;;;;1419:15;1415:38;;;1448:5;;;1415:38;2734:13:1;1581:1:0;1538:12;:27;1551:13;1538:27;;;;;;;;;;;:39;;;;;;;;;;;;:44;;;1534:67;;;1596:5;;;1534:67;2770:13:1;2785:10;1843:13:0;:28;1857:13;1843:28;;;;;;;;;;;:35;1872:5;1843:35;;;;;;;;;;;;;;;;;;;;;;;;;1839:58;;;1892:5;;;1839:58;2823:13:1;1205:26;1217:13;1205:11;:26::i;:::-;1204:27;1196:36;;;;;;;;2895:4;2852:13;:28;2866:13;2852:28;;;;;;;;;;;:40;2881:10;2852:40;;;;;;;;;;;;;;;;:47;;;;;;;;;;;;;;;;;;2934:13;2922:10;2909:39;;;;;;;;;;;;2962:26;2974:13;2962:11;:26::i;:::-;2958:108;;;3004:51;3024:13;3039:15;3004:19;:51::i;:::-;2958:108;1907:1:0;1611;;1463;2613:459:1;;:::o;5456:244:0:-;5560:18;5610:40;5625:11;5638:5;5645:4;5610:14;:40::i;:::-;5594:56;;5660:33;5679:13;5660:18;:33::i;:::-;5456:244;;;;;:::o;1085:47:1:-;;;;;;;;;;;;;;;;;:::o;217:41:0:-;256:2;217:41;:::o;965:20::-;;;;:::o;4370:449::-;4541:6;1208:4;1186:27;;:10;:27;;;;1182:50;;;1227:5;;;1182:50;4479:5;1420:7;:14;1428:5;1420:14;;;;;;;;;;;;;;;;;;;;;;;;;1419:15;1415:38;;;1448:5;;;1415:38;4512:8;1312:7;:14;1320:5;1312:14;;;;;;;;;;;;;;;;;;;;;;;;;1308:37;;;1340:5;;;1308:37;4548:1;4541:8;;4536:149;4553:6;:13;;;;4551:1;:15;4536:149;;;4602:5;4589:18;;:6;4596:1;4589:9;;;;;;;;;;;;;;;;;;;;;;;;;;;:18;;;4585:100;;;4639:8;4627:6;4634:1;4627:9;;;;;;;;;;;;;;;;;;:20;;;;;;;;;;;;;;;;;;4665:5;;4585:100;4568:3;;;;;;;4536:149;;;4711:5;4694:7;:14;4702:5;4694:14;;;;;;;;;;;;;;;;:22;;;;;;;;;;;;;;;;;;4746:4;4726:7;:17;4734:8;4726:17;;;;;;;;;;;;;;;;:24;;;;;;;;;;;;;;;;;;4773:5;4760:19;;;;;;;;;;;;4803:8;4789:23;;;;;;;;;;;;1463:1;1242;4370:449;;;:::o;3642:472:1:-;3828:22;3725:13;1976:12:0;:27;1989:13;1976:27;;;;;;;;;;;:36;;;;;;;;;;;;1972:59;;;2026:5;;;1972:59;3763:13:1;1318:26;1330:13;1318:11;:26::i;:::-;1310:35;;;;;;;;3799:13;1483:17;;1448;:32;1466:13;1448:32;;;;;;;;;;;;:52;1429:15;:71;;1421:80;;;;;;;;3853:12;:27;3866:13;3853:27;;;;;;;;;;;3828:52;;3904:4;3890:2;:11;;;:18;;;;;;;;;;;;;;;;;;3922:2;:14;;;;;;;;;;;;:19;;3948:2;:8;;;3958:2;:7;;3922:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3918:190;;;3990:13;3980:24;;;;;;;;;;3918:190;;;4050:13;4033:31;;;;;;;;;;4092:5;4078:2;:11;;;:19;;;;;;;;;;;;;;;;;;3918:190;1355:1;2041::0;3642:472:1;;;:::o;4224:223::-;4362:16;4327:17;:32;4345:13;4327:32;;;;;;;;;;;:51;;;;4408:13;4388:52;4423:16;4388:52;;;;;;;;;;;;;;;;;;4224:223;;:::o;7974:451:0:-;8106:18;8076:11;2116:1;2104:8;:13;;;2100:36;;;2131:5;;;2100:36;8156:16;;8140:32;;8212:140;;;;;;;;;8251:11;8212:140;;;;;;8283:5;8212:140;;;;8308:4;8212:140;;;;8336:5;8212:140;;;;;8182:12;:27;8195:13;8182:27;;;;;;;;;;;:170;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8382:1;8362:16;;:21;;;;;;;;;;;8404:13;8393:25;;;;;;;;;;7974:451;;;;;;:::o;714:2422:2:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", + "sources": [ + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/multisig/MultiSigWallet/MultiSigWallet.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/multisig/MultiSigWalletWithTimeLock/MultiSigWalletWithTimeLock.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/multisig/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.sol" + ] + } + } +}
\ No newline at end of file diff --git a/packages/contract-wrappers/test/artifacts/Token.json b/packages/contract-wrappers/test/artifacts/Token.json new file mode 100644 index 000000000..b48b41286 --- /dev/null +++ b/packages/contract-wrappers/test/artifacts/Token.json @@ -0,0 +1,179 @@ +{ + "contract_name": "Token", + "networks": { + "50": { + "solc_version": "0.4.23", + "source_tree_hash": "0xe43382be55ddb9c7a28567b4cc59e35072da198e6c49a90ff1396aa8399fd61e", + "optimizer_enabled": false, + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "_spender", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_from", + "type": "address" + }, + { + "indexed": true, + "name": "_to", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "name": "_spender", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + } + ], + "bytecode": "0x608060405234801561001057600080fd5b506102e3806100206000396000f30060806040526004361061006d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063095ea7b31461007257806323b872dd146100d757806370a082311461015c578063a9059cbb146101b3578063dd62ed3e14610218575b600080fd5b34801561007e57600080fd5b506100bd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061028f565b604051808215151515815260200191505060405180910390f35b3480156100e357600080fd5b50610142600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610297565b604051808215151515815260200191505060405180910390f35b34801561016857600080fd5b5061019d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506102a0565b6040518082815260200191505060405180910390f35b3480156101bf57600080fd5b506101fe600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506102a7565b604051808215151515815260200191505060405180910390f35b34801561022457600080fd5b50610279600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506102af565b6040518082815260200191505060405180910390f35b600092915050565b60009392505050565b6000919050565b600092915050565b6000929150505600a165627a7a72305820c0eb8c14c0b2d0b9f45639d053a22e400cf642410f155a793e5b2ea1e78925bb0029", + "runtime_bytecode": "0x60806040526004361061006d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063095ea7b31461007257806323b872dd146100d757806370a082311461015c578063a9059cbb146101b3578063dd62ed3e14610218575b600080fd5b34801561007e57600080fd5b506100bd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061028f565b604051808215151515815260200191505060405180910390f35b3480156100e357600080fd5b50610142600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610297565b604051808215151515815260200191505060405180910390f35b34801561016857600080fd5b5061019d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506102a0565b6040518082815260200191505060405180910390f35b3480156101bf57600080fd5b506101fe600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506102a7565b604051808215151515815260200191505060405180910390f35b34801561022457600080fd5b50610279600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506102af565b6040518082815260200191505060405180910390f35b600092915050565b60009392505050565b6000919050565b600092915050565b6000929150505600a165627a7a72305820c0eb8c14c0b2d0b9f45639d053a22e400cf642410f155a793e5b2ea1e78925bb0029", + "updated_at": 1525776876709, + "source_map": "26:1709:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;26:1709:0;;;;;;;", + "source_map_runtime": "26:1709:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1037:72;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1037:72:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;667:87;;8:9:-1;5:2;;;30:1;27;20:12;5:2;667:87:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1218:64;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1218:64:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;278:68;;8:9:-1;5:2;;;30:1;27;20:12;5:2;278:68:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1490:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1490:82:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1037:72;1101:4;1037:72;;;;:::o;667:87::-;746:4;667:87;;;;;:::o;1218:64::-;1274:4;1218:64;;;:::o;278:68::-;338:4;278:68;;;;:::o;1490:82::-;1564:4;1490:82;;;;:::o", + "sources": [ + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/tokens/Token/Token.sol" + ] + } + } +}
\ No newline at end of file diff --git a/packages/contract-wrappers/test/artifacts/TokenRegistry.json b/packages/contract-wrappers/test/artifacts/TokenRegistry.json new file mode 100644 index 000000000..71619ea87 --- /dev/null +++ b/packages/contract-wrappers/test/artifacts/TokenRegistry.json @@ -0,0 +1,562 @@ +{ + "contract_name": "TokenRegistry", + "networks": { + "50": { + "solc_version": "0.4.23", + "source_tree_hash": "0x2ff7351f8fdae20562e116b42e3ec236c656ac1af71f7a62c8591627444bce40", + "optimizer_enabled": false, + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_index", + "type": "uint256" + } + ], + "name": "removeToken", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_name", + "type": "string" + } + ], + "name": "getTokenAddressByName", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_symbol", + "type": "string" + } + ], + "name": "getTokenAddressBySymbol", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_swarmHash", + "type": "bytes" + } + ], + "name": "setTokenSwarmHash", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_token", + "type": "address" + } + ], + "name": "getTokenMetaData", + "outputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "uint8" + }, + { + "name": "", + "type": "bytes" + }, + { + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_name", + "type": "string" + }, + { + "name": "_symbol", + "type": "string" + }, + { + "name": "_decimals", + "type": "uint8" + }, + { + "name": "_ipfsHash", + "type": "bytes" + }, + { + "name": "_swarmHash", + "type": "bytes" + } + ], + "name": "addToken", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_name", + "type": "string" + } + ], + "name": "setTokenName", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "tokens", + "outputs": [ + { + "name": "token", + "type": "address" + }, + { + "name": "name", + "type": "string" + }, + { + "name": "symbol", + "type": "string" + }, + { + "name": "decimals", + "type": "uint8" + }, + { + "name": "ipfsHash", + "type": "bytes" + }, + { + "name": "swarmHash", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "tokenAddresses", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_name", + "type": "string" + } + ], + "name": "getTokenByName", + "outputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "uint8" + }, + { + "name": "", + "type": "bytes" + }, + { + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getTokenAddresses", + "outputs": [ + { + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_ipfsHash", + "type": "bytes" + } + ], + "name": "setTokenIpfsHash", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_symbol", + "type": "string" + } + ], + "name": "getTokenBySymbol", + "outputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "uint8" + }, + { + "name": "", + "type": "bytes" + }, + { + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_symbol", + "type": "string" + } + ], + "name": "setTokenSymbol", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "name", + "type": "string" + }, + { + "indexed": false, + "name": "symbol", + "type": "string" + }, + { + "indexed": false, + "name": "decimals", + "type": "uint8" + }, + { + "indexed": false, + "name": "ipfsHash", + "type": "bytes" + }, + { + "indexed": false, + "name": "swarmHash", + "type": "bytes" + } + ], + "name": "LogAddToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "name", + "type": "string" + }, + { + "indexed": false, + "name": "symbol", + "type": "string" + }, + { + "indexed": false, + "name": "decimals", + "type": "uint8" + }, + { + "indexed": false, + "name": "ipfsHash", + "type": "bytes" + }, + { + "indexed": false, + "name": "swarmHash", + "type": "bytes" + } + ], + "name": "LogRemoveToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "oldName", + "type": "string" + }, + { + "indexed": false, + "name": "newName", + "type": "string" + } + ], + "name": "LogTokenNameChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "oldSymbol", + "type": "string" + }, + { + "indexed": false, + "name": "newSymbol", + "type": "string" + } + ], + "name": "LogTokenSymbolChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "oldIpfsHash", + "type": "bytes" + }, + { + "indexed": false, + "name": "newIpfsHash", + "type": "bytes" + } + ], + "name": "LogTokenIpfsHashChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "oldSwarmHash", + "type": "bytes" + }, + { + "indexed": false, + "name": "newSwarmHash", + "type": "bytes" + } + ], + "name": "LogTokenSwarmHashChange", + "type": "event" + } + ], + "bytecode": "0x6080604052336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550613c80806100536000396000f3006080604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806313baf1e6146100eb5780632fbfeba9146101385780633550b6d9146101e1578063563188201461028a5780637abccac9146103135780638da5cb5b14610553578063a880319d146105aa578063c370c86d14610712578063e48603391461079b578063e5df8b84146109db578063e73fc0c314610a48578063ee8c24b814610cae578063eef05f6514610d1a578063efa74f1f14610da3578063f036417f14611009578063f2fde38b14611092575b600080fd5b3480156100f757600080fd5b50610136600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110d5565b005b34801561014457600080fd5b5061019f600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506117e5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101ed57600080fd5b50610248600480360381019080803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061187a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561029657600080fd5b50610311600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061190f565b005b34801561031f57600080fd5b50610354600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bab565b604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001806020018660ff1660ff168152602001806020018060200185810385528a818151815260200191508051906020019080838360005b838110156103de5780820151818401526020810190506103c3565b50505050905090810190601f16801561040b5780820380516001836020036101000a031916815260200191505b50858103845289818151815260200191508051906020019080838360005b83811015610444578082015181840152602081019050610429565b50505050905090810190601f1680156104715780820380516001836020036101000a031916815260200191505b50858103835287818151815260200191508051906020019080838360005b838110156104aa57808201518184015260208101905061048f565b50505050905090810190601f1680156104d75780820380516001836020036101000a031916815260200191505b50858103825286818151815260200191508051906020019080838360005b838110156105105780820151818401526020810190506104f5565b50505050905090810190601f16801561053d5780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b34801561055f57600080fd5b50610568611f45565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105b657600080fd5b50610710600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803560ff169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611f6a565b005b34801561071e57600080fd5b50610799600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050612761565b005b3480156107a757600080fd5b506107dc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612c06565b604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001806020018660ff1660ff168152602001806020018060200185810385528a818151815260200191508051906020019080838360005b8381101561086657808201518184015260208101905061084b565b50505050905090810190601f1680156108935780820380516001836020036101000a031916815260200191505b50858103845289818151815260200191508051906020019080838360005b838110156108cc5780820151818401526020810190506108b1565b50505050905090810190601f1680156108f95780820380516001836020036101000a031916815260200191505b50858103835287818151815260200191508051906020019080838360005b83811015610932578082015181840152602081019050610917565b50505050905090810190601f16801561095f5780820380516001836020036101000a031916815260200191505b50858103825286818151815260200191508051906020019080838360005b8381101561099857808201518184015260208101905061097d565b50505050905090810190601f1680156109c55780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b3480156109e757600080fd5b50610a0660048036038101908080359060200190929190505050612ecf565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610a5457600080fd5b50610aaf600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050612f0d565b604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001806020018660ff1660ff168152602001806020018060200185810385528a818151815260200191508051906020019080838360005b83811015610b39578082015181840152602081019050610b1e565b50505050905090810190601f168015610b665780820380516001836020036101000a031916815260200191505b50858103845289818151815260200191508051906020019080838360005b83811015610b9f578082015181840152602081019050610b84565b50505050905090810190601f168015610bcc5780820380516001836020036101000a031916815260200191505b50858103835287818151815260200191508051906020019080838360005b83811015610c05578082015181840152602081019050610bea565b50505050905090810190601f168015610c325780820380516001836020036101000a031916815260200191505b50858103825286818151815260200191508051906020019080838360005b83811015610c6b578082015181840152602081019050610c50565b50505050905090810190601f168015610c985780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b348015610cba57600080fd5b50610cc3612fc6565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610d06578082015181840152602081019050610ceb565b505050509050019250505060405180910390f35b348015610d2657600080fd5b50610da1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050613054565b005b348015610daf57600080fd5b50610e0a600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506132f0565b604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001806020018660ff1660ff168152602001806020018060200185810385528a818151815260200191508051906020019080838360005b83811015610e94578082015181840152602081019050610e79565b50505050905090810190601f168015610ec15780820380516001836020036101000a031916815260200191505b50858103845289818151815260200191508051906020019080838360005b83811015610efa578082015181840152602081019050610edf565b50505050905090810190601f168015610f275780820380516001836020036101000a031916815260200191505b50858103835287818151815260200191508051906020019080838360005b83811015610f60578082015181840152602081019050610f45565b50505050905090810190601f168015610f8d5780820380516001836020036101000a031916815260200191505b50858103825286818151815260200191508051906020019080838360005b83811015610fc6578082015181840152602081019050610fab565b50505050905090810190601f168015610ff35780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b34801561101557600080fd5b50611090600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506133a9565b005b34801561109e57600080fd5b506110d3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061384e565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561113257600080fd5b82600073ffffffffffffffffffffffffffffffffffffffff16600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156111d157600080fd5b8373ffffffffffffffffffffffffffffffffffffffff166004848154811015156111f757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561124457600080fd5b600460016004805490500381548110151561125b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660048481548110151561129557fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060016004818180549050039150816112f59190613923565b50600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002091508160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f32c54f1e2ea75844ded7517e7dbcd3895da7cd0c28f9ab9f9cf6ecf5f83762c683600101846002018560030160009054906101000a900460ff1686600401876005016040518080602001806020018660ff1660ff168152602001806020018060200185810385528a8181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156114565780601f1061142b57610100808354040283529160200191611456565b820191906000526020600020905b81548152906001019060200180831161143957829003601f168201915b50508581038452898181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156114d95780601f106114ae576101008083540402835291602001916114d9565b820191906000526020600020905b8154815290600101906020018083116114bc57829003601f168201915b505085810383528781815460018160011615610100020316600290048152602001915080546001816001161561010002031660029004801561155c5780601f106115315761010080835404028352916020019161155c565b820191906000526020600020905b81548152906001019060200180831161153f57829003601f168201915b50508581038252868181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156115df5780601f106115b4576101008083540402835291602001916115df565b820191906000526020600020905b8154815290600101906020018083116115c257829003601f168201915b5050995050505050505050505060405180910390a260028260020160405180828054600181600116156101000203166002900480156116555780601f10611633576101008083540402835291820191611655565b820191906000526020600020905b815481529060010190602001808311611641575b5050915050908152602001604051809103902060006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560038260010160405180828054600181600116156101000203166002900480156116ec5780601f106116ca5761010080835404028352918201916116ec565b820191906000526020600020905b8154815290600101906020018083116116d8575b5050915050908152602001604051809103902060006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600182016000611799919061394f565b6002820160006117a9919061394f565b6003820160006101000a81549060ff02191690556004820160006117cd9190613997565b6005820160006117dd9190613997565b505050505050565b60006003826040518082805190602001908083835b60208310151561181f57805182526020820191506020810190506020830392506117fa565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60006002826040518082805190602001908083835b6020831015156118b4578051825260208201915060208101905060208303925061188f565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561196c57600080fd5b82600073ffffffffffffffffffffffffffffffffffffffff16600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515611a0b57600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002091508373ffffffffffffffffffffffffffffffffffffffff167fc3168fdc13112e44a031057dbf6c609b33353addb4d8037d24543e22cbfe2acd8360050185604051808060200180602001838103835285818154600181600116156101000203166002900481526020019150805460018160011615610100020316600290048015611b165780601f10611aeb57610100808354040283529160200191611b16565b820191906000526020600020905b815481529060010190602001808311611af957829003601f168201915b5050838103825284818151815260200191508051906020019080838360005b83811015611b50578082015181840152602081019050611b35565b50505050905090810190601f168015611b7d5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a282826005019080519060200190611ba49291906139df565b5050505050565b60006060806000606080611bbd613a5f565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060c060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611cf75780601f10611ccc57610100808354040283529160200191611cf7565b820191906000526020600020905b815481529060010190602001808311611cda57829003601f168201915b50505050508152602001600282018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611d995780601f10611d6e57610100808354040283529160200191611d99565b820191906000526020600020905b815481529060010190602001808311611d7c57829003601f168201915b505050505081526020016003820160009054906101000a900460ff1660ff1660ff168152602001600482018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611e585780601f10611e2d57610100808354040283529160200191611e58565b820191906000526020600020905b815481529060010190602001808311611e3b57829003601f168201915b50505050508152602001600582018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611efa5780601f10611ecf57610100808354040283529160200191611efa565b820191906000526020600020905b815481529060010190602001808311611edd57829003601f168201915b5050505050815250509050806000015181602001518260400151836060015184608001518560a001518494508393508191508090509650965096509650965096505091939550919395565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611fc557600080fd5b85600073ffffffffffffffffffffffffffffffffffffffff16600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561206357600080fd5b86600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156120a057600080fd5b85600073ffffffffffffffffffffffffffffffffffffffff166002826040518082805190602001908083835b6020831015156120f157805182526020820191506020810190506020830392506120cc565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561216757600080fd5b87600073ffffffffffffffffffffffffffffffffffffffff166003826040518082805190602001908083835b6020831015156121b85780518252602082019150602081019050602083039250612193565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561222e57600080fd5b60c0604051908101604052808b73ffffffffffffffffffffffffffffffffffffffff1681526020018a81526020018981526020018860ff16815260200187815260200186815250600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001019080519060200190612317929190613aaf565b506040820151816002019080519060200190612334929190613aaf565b5060608201518160030160006101000a81548160ff021916908360ff1602179055506080820151816004019080519060200190612372929190613b2f565b5060a082015181600501908051906020019061238f929190613b2f565b5090505060048a90806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050896002896040518082805190602001908083835b602083101515612432578051825260208201915060208101905060208303925061240d565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508960038a6040518082805190602001908083835b6020831015156124dc57805182526020820191506020810190506020830392506124b7565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508973ffffffffffffffffffffffffffffffffffffffff167fd8d928b0b50ca11d9dc273236b46f3526515b03602f71f3a6af4f45bd9fa91448a8a8a8a8a6040518080602001806020018660ff1660ff168152602001806020018060200185810385528a818151815260200191508051906020019080838360005b838110156125e25780820151818401526020810190506125c7565b50505050905090810190601f16801561260f5780820380516001836020036101000a031916815260200191505b50858103845289818151815260200191508051906020019080838360005b8381101561264857808201518184015260208101905061262d565b50505050905090810190601f1680156126755780820380516001836020036101000a031916815260200191505b50858103835287818151815260200191508051906020019080838360005b838110156126ae578082015181840152602081019050612693565b50505050905090810190601f1680156126db5780820380516001836020036101000a031916815260200191505b50858103825286818151815260200191508051906020019080838360005b838110156127145780820151818401526020810190506126f9565b50505050905090810190601f1680156127415780820380516001836020036101000a031916815260200191505b50995050505050505050505060405180910390a250505050505050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156127be57600080fd5b82600073ffffffffffffffffffffffffffffffffffffffff16600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561285d57600080fd5b82600073ffffffffffffffffffffffffffffffffffffffff166003826040518082805190602001908083835b6020831015156128ae5780518252602082019150602081019050602083039250612889565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561292457600080fd5b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002092508473ffffffffffffffffffffffffffffffffffffffff167f4a6dbfc867b179991dec22ff19960f0a94d8d9d891fc556f547764670340e8ae8460010186604051808060200180602001838103835285818154600181600116156101000203166002900481526020019150805460018160011615610100020316600290048015612a2f5780601f10612a0457610100808354040283529160200191612a2f565b820191906000526020600020905b815481529060010190602001808311612a1257829003601f168201915b5050838103825284818151815260200191508051906020019080838360005b83811015612a69578082015181840152602081019050612a4e565b50505050905090810190601f168015612a965780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a26003836001016040518082805460018160011615610100020316600290048015612b065780601f10612ae4576101008083540402835291820191612b06565b820191906000526020600020905b815481529060010190602001808311612af2575b5050915050908152602001604051809103902060006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055846003856040518082805190602001908083835b602083101515612b755780518252602082019150602081019050602083039250612b50565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083836001019080519060200190612bfe929190613baf565b505050505050565b60016020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612cd85780601f10612cad57610100808354040283529160200191612cd8565b820191906000526020600020905b815481529060010190602001808311612cbb57829003601f168201915b505050505090806002018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612d765780601f10612d4b57610100808354040283529160200191612d76565b820191906000526020600020905b815481529060010190602001808311612d5957829003601f168201915b5050505050908060030160009054906101000a900460ff1690806004018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612e275780601f10612dfc57610100808354040283529160200191612e27565b820191906000526020600020905b815481529060010190602001808311612e0a57829003601f168201915b505050505090806005018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612ec55780601f10612e9a57610100808354040283529160200191612ec5565b820191906000526020600020905b815481529060010190602001808311612ea857829003601f168201915b5050505050905086565b600481815481101515612ede57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000606080600060608060006003886040518082805190602001908083835b602083101515612f515780518252602082019150602081019050602083039250612f2c565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050612fb081611bab565b9650965096509650965096505091939550919395565b6060600480548060200260200160405190810160405280929190818152602001828054801561304a57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311613000575b5050505050905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156130b157600080fd5b82600073ffffffffffffffffffffffffffffffffffffffff16600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561315057600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002091508373ffffffffffffffffffffffffffffffffffffffff167f5b19f79ac4e8cfa820815502e11615f1a449e28155dc289ec5cac1a11f908694836004018560405180806020018060200183810383528581815460018160011615610100020316600290048152602001915080546001816001161561010002031660029004801561325b5780601f106132305761010080835404028352916020019161325b565b820191906000526020600020905b81548152906001019060200180831161323e57829003601f168201915b5050838103825284818151815260200191508051906020019080838360005b8381101561329557808201518184015260208101905061327a565b50505050905090810190601f1680156132c25780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a2828260040190805190602001906132e99291906139df565b5050505050565b6000606080600060608060006002886040518082805190602001908083835b602083101515613334578051825260208201915060208101905060208303925061330f565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905061339381611bab565b9650965096509650965096505091939550919395565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561340657600080fd5b82600073ffffffffffffffffffffffffffffffffffffffff16600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156134a557600080fd5b82600073ffffffffffffffffffffffffffffffffffffffff166002826040518082805190602001908083835b6020831015156134f657805182526020820191506020810190506020830392506134d1565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561356c57600080fd5b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002092508473ffffffffffffffffffffffffffffffffffffffff167f53d878a6530e56c9bc96548fa0a8cae4f1d1f49c86b0e934c086b992ebb6998f84600201866040518080602001806020018381038352858181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156136775780601f1061364c57610100808354040283529160200191613677565b820191906000526020600020905b81548152906001019060200180831161365a57829003601f168201915b5050838103825284818151815260200191508051906020019080838360005b838110156136b1578082015181840152602081019050613696565b50505050905090810190601f1680156136de5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a2600283600201604051808280546001816001161561010002031660029004801561374e5780601f1061372c57610100808354040283529182019161374e565b820191906000526020600020905b81548152906001019060200180831161373a575b5050915050908152602001604051809103902060006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055846002856040518082805190602001908083835b6020831015156137bd5780518252602082019150602081019050602083039250613798565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083836002019080519060200190613846929190613baf565b505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156138a957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151561392057806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b81548183558181111561394a578183600052602060002091820191016139499190613c2f565b5b505050565b50805460018160011615610100020316600290046000825580601f106139755750613994565b601f0160209004906000526020600020908101906139939190613c2f565b5b50565b50805460018160011615610100020316600290046000825580601f106139bd57506139dc565b601f0160209004906000526020600020908101906139db9190613c2f565b5b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613a2057805160ff1916838001178555613a4e565b82800160010185558215613a4e579182015b82811115613a4d578251825591602001919060010190613a32565b5b509050613a5b9190613c2f565b5090565b60c060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff1681526020016060815260200160608152602001600060ff16815260200160608152602001606081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613af057805160ff1916838001178555613b1e565b82800160010185558215613b1e579182015b82811115613b1d578251825591602001919060010190613b02565b5b509050613b2b9190613c2f565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613b7057805160ff1916838001178555613b9e565b82800160010185558215613b9e579182015b82811115613b9d578251825591602001919060010190613b82565b5b509050613bab9190613c2f565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613bf057805160ff1916838001178555613c1e565b82800160010185558215613c1e579182015b82811115613c1d578251825591602001919060010190613c02565b5b509050613c2b9190613c2f565b5090565b613c5191905b80821115613c4d576000816000905550600101613c35565b5090565b905600a165627a7a7230582079b5012371b4742e34b5c8ae9d395cb3cad7ea1f451a8751328ff3101524921d0029", + "runtime_bytecode": "0x6080604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806313baf1e6146100eb5780632fbfeba9146101385780633550b6d9146101e1578063563188201461028a5780637abccac9146103135780638da5cb5b14610553578063a880319d146105aa578063c370c86d14610712578063e48603391461079b578063e5df8b84146109db578063e73fc0c314610a48578063ee8c24b814610cae578063eef05f6514610d1a578063efa74f1f14610da3578063f036417f14611009578063f2fde38b14611092575b600080fd5b3480156100f757600080fd5b50610136600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110d5565b005b34801561014457600080fd5b5061019f600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506117e5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101ed57600080fd5b50610248600480360381019080803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061187a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561029657600080fd5b50610311600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061190f565b005b34801561031f57600080fd5b50610354600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bab565b604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001806020018660ff1660ff168152602001806020018060200185810385528a818151815260200191508051906020019080838360005b838110156103de5780820151818401526020810190506103c3565b50505050905090810190601f16801561040b5780820380516001836020036101000a031916815260200191505b50858103845289818151815260200191508051906020019080838360005b83811015610444578082015181840152602081019050610429565b50505050905090810190601f1680156104715780820380516001836020036101000a031916815260200191505b50858103835287818151815260200191508051906020019080838360005b838110156104aa57808201518184015260208101905061048f565b50505050905090810190601f1680156104d75780820380516001836020036101000a031916815260200191505b50858103825286818151815260200191508051906020019080838360005b838110156105105780820151818401526020810190506104f5565b50505050905090810190601f16801561053d5780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b34801561055f57600080fd5b50610568611f45565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105b657600080fd5b50610710600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803560ff169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611f6a565b005b34801561071e57600080fd5b50610799600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050612761565b005b3480156107a757600080fd5b506107dc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612c06565b604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001806020018660ff1660ff168152602001806020018060200185810385528a818151815260200191508051906020019080838360005b8381101561086657808201518184015260208101905061084b565b50505050905090810190601f1680156108935780820380516001836020036101000a031916815260200191505b50858103845289818151815260200191508051906020019080838360005b838110156108cc5780820151818401526020810190506108b1565b50505050905090810190601f1680156108f95780820380516001836020036101000a031916815260200191505b50858103835287818151815260200191508051906020019080838360005b83811015610932578082015181840152602081019050610917565b50505050905090810190601f16801561095f5780820380516001836020036101000a031916815260200191505b50858103825286818151815260200191508051906020019080838360005b8381101561099857808201518184015260208101905061097d565b50505050905090810190601f1680156109c55780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b3480156109e757600080fd5b50610a0660048036038101908080359060200190929190505050612ecf565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610a5457600080fd5b50610aaf600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050612f0d565b604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001806020018660ff1660ff168152602001806020018060200185810385528a818151815260200191508051906020019080838360005b83811015610b39578082015181840152602081019050610b1e565b50505050905090810190601f168015610b665780820380516001836020036101000a031916815260200191505b50858103845289818151815260200191508051906020019080838360005b83811015610b9f578082015181840152602081019050610b84565b50505050905090810190601f168015610bcc5780820380516001836020036101000a031916815260200191505b50858103835287818151815260200191508051906020019080838360005b83811015610c05578082015181840152602081019050610bea565b50505050905090810190601f168015610c325780820380516001836020036101000a031916815260200191505b50858103825286818151815260200191508051906020019080838360005b83811015610c6b578082015181840152602081019050610c50565b50505050905090810190601f168015610c985780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b348015610cba57600080fd5b50610cc3612fc6565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610d06578082015181840152602081019050610ceb565b505050509050019250505060405180910390f35b348015610d2657600080fd5b50610da1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050613054565b005b348015610daf57600080fd5b50610e0a600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506132f0565b604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001806020018660ff1660ff168152602001806020018060200185810385528a818151815260200191508051906020019080838360005b83811015610e94578082015181840152602081019050610e79565b50505050905090810190601f168015610ec15780820380516001836020036101000a031916815260200191505b50858103845289818151815260200191508051906020019080838360005b83811015610efa578082015181840152602081019050610edf565b50505050905090810190601f168015610f275780820380516001836020036101000a031916815260200191505b50858103835287818151815260200191508051906020019080838360005b83811015610f60578082015181840152602081019050610f45565b50505050905090810190601f168015610f8d5780820380516001836020036101000a031916815260200191505b50858103825286818151815260200191508051906020019080838360005b83811015610fc6578082015181840152602081019050610fab565b50505050905090810190601f168015610ff35780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b34801561101557600080fd5b50611090600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506133a9565b005b34801561109e57600080fd5b506110d3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061384e565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561113257600080fd5b82600073ffffffffffffffffffffffffffffffffffffffff16600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156111d157600080fd5b8373ffffffffffffffffffffffffffffffffffffffff166004848154811015156111f757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561124457600080fd5b600460016004805490500381548110151561125b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660048481548110151561129557fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060016004818180549050039150816112f59190613923565b50600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002091508160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f32c54f1e2ea75844ded7517e7dbcd3895da7cd0c28f9ab9f9cf6ecf5f83762c683600101846002018560030160009054906101000a900460ff1686600401876005016040518080602001806020018660ff1660ff168152602001806020018060200185810385528a8181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156114565780601f1061142b57610100808354040283529160200191611456565b820191906000526020600020905b81548152906001019060200180831161143957829003601f168201915b50508581038452898181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156114d95780601f106114ae576101008083540402835291602001916114d9565b820191906000526020600020905b8154815290600101906020018083116114bc57829003601f168201915b505085810383528781815460018160011615610100020316600290048152602001915080546001816001161561010002031660029004801561155c5780601f106115315761010080835404028352916020019161155c565b820191906000526020600020905b81548152906001019060200180831161153f57829003601f168201915b50508581038252868181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156115df5780601f106115b4576101008083540402835291602001916115df565b820191906000526020600020905b8154815290600101906020018083116115c257829003601f168201915b5050995050505050505050505060405180910390a260028260020160405180828054600181600116156101000203166002900480156116555780601f10611633576101008083540402835291820191611655565b820191906000526020600020905b815481529060010190602001808311611641575b5050915050908152602001604051809103902060006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560038260010160405180828054600181600116156101000203166002900480156116ec5780601f106116ca5761010080835404028352918201916116ec565b820191906000526020600020905b8154815290600101906020018083116116d8575b5050915050908152602001604051809103902060006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600182016000611799919061394f565b6002820160006117a9919061394f565b6003820160006101000a81549060ff02191690556004820160006117cd9190613997565b6005820160006117dd9190613997565b505050505050565b60006003826040518082805190602001908083835b60208310151561181f57805182526020820191506020810190506020830392506117fa565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60006002826040518082805190602001908083835b6020831015156118b4578051825260208201915060208101905060208303925061188f565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561196c57600080fd5b82600073ffffffffffffffffffffffffffffffffffffffff16600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515611a0b57600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002091508373ffffffffffffffffffffffffffffffffffffffff167fc3168fdc13112e44a031057dbf6c609b33353addb4d8037d24543e22cbfe2acd8360050185604051808060200180602001838103835285818154600181600116156101000203166002900481526020019150805460018160011615610100020316600290048015611b165780601f10611aeb57610100808354040283529160200191611b16565b820191906000526020600020905b815481529060010190602001808311611af957829003601f168201915b5050838103825284818151815260200191508051906020019080838360005b83811015611b50578082015181840152602081019050611b35565b50505050905090810190601f168015611b7d5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a282826005019080519060200190611ba49291906139df565b5050505050565b60006060806000606080611bbd613a5f565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060c060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611cf75780601f10611ccc57610100808354040283529160200191611cf7565b820191906000526020600020905b815481529060010190602001808311611cda57829003601f168201915b50505050508152602001600282018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611d995780601f10611d6e57610100808354040283529160200191611d99565b820191906000526020600020905b815481529060010190602001808311611d7c57829003601f168201915b505050505081526020016003820160009054906101000a900460ff1660ff1660ff168152602001600482018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611e585780601f10611e2d57610100808354040283529160200191611e58565b820191906000526020600020905b815481529060010190602001808311611e3b57829003601f168201915b50505050508152602001600582018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611efa5780601f10611ecf57610100808354040283529160200191611efa565b820191906000526020600020905b815481529060010190602001808311611edd57829003601f168201915b5050505050815250509050806000015181602001518260400151836060015184608001518560a001518494508393508191508090509650965096509650965096505091939550919395565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611fc557600080fd5b85600073ffffffffffffffffffffffffffffffffffffffff16600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561206357600080fd5b86600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156120a057600080fd5b85600073ffffffffffffffffffffffffffffffffffffffff166002826040518082805190602001908083835b6020831015156120f157805182526020820191506020810190506020830392506120cc565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561216757600080fd5b87600073ffffffffffffffffffffffffffffffffffffffff166003826040518082805190602001908083835b6020831015156121b85780518252602082019150602081019050602083039250612193565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561222e57600080fd5b60c0604051908101604052808b73ffffffffffffffffffffffffffffffffffffffff1681526020018a81526020018981526020018860ff16815260200187815260200186815250600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001019080519060200190612317929190613aaf565b506040820151816002019080519060200190612334929190613aaf565b5060608201518160030160006101000a81548160ff021916908360ff1602179055506080820151816004019080519060200190612372929190613b2f565b5060a082015181600501908051906020019061238f929190613b2f565b5090505060048a90806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050896002896040518082805190602001908083835b602083101515612432578051825260208201915060208101905060208303925061240d565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508960038a6040518082805190602001908083835b6020831015156124dc57805182526020820191506020810190506020830392506124b7565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508973ffffffffffffffffffffffffffffffffffffffff167fd8d928b0b50ca11d9dc273236b46f3526515b03602f71f3a6af4f45bd9fa91448a8a8a8a8a6040518080602001806020018660ff1660ff168152602001806020018060200185810385528a818151815260200191508051906020019080838360005b838110156125e25780820151818401526020810190506125c7565b50505050905090810190601f16801561260f5780820380516001836020036101000a031916815260200191505b50858103845289818151815260200191508051906020019080838360005b8381101561264857808201518184015260208101905061262d565b50505050905090810190601f1680156126755780820380516001836020036101000a031916815260200191505b50858103835287818151815260200191508051906020019080838360005b838110156126ae578082015181840152602081019050612693565b50505050905090810190601f1680156126db5780820380516001836020036101000a031916815260200191505b50858103825286818151815260200191508051906020019080838360005b838110156127145780820151818401526020810190506126f9565b50505050905090810190601f1680156127415780820380516001836020036101000a031916815260200191505b50995050505050505050505060405180910390a250505050505050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156127be57600080fd5b82600073ffffffffffffffffffffffffffffffffffffffff16600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561285d57600080fd5b82600073ffffffffffffffffffffffffffffffffffffffff166003826040518082805190602001908083835b6020831015156128ae5780518252602082019150602081019050602083039250612889565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561292457600080fd5b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002092508473ffffffffffffffffffffffffffffffffffffffff167f4a6dbfc867b179991dec22ff19960f0a94d8d9d891fc556f547764670340e8ae8460010186604051808060200180602001838103835285818154600181600116156101000203166002900481526020019150805460018160011615610100020316600290048015612a2f5780601f10612a0457610100808354040283529160200191612a2f565b820191906000526020600020905b815481529060010190602001808311612a1257829003601f168201915b5050838103825284818151815260200191508051906020019080838360005b83811015612a69578082015181840152602081019050612a4e565b50505050905090810190601f168015612a965780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a26003836001016040518082805460018160011615610100020316600290048015612b065780601f10612ae4576101008083540402835291820191612b06565b820191906000526020600020905b815481529060010190602001808311612af2575b5050915050908152602001604051809103902060006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055846003856040518082805190602001908083835b602083101515612b755780518252602082019150602081019050602083039250612b50565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083836001019080519060200190612bfe929190613baf565b505050505050565b60016020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612cd85780601f10612cad57610100808354040283529160200191612cd8565b820191906000526020600020905b815481529060010190602001808311612cbb57829003601f168201915b505050505090806002018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612d765780601f10612d4b57610100808354040283529160200191612d76565b820191906000526020600020905b815481529060010190602001808311612d5957829003601f168201915b5050505050908060030160009054906101000a900460ff1690806004018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612e275780601f10612dfc57610100808354040283529160200191612e27565b820191906000526020600020905b815481529060010190602001808311612e0a57829003601f168201915b505050505090806005018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612ec55780601f10612e9a57610100808354040283529160200191612ec5565b820191906000526020600020905b815481529060010190602001808311612ea857829003601f168201915b5050505050905086565b600481815481101515612ede57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000606080600060608060006003886040518082805190602001908083835b602083101515612f515780518252602082019150602081019050602083039250612f2c565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050612fb081611bab565b9650965096509650965096505091939550919395565b6060600480548060200260200160405190810160405280929190818152602001828054801561304a57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311613000575b5050505050905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156130b157600080fd5b82600073ffffffffffffffffffffffffffffffffffffffff16600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561315057600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002091508373ffffffffffffffffffffffffffffffffffffffff167f5b19f79ac4e8cfa820815502e11615f1a449e28155dc289ec5cac1a11f908694836004018560405180806020018060200183810383528581815460018160011615610100020316600290048152602001915080546001816001161561010002031660029004801561325b5780601f106132305761010080835404028352916020019161325b565b820191906000526020600020905b81548152906001019060200180831161323e57829003601f168201915b5050838103825284818151815260200191508051906020019080838360005b8381101561329557808201518184015260208101905061327a565b50505050905090810190601f1680156132c25780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a2828260040190805190602001906132e99291906139df565b5050505050565b6000606080600060608060006002886040518082805190602001908083835b602083101515613334578051825260208201915060208101905060208303925061330f565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905061339381611bab565b9650965096509650965096505091939550919395565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561340657600080fd5b82600073ffffffffffffffffffffffffffffffffffffffff16600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156134a557600080fd5b82600073ffffffffffffffffffffffffffffffffffffffff166002826040518082805190602001908083835b6020831015156134f657805182526020820191506020810190506020830392506134d1565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561356c57600080fd5b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002092508473ffffffffffffffffffffffffffffffffffffffff167f53d878a6530e56c9bc96548fa0a8cae4f1d1f49c86b0e934c086b992ebb6998f84600201866040518080602001806020018381038352858181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156136775780601f1061364c57610100808354040283529160200191613677565b820191906000526020600020905b81548152906001019060200180831161365a57829003601f168201915b5050838103825284818151815260200191508051906020019080838360005b838110156136b1578082015181840152602081019050613696565b50505050905090810190601f1680156136de5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a2600283600201604051808280546001816001161561010002031660029004801561374e5780601f1061372c57610100808354040283529182019161374e565b820191906000526020600020905b81548152906001019060200180831161373a575b5050915050908152602001604051809103902060006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055846002856040518082805190602001908083835b6020831015156137bd5780518252602082019150602081019050602083039250613798565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083836002019080519060200190613846929190613baf565b505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156138a957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151561392057806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b81548183558181111561394a578183600052602060002091820191016139499190613c2f565b5b505050565b50805460018160011615610100020316600290046000825580601f106139755750613994565b601f0160209004906000526020600020908101906139939190613c2f565b5b50565b50805460018160011615610100020316600290046000825580601f106139bd57506139dc565b601f0160209004906000526020600020908101906139db9190613c2f565b5b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613a2057805160ff1916838001178555613a4e565b82800160010185558215613a4e579182015b82811115613a4d578251825591602001919060010190613a32565b5b509050613a5b9190613c2f565b5090565b60c060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff1681526020016060815260200160608152602001600060ff16815260200160608152602001606081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613af057805160ff1916838001178555613b1e565b82800160010185558215613b1e579182015b82811115613b1d578251825591602001919060010190613b02565b5b509050613b2b9190613c2f565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613b7057805160ff1916838001178555613b9e565b82800160010185558215613b9e579182015b82811115613b9d578251825591602001919060010190613b82565b5b509050613bab9190613c2f565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613bf057805160ff1916838001178555613c1e565b82800160010185558215613c1e579182015b82811115613c1d578251825591602001919060010190613c02565b5b509050613c2b9190613c2f565b5090565b613c5191905b80821115613c4d576000816000905550600101613c35565b5090565b905600a165627a7a7230582079b5012371b4742e34b5c8ae9d395cb3cad7ea1f451a8751328ff3101524921d0029", + "updated_at": 1525776883974, + "source_map": "901:8364:0:-;;;290:10:1;282:5;;:18;;;;;;;;;;;;;;;;;;901:8364:0;;;;;;", + "source_map_runtime": "901:8364:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3955:650;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3955:650:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7082:114;;8:9:-1;5:2;;;30:1;27;20:12;5:2;7082:114:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6796:122;;8:9:-1;5:2;;;30:1;27;20:12;5:2;6796:122:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6288:295;;8:9:-1;5:2;;;30:1;27;20:12;5:2;6288:295:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7360:550;;8:9:-1;5:2;;;30:1;27;20:12;5:2;7360:550:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;7360:550:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;7360:550:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;7360:550:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;7360:550:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;223:20:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;223:20:1;;;;;;;;;;;;;;;;;;;;;;;;;;;2975:852:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2975:852:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4753:370;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4753:370:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1671:48;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1671:48:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;1671:48:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;1671:48:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;1671:48:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;1671:48:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1818:31;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1818:31:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8067:392;;8:9:-1;5:2;;;30:1;27;20:12;5:2;8067:392:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;8067:392:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;8067:392:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;8067:392:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;8067:392:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9132:131;;8:9:-1;5:2;;;30:1;27;20:12;5:2;9132:131:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;9132:131:0;;;;;;;;;;;;;;;;;5835:288;;8:9:-1;5:2;;;30:1;27;20:12;5:2;5835:288:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8622:400;;8:9:-1;5:2;;;30:1;27;20:12;5:2;8622:400:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;8622:400:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;8622:400:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;8622:400:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;8622:400:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5277:396;;8:9:-1;5:2;;;30:1;27;20:12;5:2;5277:396:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;396:140:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;396:140:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;3955:650:0;4245:27;366:5:1;;;;;;;;;;;352:19;;:10;:19;;;344:28;;;;;;;;4058:6:0;2117:1;2085:34;;:6;:14;2092:6;2085:14;;;;;;;;;;;;;;;:20;;;;;;;;;;;;:34;;;;2077:43;;;;;;;;4114:6;4088:32;;:14;4103:6;4088:22;;;;;;;;;;;;;;;;;;;;;;;;;;;:32;;;4080:41;;;;;;;;4157:14;4196:1;4172:14;:21;;;;:25;4157:41;;;;;;;;;;;;;;;;;;;;;;;;;;;4132:14;4147:6;4132:22;;;;;;;;;;;;;;;;;;:66;;;;;;;;;;;;;;;;;;4233:1;4208:14;:26;;;;;;;;;;;;;;:::i;:::-;;4275:6;:14;4282:6;4275:14;;;;;;;;;;;;;;;4245:44;;4327:5;:11;;;;;;;;;;;;4299:184;;;4352:5;:10;;4376:5;:12;;4402:5;:14;;;;;;;;;;;;4430:5;:14;;4458:5;:15;;4299:184;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4500:13;4514:5;:12;;4500:27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4493:34;;;;;;;;;;;4544:11;4556:5;:10;;4544:23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4537:30;;;;;;;;;;;4584:6;:14;4591:6;4584:14;;;;;;;;;;;;;;;;4577:21;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;:::i;:::-;;;382:1:1;3955:650:0;;;:::o;7082:114::-;7145:7;7171:11;7183:5;7171:18;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;7171:18:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7164:25;;7082:114;;;:::o;6796:122::-;6863:7;6889:13;6903:7;6889:22;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;6889:22:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6882:29;;6796:122;;;:::o;6288:295::-;6424:27;366:5:1;;;;;;;;;;;352:19;;:10;:19;;;344:28;;;;;;;;6402:6:0;2117:1;2085:34;;:6;:14;2092:6;2085:14;;;;;;;;;;;;;;;:20;;;;;;;;;;;;:34;;;;2077:43;;;;;;;;6454:6;:14;6461:6;6454:14;;;;;;;;;;;;;;;6424:44;;6502:6;6478:60;;;6510:5;:15;;6527:10;6478:60;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;6478:60:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6566:10;6548:5;:15;;:28;;;;;;;;;;;;:::i;:::-;;382:1:1;6288:295:0;;;:::o;7360:550::-;7464:7;7501:6;7530;7561:5;7594;7627;7673:26;;:::i;:::-;7702:6;:14;7709:6;7702:14;;;;;;;;;;;;;;;7673:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7747:5;:11;;;7772:5;:10;;;7796:5;:12;;;7822:5;:14;;;7850:5;:14;;;7878:5;:15;;;7726:177;;;;;;;;;;;;;;;;;;;;;;;;7360:550;;;;;;;;:::o;223:20:1:-;;;;;;;;;;;;;:::o;2975:852:0:-;366:5:1;;;;;;;;;;;352:19;;:10;:19;;;344:28;;;;;;;;3199:6:0;2237:1;2205:34;;:6;:14;2212:6;2205:14;;;;;;;;;;;;;;;:20;;;;;;;;;;;;:34;;;2197:43;;;;;;;;3230:6;2582:1;2562:22;;:8;:22;;;;2554:31;;;;;;;;3265:7;2475:1;2441:36;;:13;2455:7;2441:22;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;2441:22:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:36;;;2433:45;;;;;;;;3299:5;2352:1;2322:32;;:11;2334:5;2322:18;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;2322:18:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:32;;;2314:41;;;;;;;;3337:207;;;;;;;;;3372:6;3337:207;;;;;;3398:5;3337:207;;;;3425:7;3337:207;;;;3456:9;3337:207;;;;;;3489:9;3337:207;;;;3523:10;3337:207;;;3320:6;:14;3327:6;3320:14;;;;;;;;;;;;;;;:224;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;3554:14;3574:6;3554:27;;39:1:-1;33:3;27:10;23:18;57:10;52:3;45:23;79:10;72:17;;0:93;3554:27:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3616:6;3591:13;3605:7;3591:22;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;3591:22:0;;;;;;;;;;;;;;;;;;;;;;:31;;;;;;;;;;;;;;;;;;3653:6;3632:11;3644:5;3632:18;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;3632:18:0;;;;;;;;;;;;;;;;;;;;;;:27;;;;;;;;;;;;;;;;;;3694:6;3669:151;;;3714:5;3733:7;3754:9;3777;3800:10;3669:151;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;3669:151:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;3669:151:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;3669:151:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;3669:151:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2488:1;2595;2250;382::1;2975:852:0;;;;;;:::o;4753:370::-;4912:27;366:5:1;;;;;;;;;;;352:19;;:10;:19;;;344:28;;;;;;;;4858:6:0;2117:1;2085:34;;:6;:14;2092:6;2085:14;;;;;;;;;;;;;;;:20;;;;;;;;;;;;:34;;;;2077:43;;;;;;;;4891:5;2352:1;2322:32;;:11;2334:5;2322:18;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;2322:18:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:32;;;2314:41;;;;;;;;4942:6;:14;4949:6;4942:14;;;;;;;;;;;;;;;4912:44;;4985:6;4966:45;;;4993:5;:10;;5005:5;4966:45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;4966:45:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5028:11;5040:5;:10;;5028:23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5021:30;;;;;;;;;;;5082:6;5061:11;5073:5;5061:18;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;5061:18:0;;;;;;;;;;;;;;;;;;;;;;:27;;;;;;;;;;;;;;;;;;5111:5;5098;:10;;:18;;;;;;;;;;;;:::i;:::-;;2130:1;382::1;4753:370:0;;;:::o;1671:48::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;1818:31::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;8067:392::-;8167:7;8204:6;8233;8264:5;8297;8330;8376:14;8393:11;8405:5;8393:18;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;8393:18:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8376:35;;8428:24;8445:6;8428:16;:24::i;:::-;8421:31;;;;;;;;;;;;8067:392;;;;;;;;:::o;9132:131::-;9210:9;9242:14;9235:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9132:131;:::o;5835:288::-;5969:27;366:5:1;;;;;;;;;;;352:19;;:10;:19;;;344:28;;;;;;;;5947:6:0;2117:1;2085:34;;:6;:14;2092:6;2085:14;;;;;;;;;;;;;;;:20;;;;;;;;;;;;:34;;;;2077:43;;;;;;;;5999:6;:14;6006:6;5999:14;;;;;;;;;;;;;;;5969:44;;6046:6;6023:57;;;6054:5;:14;;6070:9;6023:57;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;6023:57:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6107:9;6090:5;:14;;:26;;;;;;;;;;;;:::i;:::-;;382:1:1;5835:288:0;;;:::o;8622:400::-;8726:7;8763:6;8792;8823:5;8856;8889;8935:14;8952:13;8966:7;8952:22;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;8952:22:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8935:39;;8991:24;9008:6;8991:16;:24::i;:::-;8984:31;;;;;;;;;;;;8622:400;;;;;;;;:::o;5277:396::-;5444:27;366:5:1;;;;;;;;;;;352:19;;:10;:19;;;344:28;;;;;;;;5386:6:0;2117:1;2085:34;;:6;:14;2092:6;2085:14;;;;;;;;;;;;;;;:20;;;;;;;;;;;;:34;;;;2077:43;;;;;;;;5421:7;2475:1;2441:36;;:13;2455:7;2441:22;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;2441:22:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:36;;;2433:45;;;;;;;;5474:6;:14;5481:6;5474:14;;;;;;;;;;;;;;;5444:44;;5519:6;5498:51;;;5527:5;:12;;5541:7;5498:51;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;5498:51:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5566:13;5580:5;:12;;5566:27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5559:34;;;;;;;;;;;5628:6;5603:13;5617:7;5603:22;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;5603:22:0;;;;;;;;;;;;;;;;;;;;;;:31;;;;;;;;;;;;;;;;;;5659:7;5644:5;:12;;:22;;;;;;;;;;;;:::i;:::-;;2130:1;382::1;5277:396:0;;;:::o;396:140:1:-;366:5;;;;;;;;;;;352:19;;:10;:19;;;344:28;;;;;;;;485:1;465:22;;:8;:22;;;;461:69;;;511:8;503:5;;:16;;;;;;;;;;;;;;;;;;461:69;396:140;:::o;901:8364:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", + "sources": [ + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/protocol/TokenRegistry/TokenRegistry.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/previous/Ownable/Ownable_v1.sol" + ] + } + } +}
\ No newline at end of file diff --git a/packages/contract-wrappers/test/artifacts/TokenTransferProxy.json b/packages/contract-wrappers/test/artifacts/TokenTransferProxy.json new file mode 100644 index 000000000..3bddda92b --- /dev/null +++ b/packages/contract-wrappers/test/artifacts/TokenTransferProxy.json @@ -0,0 +1,195 @@ +{ + "contract_name": "TokenTransferProxy", + "networks": { + "50": { + "solc_version": "0.4.23", + "source_tree_hash": "0xdf01ff6605f16387ea2d3e043c6bce5d2f6661f23b4243d3783e0ede0e5dfa1d", + "optimizer_enabled": false, + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "token", + "type": "address" + }, + { + "name": "from", + "type": "address" + }, + { + "name": "to", + "type": "address" + }, + { + "name": "value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "target", + "type": "address" + } + ], + "name": "addAuthorizedAddress", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "authorities", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "target", + "type": "address" + } + ], + "name": "removeAuthorizedAddress", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "authorized", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getAuthorizedAddresses", + "outputs": [ + { + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "target", + "type": "address" + }, + { + "indexed": true, + "name": "caller", + "type": "address" + } + ], + "name": "LogAuthorizedAddressAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "target", + "type": "address" + }, + { + "indexed": true, + "name": "caller", + "type": "address" + } + ], + "name": "LogAuthorizedAddressRemoved", + "type": "event" + } + ], + "bytecode": "0x6080604052336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610bdc806100536000396000f30060806040526004361061008e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806315dacbea1461009357806342f1181e14610138578063494503d41461017b57806370712939146101e85780638da5cb5b1461022b578063b918161114610282578063d39de6e9146102dd578063f2fde38b14610349575b600080fd5b34801561009f57600080fd5b5061011e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061038c565b604051808215151515815260200191505060405180910390f35b34801561014457600080fd5b50610179600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610502565b005b34801561018757600080fd5b506101a6600480360381019080803590602001909291905050506106d2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101f457600080fd5b50610229600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610710565b005b34801561023757600080fd5b506102406109b7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561028e57600080fd5b506102c3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109dc565b604051808215151515815260200191505060405180910390f35b3480156102e957600080fd5b506102f26109fc565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561033557808201518184015260208101905061031a565b505050509050019250505060405180910390f35b34801561035557600080fd5b5061038a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a8a565b005b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156103e657600080fd5b8473ffffffffffffffffffffffffffffffffffffffff166323b872dd8585856040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156104bd57600080fd5b505af11580156104d1573d6000803e3d6000fd5b505050506040513d60208110156104e757600080fd5b81019080805190602001909291905050509050949350505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561055d57600080fd5b80600160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156105b757600080fd5b60018060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060028290806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550503373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f94bb87f4c15c4587ff559a7584006fa01ddf9299359be6b512b94527aa961aca60405160405180910390a35050565b6002818154811015156106e157fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561076d57600080fd5b81600160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156107c657600080fd5b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff0219169055600091505b600280549050821015610958578273ffffffffffffffffffffffffffffffffffffffff1660028381548110151561084d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561094b5760026001600280549050038154811015156108ab57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166002838154811015156108e557fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060016002818180549050039150816109459190610b5f565b50610958565b818060010192505061081a565b3373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167ff5b347a1e40749dd050f5f07fbdbeb7e3efa9756903044dd29401fd1d4bb4a1c60405160405180910390a3505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60016020528060005260406000206000915054906101000a900460ff1681565b60606002805480602002602001604051908101604052809291908181526020018280548015610a8057602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610a36575b5050505050905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ae557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515610b5c57806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b815481835581811115610b8657818360005260206000209182019101610b859190610b8b565b5b505050565b610bad91905b80821115610ba9576000816000905550600101610b91565b5090565b905600a165627a7a7230582019abf3c3353c41ed332a6eaa0e17a3c36d048a432d26c0f100e78568cc04497a0029", + "runtime_bytecode": "0x60806040526004361061008e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806315dacbea1461009357806342f1181e14610138578063494503d41461017b57806370712939146101e85780638da5cb5b1461022b578063b918161114610282578063d39de6e9146102dd578063f2fde38b14610349575b600080fd5b34801561009f57600080fd5b5061011e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061038c565b604051808215151515815260200191505060405180910390f35b34801561014457600080fd5b50610179600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610502565b005b34801561018757600080fd5b506101a6600480360381019080803590602001909291905050506106d2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101f457600080fd5b50610229600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610710565b005b34801561023757600080fd5b506102406109b7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561028e57600080fd5b506102c3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109dc565b604051808215151515815260200191505060405180910390f35b3480156102e957600080fd5b506102f26109fc565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561033557808201518184015260208101905061031a565b505050509050019250505060405180910390f35b34801561035557600080fd5b5061038a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a8a565b005b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156103e657600080fd5b8473ffffffffffffffffffffffffffffffffffffffff166323b872dd8585856040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156104bd57600080fd5b505af11580156104d1573d6000803e3d6000fd5b505050506040513d60208110156104e757600080fd5b81019080805190602001909291905050509050949350505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561055d57600080fd5b80600160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156105b757600080fd5b60018060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060028290806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550503373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f94bb87f4c15c4587ff559a7584006fa01ddf9299359be6b512b94527aa961aca60405160405180910390a35050565b6002818154811015156106e157fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561076d57600080fd5b81600160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156107c657600080fd5b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff0219169055600091505b600280549050821015610958578273ffffffffffffffffffffffffffffffffffffffff1660028381548110151561084d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561094b5760026001600280549050038154811015156108ab57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166002838154811015156108e557fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060016002818180549050039150816109459190610b5f565b50610958565b818060010192505061081a565b3373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167ff5b347a1e40749dd050f5f07fbdbeb7e3efa9756903044dd29401fd1d4bb4a1c60405160405180910390a3505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60016020528060005260406000206000915054906101000a900460ff1681565b60606002805480602002602001604051908101604052809291908181526020018280548015610a8057602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610a36575b5050505050905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ae557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515610b5c57806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b815481835581811115610b8657818360005260206000209182019101610b859190610b8b565b5b505050565b610bad91905b80821115610ba9576000816000905550600101610b91565b5090565b905600a165627a7a7230582019abf3c3353c41ed332a6eaa0e17a3c36d048a432d26c0f100e78568cc04497a0029", + "updated_at": 1525776878027, + "source_map": "974:2475:0:-;;;290:10:1;282:5;;:18;;;;;;;;;;;;;;;;;;974:2475:0;;;;;;", + "source_map_runtime": "974:2475:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2929:239;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2929:239:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1776:250;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1776:250:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;1448:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1448:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2140:476;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2140:476:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;223:20:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;223:20:1;;;;;;;;;;;;;;;;;;;;;;;;;;;1399:43:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1399:43:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3314:133;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3314:133:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;3314:133:0;;;;;;;;;;;;;;;;;396:140:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;396:140:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;2929:239:0;3092:4;1142:10;:22;1153:10;1142:22;;;;;;;;;;;;;;;;;;;;;;;;;1134:31;;;;;;;;3125:5;3119:25;;;3145:4;3151:2;3155:5;3119:42;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3119:42:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3119:42:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;3119:42:0;;;;;;;;;;;;;;;;3112:49;;2929:239;;;;;;:::o;1776:250::-;366:5:1;;;;;;;;;;;352:19;;:10;:19;;;344:28;;;;;;;;1883:6:0;1356:10;:18;1367:6;1356:18;;;;;;;;;;;;;;;;;;;;;;;;;1355:19;1347:28;;;;;;;;1926:4;1905:10;:18;1916:6;1905:18;;;;;;;;;;;;;;;;:25;;;;;;;;;;;;;;;;;;1940:11;1957:6;1940:24;;39:1:-1;33:3;27:10;23:18;57:10;52:3;45:23;79:10;72:17;;0:93;1940:24:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2008:10;1974:45;;2000:6;1974:45;;;;;;;;;;;;382:1:1;1776:250:0;:::o;1448:28::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;2140:476::-;2309:6;366:5:1;;;;;;;;;;;352:19;;:10;:19;;;344:28;;;;;;;;2247:6:0;1249:10;:18;1260:6;1249:18;;;;;;;;;;;;;;;;;;;;;;;;;1241:27;;;;;;;;2276:10;:18;2287:6;2276:18;;;;;;;;;;;;;;;;2269:25;;;;;;;;;;;2318:1;2309:10;;2304:249;2325:11;:18;;;;2321:1;:22;2304:249;;;2386:6;2368:24;;:11;2380:1;2368:14;;;;;;;;;;;;;;;;;;;;;;;;;;;:24;;;2364:179;;;2429:11;2462:1;2441:11;:18;;;;:22;2429:35;;;;;;;;;;;;;;;;;;;;;;;;;;;2412:11;2424:1;2412:14;;;;;;;;;;;;;;;;;;:52;;;;;;;;;;;;;;;;;;2504:1;2482:11;:23;;;;;;;;;;;;;;:::i;:::-;;2523:5;;2364:179;2345:3;;;;;;;2304:249;;;2598:10;2562:47;;2590:6;2562:47;;;;;;;;;;;;382:1:1;2140:476:0;;:::o;223:20:1:-;;;;;;;;;;;;;:::o;1399:43:0:-;;;;;;;;;;;;;;;;;;;;;;:::o;3314:133::-;3397:9;3429:11;3422:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3314:133;:::o;396:140:1:-;366:5;;;;;;;;;;;352:19;;:10;:19;;;344:28;;;;;;;;485:1;465:22;;:8;:22;;;;461:69;;;511:8;503:5;;:16;;;;;;;;;;;;;;;;;;461:69;396:140;:::o;974:2475:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", + "sources": [ + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/protocol/TokenTransferProxy/TokenTransferProxy.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/previous/Ownable/Ownable_v1.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/previous/Token/Token_v1.sol" + ] + } + } +}
\ No newline at end of file diff --git a/packages/contract-wrappers/test/artifacts/WETH9.json b/packages/contract-wrappers/test/artifacts/WETH9.json new file mode 100644 index 000000000..8c9921ea9 --- /dev/null +++ b/packages/contract-wrappers/test/artifacts/WETH9.json @@ -0,0 +1,297 @@ +{ + "contract_name": "WETH9", + "networks": { + "50": { + "solc_version": "0.4.23", + "source_tree_hash": "0xce985174db1a24d312c0d544abb926a9b107bd9abd6424288a8e54a16d3e006b", + "optimizer_enabled": false, + "abi": [ + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "guy", + "type": "address" + }, + { + "name": "wad", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "src", + "type": "address" + }, + { + "name": "dst", + "type": "address" + }, + { + "name": "wad", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "wad", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "dst", + "type": "address" + }, + { + "name": "wad", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "deposit", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "src", + "type": "address" + }, + { + "indexed": true, + "name": "guy", + "type": "address" + }, + { + "indexed": false, + "name": "wad", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "src", + "type": "address" + }, + { + "indexed": true, + "name": "dst", + "type": "address" + }, + { + "indexed": false, + "name": "wad", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "dst", + "type": "address" + }, + { + "indexed": false, + "name": "wad", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "src", + "type": "address" + }, + { + "indexed": false, + "name": "wad", + "type": "uint256" + } + ], + "name": "Withdrawal", + "type": "event" + } + ], + "bytecode": "0x60806040526040805190810160405280600d81526020017f57726170706564204574686572000000000000000000000000000000000000008152506000908051906020019061004f9291906100ca565b506040805190810160405280600481526020017f57455448000000000000000000000000000000000000000000000000000000008152506001908051906020019061009b9291906100ca565b506012600260006101000a81548160ff021916908360ff1602179055503480156100c457600080fd5b5061016f565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061010b57805160ff1916838001178555610139565b82800160010185558215610139579182015b8281111561013857825182559160200191906001019061011d565b5b509050610146919061014a565b5090565b61016c91905b80821115610168576000816000905550600101610150565b5090565b90565b610c848061017e6000396000f3006080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b9578063095ea7b31461014957806318160ddd146101ae57806323b872dd146101d95780632e1a7d4d1461025e578063313ce5671461028b57806370a08231146102bc57806395d89b4114610313578063a9059cbb146103a3578063d0e30db014610408578063dd62ed3e14610412575b6100b7610489565b005b3480156100c557600080fd5b506100ce610526565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561010e5780820151818401526020810190506100f3565b50505050905090810190601f16801561013b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015557600080fd5b50610194600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105c4565b604051808215151515815260200191505060405180910390f35b3480156101ba57600080fd5b506101c36106b6565b6040518082815260200191505060405180910390f35b3480156101e557600080fd5b50610244600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106d5565b604051808215151515815260200191505060405180910390f35b34801561026a57600080fd5b5061028960048036038101908080359060200190929190505050610a22565b005b34801561029757600080fd5b506102a0610b55565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102c857600080fd5b506102fd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b68565b6040518082815260200191505060405180910390f35b34801561031f57600080fd5b50610328610b80565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561036857808201518184015260208101905061034d565b50505050905090810190601f1680156103955780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103af57600080fd5b506103ee600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c1e565b604051808215151515815260200191505060405180910390f35b610410610489565b005b34801561041e57600080fd5b50610473600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c33565b6040518082815260200191505060405180910390f35b34600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a2565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105bc5780601f10610591576101008083540402835291602001916105bc565b820191906000526020600020905b81548152906001019060200180831161059f57829003601f168201915b505050505081565b600081600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b600081600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561072557600080fd5b3373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156107fd57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414155b156109185781600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561088d57600080fd5b81600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b81600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b80600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610a7057600080fd5b80600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610b03573d6000803e3d6000fd5b503373ffffffffffffffffffffffffffffffffffffffff167f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65826040518082815260200191505060405180910390a250565b600260009054906101000a900460ff1681565b60036020528060005260406000206000915090505481565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c165780601f10610beb57610100808354040283529160200191610c16565b820191906000526020600020905b815481529060010190602001808311610bf957829003601f168201915b505050505081565b6000610c2b3384846106d5565b905092915050565b60046020528160005260406000206020528060005260406000206000915091505054815600a165627a7a72305820d175401491ad9641c172c2a2b4c29d21c9acf724d3dda0c84d93d2cd2306d39d0029", + "runtime_bytecode": "0x6080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b9578063095ea7b31461014957806318160ddd146101ae57806323b872dd146101d95780632e1a7d4d1461025e578063313ce5671461028b57806370a08231146102bc57806395d89b4114610313578063a9059cbb146103a3578063d0e30db014610408578063dd62ed3e14610412575b6100b7610489565b005b3480156100c557600080fd5b506100ce610526565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561010e5780820151818401526020810190506100f3565b50505050905090810190601f16801561013b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015557600080fd5b50610194600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105c4565b604051808215151515815260200191505060405180910390f35b3480156101ba57600080fd5b506101c36106b6565b6040518082815260200191505060405180910390f35b3480156101e557600080fd5b50610244600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106d5565b604051808215151515815260200191505060405180910390f35b34801561026a57600080fd5b5061028960048036038101908080359060200190929190505050610a22565b005b34801561029757600080fd5b506102a0610b55565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102c857600080fd5b506102fd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b68565b6040518082815260200191505060405180910390f35b34801561031f57600080fd5b50610328610b80565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561036857808201518184015260208101905061034d565b50505050905090810190601f1680156103955780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103af57600080fd5b506103ee600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c1e565b604051808215151515815260200191505060405180910390f35b610410610489565b005b34801561041e57600080fd5b50610473600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c33565b6040518082815260200191505060405180910390f35b34600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a2565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105bc5780601f10610591576101008083540402835291602001916105bc565b820191906000526020600020905b81548152906001019060200180831161059f57829003601f168201915b505050505081565b600081600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b600081600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561072557600080fd5b3373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156107fd57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414155b156109185781600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561088d57600080fd5b81600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b81600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b80600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610a7057600080fd5b80600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610b03573d6000803e3d6000fd5b503373ffffffffffffffffffffffffffffffffffffffff167f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65826040518082815260200191505060405180910390a250565b600260009054906101000a900460ff1681565b60036020528060005260406000206000915090505481565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c165780601f10610beb57610100808354040283529160200191610c16565b820191906000526020600020905b815481529060010190602001808311610bf957829003601f168201915b505050505081565b6000610c2b3384846106d5565b905092915050565b60046020528160005260406000206020528060005260406000206000915091505054815600a165627a7a72305820d175401491ad9641c172c2a2b4c29d21c9acf724d3dda0c84d93d2cd2306d39d0029", + "updated_at": 1525776877344, + "source_map": "712:1778:0:-;;;733:40;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;779:31;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;841:2;816:27;;;;;;;;;;;;;;;;;;;;712:1778;8:9:-1;5:2;;;30:1;27;20:12;5:2;712:1778:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;", + "source_map_runtime": "712:1778:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1281:9;:7;:9::i;:::-;712:1778;733:40;;8:9:-1;5:2;;;30:1;27;20:12;5:2;733:40:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;733:40:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1728:172;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1728:172:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1636:86;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1636:86:0;;;;;;;;;;;;;;;;;;;;;;;2033:455;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2033:455:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1432:198;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1432:198:0;;;;;;;;;;;;;;;;;;;;;;;;;;816:27;;8:9:-1;5:2;;;30:1;27;20:12;5:2;816:27:0;;;;;;;;;;;;;;;;;;;;;;;;;;;1102:65;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1102:65:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;779:31;;8:9:-1;5:2;;;30:1;27;20:12;5:2;779:31:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;779:31:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1906:121;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1906:121:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1302:125;;;;;;1173:65;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1173:65:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1302:125;1371:9;1346;:21;1356:10;1346:21;;;;;;;;;;;;;;;;:34;;;;;;;;;;;1398:10;1390:30;;;1410:9;1390:30;;;;;;;;;;;;;;;;;;1302:125::o;733:40::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;1728:172::-;1784:4;1829:3;1800:9;:21;1810:10;1800:21;;;;;;;;;;;;;;;:26;1822:3;1800:26;;;;;;;;;;;;;;;:32;;;;1863:3;1842:30;;1851:10;1842:30;;;1868:3;1842:30;;;;;;;;;;;;;;;;;;1889:4;1882:11;;1728:172;;;;:::o;1636:86::-;1680:4;1703;:12;;;1696:19;;1636:86;:::o;2033:455::-;2123:4;2169:3;2151:9;:14;2161:3;2151:14;;;;;;;;;;;;;;;;:21;;2143:30;;;;;;;;2195:10;2188:17;;:3;:17;;;;:59;;;;;2244:2;2209:9;:14;2219:3;2209:14;;;;;;;;;;;;;;;:26;2224:10;2209:26;;;;;;;;;;;;;;;;:38;;2188:59;2184:179;;;2301:3;2271:9;:14;2281:3;2271:14;;;;;;;;;;;;;;;:26;2286:10;2271:26;;;;;;;;;;;;;;;;:33;;2263:42;;;;;;;;2349:3;2319:9;:14;2329:3;2319:14;;;;;;;;;;;;;;;:26;2334:10;2319:26;;;;;;;;;;;;;;;;:33;;;;;;;;;;;2184:179;2391:3;2373:9;:14;2383:3;2373:14;;;;;;;;;;;;;;;;:21;;;;;;;;;;;2422:3;2404:9;:14;2414:3;2404:14;;;;;;;;;;;;;;;;:21;;;;;;;;;;;2450:3;2436:23;;2445:3;2436:23;;;2455:3;2436:23;;;;;;;;;;;;;;;;;;2477:4;2470:11;;2033:455;;;;;:::o;1432:198::-;1510:3;1485:9;:21;1495:10;1485:21;;;;;;;;;;;;;;;;:28;;1477:37;;;;;;;;1549:3;1524:9;:21;1534:10;1524:21;;;;;;;;;;;;;;;;:28;;;;;;;;;;;1562:10;:19;;:24;1582:3;1562:24;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1562:24:0;1607:10;1596:27;;;1619:3;1596:27;;;;;;;;;;;;;;;;;;1432:198;:::o;816:27::-;;;;;;;;;;;;;:::o;1102:65::-;;;;;;;;;;;;;;;;;:::o;779:31::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;1906:121::-;1963:4;1986:34;1999:10;2011:3;2016;1986:12;:34::i;:::-;1979:41;;1906:121;;;;:::o;1173:65::-;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", + "sources": [ + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/tokens/WETH9/WETH9.sol" + ] + } + } +}
\ No newline at end of file diff --git a/packages/contract-wrappers/test/artifacts/ZRXToken.json b/packages/contract-wrappers/test/artifacts/ZRXToken.json new file mode 100644 index 000000000..370b595b3 --- /dev/null +++ b/packages/contract-wrappers/test/artifacts/ZRXToken.json @@ -0,0 +1,244 @@ +{ + "contract_name": "ZRXToken", + "networks": { + "50": { + "solc_version": "0.4.23", + "source_tree_hash": "0xa2899bdb1c73e3ea6e53dc3f6a150b74f770578765c3f35ce41b912024eef73a", + "optimizer_enabled": false, + "abi": [ + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_spender", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_from", + "type": "address" + }, + { + "indexed": true, + "name": "_to", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "name": "_spender", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + } + ], + "bytecode": "0x60806040526b033b2e3c9fd0803ce800000060035534801561002057600080fd5b506003546000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610baa806100756000396000f300608060405260043610610099576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461009e578063095ea7b31461012e57806318160ddd1461019357806323b872dd146101be578063313ce5671461024357806370a082311461027457806395d89b41146102cb578063a9059cbb1461035b578063dd62ed3e146103c0575b600080fd5b3480156100aa57600080fd5b506100b3610437565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f35780820151818401526020810190506100d8565b50505050905090810190601f1680156101205780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561013a57600080fd5b50610179600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610470565b604051808215151515815260200191505060405180910390f35b34801561019f57600080fd5b506101a8610562565b6040518082815260200191505060405180910390f35b3480156101ca57600080fd5b50610229600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610568565b604051808215151515815260200191505060405180910390f35b34801561024f57600080fd5b5061025861088d565b604051808260ff1660ff16815260200191505060405180910390f35b34801561028057600080fd5b506102b5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610892565b6040518082815260200191505060405180910390f35b3480156102d757600080fd5b506102e06108da565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610320578082015181840152602081019050610305565b50505050905090810190601f16801561034d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561036757600080fd5b506103a6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610913565b604051808215151515815260200191505060405180910390f35b3480156103cc57600080fd5b50610421600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610af7565b6040518082815260200191505060405180910390f35b6040805190810160405280601181526020017f30782050726f746f636f6c20546f6b656e00000000000000000000000000000081525081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60035481565b600080600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156106385750828110155b80156106c257506000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110155b1561088057826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8110156108125782600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150610885565b600091505b509392505050565b601281565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6040805190810160405280600381526020017f5a5258000000000000000000000000000000000000000000000000000000000081525081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156109e157506000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110155b15610aec57816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610af1565b600090505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050929150505600a165627a7a72305820d5e19074d9eddbaa91fbfc50095d45cf4ba503ae06672b8f8cd016cba94d05520029", + "runtime_bytecode": "0x608060405260043610610099576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461009e578063095ea7b31461012e57806318160ddd1461019357806323b872dd146101be578063313ce5671461024357806370a082311461027457806395d89b41146102cb578063a9059cbb1461035b578063dd62ed3e146103c0575b600080fd5b3480156100aa57600080fd5b506100b3610437565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f35780820151818401526020810190506100d8565b50505050905090810190601f1680156101205780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561013a57600080fd5b50610179600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610470565b604051808215151515815260200191505060405180910390f35b34801561019f57600080fd5b506101a8610562565b6040518082815260200191505060405180910390f35b3480156101ca57600080fd5b50610229600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610568565b604051808215151515815260200191505060405180910390f35b34801561024f57600080fd5b5061025861088d565b604051808260ff1660ff16815260200191505060405180910390f35b34801561028057600080fd5b506102b5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610892565b6040518082815260200191505060405180910390f35b3480156102d757600080fd5b506102e06108da565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610320578082015181840152602081019050610305565b50505050905090810190601f16801561034d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561036757600080fd5b506103a6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610913565b604051808215151515815260200191505060405180910390f35b3480156103cc57600080fd5b50610421600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610af7565b6040518082815260200191505060405180910390f35b6040805190810160405280601181526020017f30782050726f746f636f6c20546f6b656e00000000000000000000000000000081525081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60035481565b600080600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156106385750828110155b80156106c257506000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110155b1561088057826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8110156108125782600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150610885565b600091505b509392505050565b601281565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6040805190810160405280600381526020017f5a5258000000000000000000000000000000000000000000000000000000000081525081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156109e157506000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110155b15610aec57816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610af1565b600090505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050929150505600a165627a7a72305820d5e19074d9eddbaa91fbfc50095d45cf4ba503ae06672b8f8cd016cba94d05520029", + "updated_at": 1525776876413, + "source_map": "753:342:0:-;;;872:6;846:32;;1022:71;8:9:-1;5:2;;;30:1;27;20:12;5:2;1022:71:0;1075:11;;1052:8;:20;1061:10;1052:20;;;;;;;;;;;;;;;:34;;;;753:342;;;;;;", + "source_map_runtime": "753:342:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;923:49;;8:9:-1;5:2;;;30:1;27;20:12;5:2;923:49:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;923:49:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1087:187:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1087:187:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;846:32:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;846:32:0;;;;;;;;;;;;;;;;;;;;;;;1066:609:3;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1066:609:3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;805:35:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;805:35:0;;;;;;;;;;;;;;;;;;;;;;;;;;;982:99:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;982:99:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;978:37:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;978:37:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;978:37:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;125:410:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;125:410:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1280:126;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1280:126:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;923:49:0;;;;;;;;;;;;;;;;;;;;:::o;1087:187:1:-;1144:4;1192:6;1160:7;:19;1168:10;1160:19;;;;;;;;;;;;;;;:29;1180:8;1160:29;;;;;;;;;;;;;;;:38;;;;1229:8;1208:38;;1217:10;1208:38;;;1239:6;1208:38;;;;;;;;;;;;;;;;;;1263:4;1256:11;;1087:187;;;;:::o;846:32:0:-;;;;:::o;1066:609:3:-;1161:4;1181:14;1198:7;:14;1206:5;1198:14;;;;;;;;;;;;;;;:26;1213:10;1198:26;;;;;;;;;;;;;;;;1181:43;;1257:6;1238:8;:15;1247:5;1238:15;;;;;;;;;;;;;;;;:25;;:60;;;;;1292:6;1279:9;:19;;1238:60;:115;;;;;1340:8;:13;1349:3;1340:13;;;;;;;;;;;;;;;;1330:6;1314:8;:13;1323:3;1314:13;;;;;;;;;;;;;;;;:22;:39;;1238:115;1234:435;;;1395:6;1378:8;:13;1387:3;1378:13;;;;;;;;;;;;;;;;:23;;;;;;;;;;;1434:6;1415:8;:15;1424:5;1415:15;;;;;;;;;;;;;;;;:25;;;;;;;;;;;768:10;1458:9;:20;1454:95;;;1528:6;1498:7;:14;1506:5;1498:14;;;;;;;;;;;;;;;:26;1513:10;1498:26;;;;;;;;;;;;;;;;:36;;;;;;;;;;;1454:95;1578:3;1562:28;;1571:5;1562:28;;;1583:6;1562:28;;;;;;;;;;;;;;;;;;1611:4;1604:11;;;;1234:435;1653:5;1646:12;;1066:609;;;;;;;:::o;805:35:0:-;838:2;805:35;:::o;982:99:1:-;1035:4;1058:8;:16;1067:6;1058:16;;;;;;;;;;;;;;;;1051:23;;982:99;;;:::o;978:37:0:-;;;;;;;;;;;;;;;;;;;;:::o;125:410:1:-;178:4;291:6;267:8;:20;276:10;267:20;;;;;;;;;;;;;;;;:30;;:73;;;;;327:8;:13;336:3;327:13;;;;;;;;;;;;;;;;317:6;301:8;:13;310:3;301:13;;;;;;;;;;;;;;;;:22;:39;;267:73;263:266;;;380:6;356:8;:20;365:10;356:20;;;;;;;;;;;;;;;;:30;;;;;;;;;;;417:6;400:8;:13;409:3;400:13;;;;;;;;;;;;;;;;:23;;;;;;;;;;;458:3;437:33;;446:10;437:33;;;463:6;437:33;;;;;;;;;;;;;;;;;;491:4;484:11;;;;263:266;521:5;514:12;;125:410;;;;;:::o;1280:126::-;1351:4;1374:7;:15;1382:6;1374:15;;;;;;;;;;;;;;;:25;1390:8;1374:25;;;;;;;;;;;;;;;;1367:32;;1280:126;;;;:::o", + "sources": [ + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/current/tokens/ZRXToken/ZRXToken.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/previous/ERC20Token/ERC20Token_v1.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/previous/Token/Token_v1.sol", + "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/contracts/src/contracts/previous/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol" + ] + } + } +}
\ No newline at end of file diff --git a/packages/contract-wrappers/test/artifacts_test.ts b/packages/contract-wrappers/test/artifacts_test.ts new file mode 100644 index 000000000..5d7261e09 --- /dev/null +++ b/packages/contract-wrappers/test/artifacts_test.ts @@ -0,0 +1,49 @@ +import { web3Factory } from '@0xproject/dev-utils'; +import * as fs from 'fs'; + +import { ContractWrappers } from '../src'; + +import { chaiSetup } from './utils/chai_setup'; +import { constants } from './utils/constants'; + +chaiSetup.configure(); + +// Those tests are slower cause they're talking to a remote node +const TIMEOUT = 10000; + +describe('Artifacts', () => { + describe('contracts are deployed on kovan', () => { + const kovanRpcUrl = constants.KOVAN_RPC_URL; + const provider = web3Factory.create({ rpcUrl: kovanRpcUrl }).currentProvider; + const config = { + networkId: constants.KOVAN_NETWORK_ID, + }; + const contractWrappers = new ContractWrappers(provider, config); + it('token registry contract is deployed', async () => { + await (contractWrappers.tokenRegistry as any)._getTokenRegistryContractAsync(); + }).timeout(TIMEOUT); + it('proxy contract is deployed', async () => { + await (contractWrappers.proxy as any)._getTokenTransferProxyContractAsync(); + }).timeout(TIMEOUT); + it('exchange contract is deployed', async () => { + await (contractWrappers.exchange as any)._getExchangeContractAsync(); + }).timeout(TIMEOUT); + }); + describe('contracts are deployed on ropsten', () => { + const ropstenRpcUrl = constants.ROPSTEN_RPC_URL; + const provider = web3Factory.create({ rpcUrl: ropstenRpcUrl }).currentProvider; + const config = { + networkId: constants.ROPSTEN_NETWORK_ID, + }; + const contractWrappers = new ContractWrappers(provider, config); + it('token registry contract is deployed', async () => { + await (contractWrappers.tokenRegistry as any)._getTokenRegistryContractAsync(); + }).timeout(TIMEOUT); + it('proxy contract is deployed', async () => { + await (contractWrappers.proxy as any)._getTokenTransferProxyContractAsync(); + }).timeout(TIMEOUT); + it('exchange contract is deployed', async () => { + await (contractWrappers.exchange as any)._getExchangeContractAsync(); + }).timeout(TIMEOUT); + }); +}); diff --git a/packages/0x.js/test/ether_token_wrapper_test.ts b/packages/contract-wrappers/test/ether_token_wrapper_test.ts index 99c42fe0b..e9a9705b1 100644 --- a/packages/0x.js/test/ether_token_wrapper_test.ts +++ b/packages/contract-wrappers/test/ether_token_wrapper_test.ts @@ -1,4 +1,5 @@ -import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils'; +import { BlockchainLifecycle, callbackErrorReporter, devConstants, web3Factory } from '@0xproject/dev-utils'; +import { DoneCallback } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; @@ -8,20 +9,18 @@ import { ApprovalContractEventArgs, BlockParamLiteral, BlockRange, + ContractWrappers, + ContractWrappersError, DecodedLogEvent, DepositContractEventArgs, EtherTokenEvents, Token, TransferContractEventArgs, WithdrawalContractEventArgs, - ZeroEx, - ZeroExError, } from '../src'; -import { DoneCallback } from '../src/types'; import { chaiSetup } from './utils/chai_setup'; import { constants } from './utils/constants'; -import { reportNodeCallbackErrors } from './utils/report_callback_errors'; import { TokenUtils } from './utils/token_utils'; import { provider, web3Wrapper } from './utils/web3_wrapper'; @@ -36,7 +35,7 @@ const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); const MAX_REASONABLE_GAS_COST_IN_WEI = 62517; describe('EtherTokenWrapper', () => { - let zeroEx: ZeroEx; + let contractWrappers: ContractWrappers; let tokens: Token[]; let userAddresses: string[]; let addressWithETH: string; @@ -54,11 +53,11 @@ describe('EtherTokenWrapper', () => { const depositAmount = new BigNumber(42); const withdrawalAmount = new BigNumber(42); before(async () => { - zeroEx = new ZeroEx(provider, zeroExConfig); - tokens = await zeroEx.tokenRegistry.getTokensAsync(); - userAddresses = await zeroEx.getAvailableAddressesAsync(); + contractWrappers = new ContractWrappers(provider, zeroExConfig); + tokens = await contractWrappers.tokenRegistry.getTokensAsync(); + userAddresses = await web3Wrapper.getAvailableAddressesAsync(); addressWithETH = userAddresses[0]; - wethContractAddress = zeroEx.etherToken.getContractAddressIfExists() as string; + wethContractAddress = contractWrappers.etherToken.getContractAddressIfExists() as string; depositWeiAmount = Web3Wrapper.toWei(new BigNumber(5)); decimalPlaces = 7; addressWithoutFunds = userAddresses[1]; @@ -71,14 +70,14 @@ describe('EtherTokenWrapper', () => { }); describe('#getContractAddressIfExists', async () => { it('should return contract address if connected to a known network', () => { - const contractAddressIfExists = zeroEx.etherToken.getContractAddressIfExists(); + const contractAddressIfExists = contractWrappers.etherToken.getContractAddressIfExists(); expect(contractAddressIfExists).to.not.be.undefined(); }); it('should throw if connected to a private network and contract addresses are not specified', () => { const UNKNOWN_NETWORK_NETWORK_ID = 10; expect( () => - new ZeroEx(provider, { + new ContractWrappers(provider, { networkId: UNKNOWN_NETWORK_NETWORK_ID, } as any), ).to.throw(); @@ -86,16 +85,23 @@ describe('EtherTokenWrapper', () => { }); describe('#depositAsync', () => { it('should successfully deposit ETH and issue Wrapped ETH tokens', async () => { - const preETHBalance = await (zeroEx as any)._web3Wrapper.getBalanceInWeiAsync(addressWithETH); - const preWETHBalance = await zeroEx.token.getBalanceAsync(wethContractAddress, addressWithETH); + const preETHBalance = await web3Wrapper.getBalanceInWeiAsync(addressWithETH); + const preWETHBalance = await contractWrappers.token.getBalanceAsync(wethContractAddress, addressWithETH); expect(preETHBalance).to.be.bignumber.gt(0); expect(preWETHBalance).to.be.bignumber.equal(0); - const txHash = await zeroEx.etherToken.depositAsync(wethContractAddress, depositWeiAmount, addressWithETH); - await zeroEx.awaitTransactionMinedAsync(txHash); + const txHash = await contractWrappers.etherToken.depositAsync( + wethContractAddress, + depositWeiAmount, + addressWithETH, + ); + await web3Wrapper.awaitTransactionMinedAsync(txHash); - const postETHBalanceInWei = await (zeroEx as any)._web3Wrapper.getBalanceInWeiAsync(addressWithETH); - const postWETHBalanceInBaseUnits = await zeroEx.token.getBalanceAsync(wethContractAddress, addressWithETH); + const postETHBalanceInWei = await web3Wrapper.getBalanceInWeiAsync(addressWithETH); + const postWETHBalanceInBaseUnits = await contractWrappers.token.getBalanceAsync( + wethContractAddress, + addressWithETH, + ); expect(postWETHBalanceInBaseUnits).to.be.bignumber.equal(depositWeiAmount); const remainingETHInWei = preETHBalance.minus(depositWeiAmount); @@ -103,34 +109,41 @@ describe('EtherTokenWrapper', () => { expect(gasCost).to.be.bignumber.lte(MAX_REASONABLE_GAS_COST_IN_WEI); }); it('should throw if user has insufficient ETH balance for deposit', async () => { - const preETHBalance = await (zeroEx as any)._web3Wrapper.getBalanceInWeiAsync(addressWithETH); + const preETHBalance = await web3Wrapper.getBalanceInWeiAsync(addressWithETH); const extraETHBalance = Web3Wrapper.toWei(new BigNumber(5)); const overETHBalanceinWei = preETHBalance.add(extraETHBalance); return expect( - zeroEx.etherToken.depositAsync(wethContractAddress, overETHBalanceinWei, addressWithETH), - ).to.be.rejectedWith(ZeroExError.InsufficientEthBalanceForDeposit); + contractWrappers.etherToken.depositAsync(wethContractAddress, overETHBalanceinWei, addressWithETH), + ).to.be.rejectedWith(ContractWrappersError.InsufficientEthBalanceForDeposit); }); }); describe('#withdrawAsync', () => { it('should successfully withdraw ETH in return for Wrapped ETH tokens', async () => { - const ETHBalanceInWei = await (zeroEx as any)._web3Wrapper.getBalanceInWeiAsync(addressWithETH); + const ETHBalanceInWei = await web3Wrapper.getBalanceInWeiAsync(addressWithETH); - await zeroEx.etherToken.depositAsync(wethContractAddress, depositWeiAmount, addressWithETH); + await contractWrappers.etherToken.depositAsync(wethContractAddress, depositWeiAmount, addressWithETH); const expectedPreETHBalance = ETHBalanceInWei.minus(depositWeiAmount); - const preETHBalance = await (zeroEx as any)._web3Wrapper.getBalanceInWeiAsync(addressWithETH); - const preWETHBalance = await zeroEx.token.getBalanceAsync(wethContractAddress, addressWithETH); + const preETHBalance = await web3Wrapper.getBalanceInWeiAsync(addressWithETH); + const preWETHBalance = await contractWrappers.token.getBalanceAsync(wethContractAddress, addressWithETH); let gasCost = expectedPreETHBalance.minus(preETHBalance); expect(gasCost).to.be.bignumber.lte(MAX_REASONABLE_GAS_COST_IN_WEI); expect(preWETHBalance).to.be.bignumber.equal(depositWeiAmount); - const txHash = await zeroEx.etherToken.withdrawAsync(wethContractAddress, depositWeiAmount, addressWithETH); - await zeroEx.awaitTransactionMinedAsync(txHash); + const txHash = await contractWrappers.etherToken.withdrawAsync( + wethContractAddress, + depositWeiAmount, + addressWithETH, + ); + await web3Wrapper.awaitTransactionMinedAsync(txHash); - const postETHBalance = await (zeroEx as any)._web3Wrapper.getBalanceInWeiAsync(addressWithETH); - const postWETHBalanceInBaseUnits = await zeroEx.token.getBalanceAsync(wethContractAddress, addressWithETH); + const postETHBalance = await web3Wrapper.getBalanceInWeiAsync(addressWithETH); + const postWETHBalanceInBaseUnits = await contractWrappers.token.getBalanceAsync( + wethContractAddress, + addressWithETH, + ); expect(postWETHBalanceInBaseUnits).to.be.bignumber.equal(0); const expectedETHBalance = preETHBalance.add(depositWeiAmount).round(decimalPlaces); @@ -138,14 +151,14 @@ describe('EtherTokenWrapper', () => { expect(gasCost).to.be.bignumber.lte(MAX_REASONABLE_GAS_COST_IN_WEI); }); it('should throw if user has insufficient WETH balance for withdrawal', async () => { - const preWETHBalance = await zeroEx.token.getBalanceAsync(wethContractAddress, addressWithETH); + const preWETHBalance = await contractWrappers.token.getBalanceAsync(wethContractAddress, addressWithETH); expect(preWETHBalance).to.be.bignumber.equal(0); const overWETHBalance = preWETHBalance.add(999999999); return expect( - zeroEx.etherToken.withdrawAsync(wethContractAddress, overWETHBalance, addressWithETH), - ).to.be.rejectedWith(ZeroExError.InsufficientWEthBalanceForWithdrawal); + contractWrappers.etherToken.withdrawAsync(wethContractAddress, overWETHBalance, addressWithETH), + ).to.be.rejectedWith(ContractWrappersError.InsufficientWEthBalanceForWithdrawal); }); }); describe('#subscribe', () => { @@ -157,7 +170,7 @@ describe('EtherTokenWrapper', () => { etherTokenAddress = etherToken.address; }); afterEach(() => { - zeroEx.etherToken.unsubscribeAll(); + contractWrappers.etherToken.unsubscribeAll(); }); // Hack: Mocha does not allow a test to be both async and have a `done` callback // Since we need to await the receipt of the event in the `subscribe` callback, @@ -166,7 +179,7 @@ describe('EtherTokenWrapper', () => { // Source: https://github.com/mochajs/mocha/issues/2407 it('Should receive the Transfer event when tokens are transfered', (done: DoneCallback) => { (async () => { - const callback = reportNodeCallbackErrors(done)( + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)( (logEvent: DecodedLogEvent<TransferContractEventArgs>) => { expect(logEvent).to.not.be.undefined(); expect(logEvent.isRemoved).to.be.false(); @@ -179,9 +192,14 @@ describe('EtherTokenWrapper', () => { expect(args._value).to.be.bignumber.equal(transferAmount); }, ); - await zeroEx.etherToken.depositAsync(etherTokenAddress, transferAmount, addressWithETH); - zeroEx.etherToken.subscribe(etherTokenAddress, EtherTokenEvents.Transfer, indexFilterValues, callback); - await zeroEx.token.transferAsync( + await contractWrappers.etherToken.depositAsync(etherTokenAddress, transferAmount, addressWithETH); + contractWrappers.etherToken.subscribe( + etherTokenAddress, + EtherTokenEvents.Transfer, + indexFilterValues, + callback, + ); + await contractWrappers.token.transferAsync( etherTokenAddress, addressWithETH, addressWithoutFunds, @@ -191,7 +209,7 @@ describe('EtherTokenWrapper', () => { }); it('Should receive the Approval event when allowance is being set', (done: DoneCallback) => { (async () => { - const callback = reportNodeCallbackErrors(done)( + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)( (logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => { expect(logEvent).to.not.be.undefined(); expect(logEvent.isRemoved).to.be.false(); @@ -201,8 +219,13 @@ describe('EtherTokenWrapper', () => { expect(args._value).to.be.bignumber.equal(allowanceAmount); }, ); - zeroEx.etherToken.subscribe(etherTokenAddress, EtherTokenEvents.Approval, indexFilterValues, callback); - await zeroEx.token.setAllowanceAsync( + contractWrappers.etherToken.subscribe( + etherTokenAddress, + EtherTokenEvents.Approval, + indexFilterValues, + callback, + ); + await contractWrappers.token.setAllowanceAsync( etherTokenAddress, addressWithETH, addressWithoutFunds, @@ -212,7 +235,7 @@ describe('EtherTokenWrapper', () => { }); it('Should receive the Deposit event when ether is being deposited', (done: DoneCallback) => { (async () => { - const callback = reportNodeCallbackErrors(done)( + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)( (logEvent: DecodedLogEvent<DepositContractEventArgs>) => { expect(logEvent).to.not.be.undefined(); expect(logEvent.isRemoved).to.be.false(); @@ -221,13 +244,18 @@ describe('EtherTokenWrapper', () => { expect(args._value).to.be.bignumber.equal(depositAmount); }, ); - zeroEx.etherToken.subscribe(etherTokenAddress, EtherTokenEvents.Deposit, indexFilterValues, callback); - await zeroEx.etherToken.depositAsync(etherTokenAddress, depositAmount, addressWithETH); + contractWrappers.etherToken.subscribe( + etherTokenAddress, + EtherTokenEvents.Deposit, + indexFilterValues, + callback, + ); + await contractWrappers.etherToken.depositAsync(etherTokenAddress, depositAmount, addressWithETH); })().catch(done); }); it('Should receive the Withdrawal event when ether is being withdrawn', (done: DoneCallback) => { (async () => { - const callback = reportNodeCallbackErrors(done)( + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)( (logEvent: DecodedLogEvent<WithdrawalContractEventArgs>) => { expect(logEvent).to.not.be.undefined(); expect(logEvent.isRemoved).to.be.false(); @@ -236,39 +264,39 @@ describe('EtherTokenWrapper', () => { expect(args._value).to.be.bignumber.equal(depositAmount); }, ); - await zeroEx.etherToken.depositAsync(etherTokenAddress, depositAmount, addressWithETH); - zeroEx.etherToken.subscribe( + await contractWrappers.etherToken.depositAsync(etherTokenAddress, depositAmount, addressWithETH); + contractWrappers.etherToken.subscribe( etherTokenAddress, EtherTokenEvents.Withdrawal, indexFilterValues, callback, ); - await zeroEx.etherToken.withdrawAsync(etherTokenAddress, withdrawalAmount, addressWithETH); + await contractWrappers.etherToken.withdrawAsync(etherTokenAddress, withdrawalAmount, addressWithETH); })().catch(done); }); it('should cancel outstanding subscriptions when ZeroEx.setProvider is called', (done: DoneCallback) => { (async () => { - const callbackNeverToBeCalled = reportNodeCallbackErrors(done)( + const callbackNeverToBeCalled = callbackErrorReporter.reportNodeCallbackErrors(done)( (logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => { done(new Error('Expected this subscription to have been cancelled')); }, ); - zeroEx.etherToken.subscribe( + contractWrappers.etherToken.subscribe( etherTokenAddress, EtherTokenEvents.Transfer, indexFilterValues, callbackNeverToBeCalled, ); - const callbackToBeCalled = reportNodeCallbackErrors(done)(); - zeroEx.setProvider(provider, constants.TESTRPC_NETWORK_ID); - await zeroEx.etherToken.depositAsync(etherTokenAddress, transferAmount, addressWithETH); - zeroEx.etherToken.subscribe( + const callbackToBeCalled = callbackErrorReporter.reportNodeCallbackErrors(done)(); + contractWrappers.setProvider(provider, constants.TESTRPC_NETWORK_ID); + await contractWrappers.etherToken.depositAsync(etherTokenAddress, transferAmount, addressWithETH); + contractWrappers.etherToken.subscribe( etherTokenAddress, EtherTokenEvents.Transfer, indexFilterValues, callbackToBeCalled, ); - await zeroEx.token.transferAsync( + await contractWrappers.token.transferAsync( etherTokenAddress, addressWithETH, addressWithoutFunds, @@ -278,20 +306,20 @@ describe('EtherTokenWrapper', () => { }); it('Should cancel subscription when unsubscribe called', (done: DoneCallback) => { (async () => { - const callbackNeverToBeCalled = reportNodeCallbackErrors(done)( + const callbackNeverToBeCalled = callbackErrorReporter.reportNodeCallbackErrors(done)( (logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => { done(new Error('Expected this subscription to have been cancelled')); }, ); - await zeroEx.etherToken.depositAsync(etherTokenAddress, transferAmount, addressWithETH); - const subscriptionToken = zeroEx.etherToken.subscribe( + await contractWrappers.etherToken.depositAsync(etherTokenAddress, transferAmount, addressWithETH); + const subscriptionToken = contractWrappers.etherToken.subscribe( etherTokenAddress, EtherTokenEvents.Transfer, indexFilterValues, callbackNeverToBeCalled, ); - zeroEx.etherToken.unsubscribe(subscriptionToken); - await zeroEx.token.transferAsync( + contractWrappers.etherToken.unsubscribe(subscriptionToken); + await contractWrappers.token.transferAsync( etherTokenAddress, addressWithETH, addressWithoutFunds, @@ -314,14 +342,14 @@ describe('EtherTokenWrapper', () => { const tokenUtils = new TokenUtils(tokens); const etherToken = tokenUtils.getWethTokenOrThrow(); etherTokenAddress = etherToken.address; - tokenTransferProxyAddress = zeroEx.proxy.getContractAddress(); + tokenTransferProxyAddress = contractWrappers.proxy.getContractAddress(); }); it('should get logs with decoded args emitted by Approval', async () => { - txHash = await zeroEx.token.setUnlimitedProxyAllowanceAsync(etherTokenAddress, addressWithETH); - await zeroEx.awaitTransactionMinedAsync(txHash); + txHash = await contractWrappers.token.setUnlimitedProxyAllowanceAsync(etherTokenAddress, addressWithETH); + await web3Wrapper.awaitTransactionMinedAsync(txHash); const eventName = EtherTokenEvents.Approval; const indexFilterValues = {}; - const logs = await zeroEx.etherToken.getLogsAsync<ApprovalContractEventArgs>( + const logs = await contractWrappers.etherToken.getLogsAsync<ApprovalContractEventArgs>( etherTokenAddress, eventName, blockRange, @@ -332,13 +360,13 @@ describe('EtherTokenWrapper', () => { expect(logs[0].event).to.be.equal(eventName); expect(args._owner).to.be.equal(addressWithETH); expect(args._spender).to.be.equal(tokenTransferProxyAddress); - expect(args._value).to.be.bignumber.equal(zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS); + expect(args._value).to.be.bignumber.equal(contractWrappers.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS); }); it('should get logs with decoded args emitted by Deposit', async () => { - await zeroEx.etherToken.depositAsync(etherTokenAddress, depositAmount, addressWithETH); + await contractWrappers.etherToken.depositAsync(etherTokenAddress, depositAmount, addressWithETH); const eventName = EtherTokenEvents.Deposit; const indexFilterValues = {}; - const logs = await zeroEx.etherToken.getLogsAsync<DepositContractEventArgs>( + const logs = await contractWrappers.etherToken.getLogsAsync<DepositContractEventArgs>( etherTokenAddress, eventName, blockRange, @@ -351,11 +379,11 @@ describe('EtherTokenWrapper', () => { expect(args._value).to.be.bignumber.equal(depositAmount); }); it('should only get the logs with the correct event name', async () => { - txHash = await zeroEx.token.setUnlimitedProxyAllowanceAsync(etherTokenAddress, addressWithETH); - await zeroEx.awaitTransactionMinedAsync(txHash); + txHash = await contractWrappers.token.setUnlimitedProxyAllowanceAsync(etherTokenAddress, addressWithETH); + await web3Wrapper.awaitTransactionMinedAsync(txHash); const differentEventName = EtherTokenEvents.Transfer; const indexFilterValues = {}; - const logs = await zeroEx.etherToken.getLogsAsync( + const logs = await contractWrappers.etherToken.getLogsAsync( etherTokenAddress, differentEventName, blockRange, @@ -364,15 +392,18 @@ describe('EtherTokenWrapper', () => { expect(logs).to.have.length(0); }); it('should only get the logs with the correct indexed fields', async () => { - txHash = await zeroEx.token.setUnlimitedProxyAllowanceAsync(etherTokenAddress, addressWithETH); - await zeroEx.awaitTransactionMinedAsync(txHash); - txHash = await zeroEx.token.setUnlimitedProxyAllowanceAsync(etherTokenAddress, addressWithoutFunds); - await zeroEx.awaitTransactionMinedAsync(txHash); + txHash = await contractWrappers.token.setUnlimitedProxyAllowanceAsync(etherTokenAddress, addressWithETH); + await web3Wrapper.awaitTransactionMinedAsync(txHash); + txHash = await contractWrappers.token.setUnlimitedProxyAllowanceAsync( + etherTokenAddress, + addressWithoutFunds, + ); + await web3Wrapper.awaitTransactionMinedAsync(txHash); const eventName = EtherTokenEvents.Approval; const indexFilterValues = { _owner: addressWithETH, }; - const logs = await zeroEx.etherToken.getLogsAsync<ApprovalContractEventArgs>( + const logs = await contractWrappers.etherToken.getLogsAsync<ApprovalContractEventArgs>( etherTokenAddress, eventName, blockRange, diff --git a/packages/0x.js/test/exchange_transfer_simulator_test.ts b/packages/contract-wrappers/test/exchange_transfer_simulator_test.ts index cb976a0ae..0011f0626 100644 --- a/packages/0x.js/test/exchange_transfer_simulator_test.ts +++ b/packages/contract-wrappers/test/exchange_transfer_simulator_test.ts @@ -1,9 +1,9 @@ import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils'; -import { BlockParamLiteral } from '@0xproject/types'; +import { BlockParamLiteral, Token } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; -import { ExchangeContractErrs, Token, ZeroEx } from '../src'; +import { ContractWrappers, ExchangeContractErrs } from '../src'; import { TradeSide, TransferType } from '../src/types'; import { ExchangeTransferSimulator } from '../src/utils/exchange_transfer_simulator'; @@ -19,7 +19,7 @@ describe('ExchangeTransferSimulator', () => { const config = { networkId: constants.TESTRPC_NETWORK_ID, }; - const zeroEx = new ZeroEx(provider, config); + const contractWrappers = new ContractWrappers(provider, config); const transferAmount = new BigNumber(5); let userAddresses: string[]; let tokens: Token[]; @@ -30,9 +30,9 @@ describe('ExchangeTransferSimulator', () => { let exchangeTransferSimulator: ExchangeTransferSimulator; let txHash: string; before(async () => { - userAddresses = await zeroEx.getAvailableAddressesAsync(); + userAddresses = await web3Wrapper.getAvailableAddressesAsync(); [coinbase, sender, recipient] = userAddresses; - tokens = await zeroEx.tokenRegistry.getTokensAsync(); + tokens = await contractWrappers.tokenRegistry.getTokensAsync(); exampleTokenAddress = tokens[0].address; }); beforeEach(async () => { @@ -43,7 +43,7 @@ describe('ExchangeTransferSimulator', () => { }); describe('#transferFromAsync', () => { beforeEach(() => { - exchangeTransferSimulator = new ExchangeTransferSimulator(zeroEx.token, BlockParamLiteral.Latest); + exchangeTransferSimulator = new ExchangeTransferSimulator(contractWrappers.token, BlockParamLiteral.Latest); }); it("throws if the user doesn't have enough allowance", async () => { return expect( @@ -58,8 +58,8 @@ describe('ExchangeTransferSimulator', () => { ).to.be.rejectedWith(ExchangeContractErrs.InsufficientTakerAllowance); }); it("throws if the user doesn't have enough balance", async () => { - txHash = await zeroEx.token.setProxyAllowanceAsync(exampleTokenAddress, sender, transferAmount); - await zeroEx.awaitTransactionMinedAsync(txHash); + txHash = await contractWrappers.token.setProxyAllowanceAsync(exampleTokenAddress, sender, transferAmount); + await web3Wrapper.awaitTransactionMinedAsync(txHash); return expect( exchangeTransferSimulator.transferFromAsync( exampleTokenAddress, @@ -72,10 +72,10 @@ describe('ExchangeTransferSimulator', () => { ).to.be.rejectedWith(ExchangeContractErrs.InsufficientMakerBalance); }); it('updates balances and proxyAllowance after transfer', async () => { - txHash = await zeroEx.token.transferAsync(exampleTokenAddress, coinbase, sender, transferAmount); - await zeroEx.awaitTransactionMinedAsync(txHash); - txHash = await zeroEx.token.setProxyAllowanceAsync(exampleTokenAddress, sender, transferAmount); - await zeroEx.awaitTransactionMinedAsync(txHash); + txHash = await contractWrappers.token.transferAsync(exampleTokenAddress, coinbase, sender, transferAmount); + await web3Wrapper.awaitTransactionMinedAsync(txHash); + txHash = await contractWrappers.token.setProxyAllowanceAsync(exampleTokenAddress, sender, transferAmount); + await web3Wrapper.awaitTransactionMinedAsync(txHash); await exchangeTransferSimulator.transferFromAsync( exampleTokenAddress, sender, @@ -93,10 +93,10 @@ describe('ExchangeTransferSimulator', () => { expect(senderProxyAllowance).to.be.bignumber.equal(0); }); it("doesn't update proxyAllowance after transfer if unlimited", async () => { - txHash = await zeroEx.token.transferAsync(exampleTokenAddress, coinbase, sender, transferAmount); - await zeroEx.awaitTransactionMinedAsync(txHash); - txHash = await zeroEx.token.setUnlimitedProxyAllowanceAsync(exampleTokenAddress, sender); - await zeroEx.awaitTransactionMinedAsync(txHash); + txHash = await contractWrappers.token.transferAsync(exampleTokenAddress, coinbase, sender, transferAmount); + await web3Wrapper.awaitTransactionMinedAsync(txHash); + txHash = await contractWrappers.token.setUnlimitedProxyAllowanceAsync(exampleTokenAddress, sender); + await web3Wrapper.awaitTransactionMinedAsync(txHash); await exchangeTransferSimulator.transferFromAsync( exampleTokenAddress, sender, @@ -111,7 +111,7 @@ describe('ExchangeTransferSimulator', () => { const senderProxyAllowance = await store.getProxyAllowanceAsync(exampleTokenAddress, sender); expect(senderBalance).to.be.bignumber.equal(0); expect(recipientBalance).to.be.bignumber.equal(transferAmount); - expect(senderProxyAllowance).to.be.bignumber.equal(zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS); + expect(senderProxyAllowance).to.be.bignumber.equal(contractWrappers.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS); }); }); }); diff --git a/packages/0x.js/test/exchange_wrapper_test.ts b/packages/contract-wrappers/test/exchange_wrapper_test.ts index 65f4e8251..fc0a23485 100644 --- a/packages/0x.js/test/exchange_wrapper_test.ts +++ b/packages/contract-wrappers/test/exchange_wrapper_test.ts @@ -1,12 +1,16 @@ -import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils'; -import { BlockParamLiteral } from '@0xproject/types'; +import { BlockchainLifecycle, callbackErrorReporter, devConstants, web3Factory } from '@0xproject/dev-utils'; +import { FillScenarios } from '@0xproject/fill-scenarios'; +import { getOrderHashHex } from '@0xproject/order-utils'; +import { BlockParamLiteral, DoneCallback, OrderState } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; import * as _ from 'lodash'; import 'mocha'; import { BlockRange, + ContractWrappers, DecodedLogEvent, ExchangeContractErrs, ExchangeEvents, @@ -14,17 +18,12 @@ import { LogFillContractEventArgs, OrderCancellationRequest, OrderFillRequest, - OrderState, SignedOrder, Token, - ZeroEx, } from '../src'; -import { DoneCallback } from '../src/types'; import { chaiSetup } from './utils/chai_setup'; import { constants } from './utils/constants'; -import { FillScenarios } from './utils/fill_scenarios'; -import { reportNodeCallbackErrors } from './utils/report_callback_errors'; import { TokenUtils } from './utils/token_utils'; import { provider, web3Wrapper } from './utils/web3_wrapper'; @@ -35,7 +34,7 @@ const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); const NON_EXISTENT_ORDER_HASH = '0x79370342234e7acd6bbeac335bd3bb1d368383294b64b8160a00f4060e4d3777'; describe('ExchangeWrapper', () => { - let zeroEx: ZeroEx; + let contractWrappers: ContractWrappers; let tokenUtils: TokenUtils; let tokens: Token[]; let userAddresses: string[]; @@ -46,13 +45,13 @@ describe('ExchangeWrapper', () => { networkId: constants.TESTRPC_NETWORK_ID, }; before(async () => { - zeroEx = new ZeroEx(provider, config); - exchangeContractAddress = zeroEx.exchange.getContractAddress(); - userAddresses = await zeroEx.getAvailableAddressesAsync(); - tokens = await zeroEx.tokenRegistry.getTokensAsync(); + contractWrappers = new ContractWrappers(provider, config); + exchangeContractAddress = contractWrappers.exchange.getContractAddress(); + userAddresses = await web3Wrapper.getAvailableAddressesAsync(); + tokens = await contractWrappers.tokenRegistry.getTokensAsync(); tokenUtils = new TokenUtils(tokens); zrxTokenAddress = tokenUtils.getProtocolTokenOrThrow().address; - fillScenarios = new FillScenarios(zeroEx, userAddresses, tokens, zrxTokenAddress, exchangeContractAddress); + fillScenarios = new FillScenarios(provider, userAddresses, tokens, zrxTokenAddress, exchangeContractAddress); await fillScenarios.initTokenBalancesAsync(); }); beforeEach(async () => { @@ -71,7 +70,7 @@ describe('ExchangeWrapper', () => { const takerTokenFillAmount = new BigNumber(5); before(async () => { [coinbase, makerAddress, takerAddress, feeRecipient] = userAddresses; - tokens = await zeroEx.tokenRegistry.getTokensAsync(); + tokens = await contractWrappers.tokenRegistry.getTokensAsync(); const [makerToken, takerToken] = tokenUtils.getDummyTokens(); makerTokenAddress = makerToken.address; takerTokenAddress = takerToken.address; @@ -104,7 +103,7 @@ describe('ExchangeWrapper', () => { takerTokenFillAmount: partialFillTakerAmount, }, ]; - await zeroEx.exchange.batchFillOrKillAsync(orderFillRequests, takerAddress); + await contractWrappers.exchange.batchFillOrKillAsync(orderFillRequests, takerAddress); }); describe('order transaction options', () => { let signedOrder: SignedOrder; @@ -127,19 +126,19 @@ describe('ExchangeWrapper', () => { }); it('should validate when orderTransactionOptions are not present', async () => { return expect( - zeroEx.exchange.batchFillOrKillAsync(orderFillRequests, takerAddress), + contractWrappers.exchange.batchFillOrKillAsync(orderFillRequests, takerAddress), ).to.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero); }); it('should validate when orderTransactionOptions specify to validate', async () => { return expect( - zeroEx.exchange.batchFillOrKillAsync(orderFillRequests, takerAddress, { + contractWrappers.exchange.batchFillOrKillAsync(orderFillRequests, takerAddress, { shouldValidate: true, }), ).to.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero); }); it('should not validate when orderTransactionOptions specify not to validate', async () => { return expect( - zeroEx.exchange.batchFillOrKillAsync(orderFillRequests, takerAddress, { + contractWrappers.exchange.batchFillOrKillAsync(orderFillRequests, takerAddress, { shouldValidate: false, }), ).to.not.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero); @@ -160,66 +159,70 @@ describe('ExchangeWrapper', () => { }); describe('successful fills', () => { it('should fill a valid order', async () => { - expect(await zeroEx.token.getBalanceAsync(makerTokenAddress, makerAddress)).to.be.bignumber.equal( - fillableAmount, - ); - expect(await zeroEx.token.getBalanceAsync(takerTokenAddress, makerAddress)).to.be.bignumber.equal( - 0, - ); - expect(await zeroEx.token.getBalanceAsync(makerTokenAddress, takerAddress)).to.be.bignumber.equal( - 0, - ); - expect(await zeroEx.token.getBalanceAsync(takerTokenAddress, takerAddress)).to.be.bignumber.equal( - fillableAmount, - ); - await zeroEx.exchange.fillOrKillOrderAsync(signedOrder, takerTokenFillAmount, takerAddress); - expect(await zeroEx.token.getBalanceAsync(makerTokenAddress, makerAddress)).to.be.bignumber.equal( - fillableAmount.minus(takerTokenFillAmount), - ); - expect(await zeroEx.token.getBalanceAsync(takerTokenAddress, makerAddress)).to.be.bignumber.equal( - takerTokenFillAmount, - ); - expect(await zeroEx.token.getBalanceAsync(makerTokenAddress, takerAddress)).to.be.bignumber.equal( + expect( + await contractWrappers.token.getBalanceAsync(makerTokenAddress, makerAddress), + ).to.be.bignumber.equal(fillableAmount); + expect( + await contractWrappers.token.getBalanceAsync(takerTokenAddress, makerAddress), + ).to.be.bignumber.equal(0); + expect( + await contractWrappers.token.getBalanceAsync(makerTokenAddress, takerAddress), + ).to.be.bignumber.equal(0); + expect( + await contractWrappers.token.getBalanceAsync(takerTokenAddress, takerAddress), + ).to.be.bignumber.equal(fillableAmount); + await contractWrappers.exchange.fillOrKillOrderAsync( + signedOrder, takerTokenFillAmount, + takerAddress, ); - expect(await zeroEx.token.getBalanceAsync(takerTokenAddress, takerAddress)).to.be.bignumber.equal( - fillableAmount.minus(takerTokenFillAmount), - ); + expect( + await contractWrappers.token.getBalanceAsync(makerTokenAddress, makerAddress), + ).to.be.bignumber.equal(fillableAmount.minus(takerTokenFillAmount)); + expect( + await contractWrappers.token.getBalanceAsync(takerTokenAddress, makerAddress), + ).to.be.bignumber.equal(takerTokenFillAmount); + expect( + await contractWrappers.token.getBalanceAsync(makerTokenAddress, takerAddress), + ).to.be.bignumber.equal(takerTokenFillAmount); + expect( + await contractWrappers.token.getBalanceAsync(takerTokenAddress, takerAddress), + ).to.be.bignumber.equal(fillableAmount.minus(takerTokenFillAmount)); }); it('should partially fill a valid order', async () => { const partialFillAmount = new BigNumber(3); - await zeroEx.exchange.fillOrKillOrderAsync(signedOrder, partialFillAmount, takerAddress); - expect(await zeroEx.token.getBalanceAsync(makerTokenAddress, makerAddress)).to.be.bignumber.equal( - fillableAmount.minus(partialFillAmount), - ); - expect(await zeroEx.token.getBalanceAsync(takerTokenAddress, makerAddress)).to.be.bignumber.equal( - partialFillAmount, - ); - expect(await zeroEx.token.getBalanceAsync(makerTokenAddress, takerAddress)).to.be.bignumber.equal( - partialFillAmount, - ); - expect(await zeroEx.token.getBalanceAsync(takerTokenAddress, takerAddress)).to.be.bignumber.equal( - fillableAmount.minus(partialFillAmount), - ); + await contractWrappers.exchange.fillOrKillOrderAsync(signedOrder, partialFillAmount, takerAddress); + expect( + await contractWrappers.token.getBalanceAsync(makerTokenAddress, makerAddress), + ).to.be.bignumber.equal(fillableAmount.minus(partialFillAmount)); + expect( + await contractWrappers.token.getBalanceAsync(takerTokenAddress, makerAddress), + ).to.be.bignumber.equal(partialFillAmount); + expect( + await contractWrappers.token.getBalanceAsync(makerTokenAddress, takerAddress), + ).to.be.bignumber.equal(partialFillAmount); + expect( + await contractWrappers.token.getBalanceAsync(takerTokenAddress, takerAddress), + ).to.be.bignumber.equal(fillableAmount.minus(partialFillAmount)); }); }); describe('order transaction options', () => { const emptyFillableAmount = new BigNumber(0); it('should validate when orderTransactionOptions are not present', async () => { return expect( - zeroEx.exchange.fillOrKillOrderAsync(signedOrder, emptyFillableAmount, takerAddress), + contractWrappers.exchange.fillOrKillOrderAsync(signedOrder, emptyFillableAmount, takerAddress), ).to.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero); }); it('should validate when orderTransactionOptions specify to validate', async () => { return expect( - zeroEx.exchange.fillOrKillOrderAsync(signedOrder, emptyFillableAmount, takerAddress, { + contractWrappers.exchange.fillOrKillOrderAsync(signedOrder, emptyFillableAmount, takerAddress, { shouldValidate: true, }), ).to.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero); }); it('should not validate when orderTransactionOptions specify not to validate', async () => { return expect( - zeroEx.exchange.fillOrKillOrderAsync(signedOrder, emptyFillableAmount, takerAddress, { + contractWrappers.exchange.fillOrKillOrderAsync(signedOrder, emptyFillableAmount, takerAddress, { shouldValidate: false, }), ).to.not.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero); @@ -239,7 +242,7 @@ describe('ExchangeWrapper', () => { const shouldThrowOnInsufficientBalanceOrAllowance = true; before(async () => { [coinbase, makerAddress, takerAddress, feeRecipient] = userAddresses; - tokens = await zeroEx.tokenRegistry.getTokensAsync(); + tokens = await contractWrappers.tokenRegistry.getTokensAsync(); const [makerToken, takerToken] = tokenUtils.getDummyTokens(); makerTokenAddress = makerToken.address; takerTokenAddress = takerToken.address; @@ -254,37 +257,37 @@ describe('ExchangeWrapper', () => { takerAddress, fillableAmount, ); - expect(await zeroEx.token.getBalanceAsync(makerTokenAddress, makerAddress)).to.be.bignumber.equal( - fillableAmount, - ); - expect(await zeroEx.token.getBalanceAsync(takerTokenAddress, makerAddress)).to.be.bignumber.equal( - 0, - ); - expect(await zeroEx.token.getBalanceAsync(makerTokenAddress, takerAddress)).to.be.bignumber.equal( - 0, - ); - expect(await zeroEx.token.getBalanceAsync(takerTokenAddress, takerAddress)).to.be.bignumber.equal( - fillableAmount, - ); - const txHash = await zeroEx.exchange.fillOrderAsync( + expect( + await contractWrappers.token.getBalanceAsync(makerTokenAddress, makerAddress), + ).to.be.bignumber.equal(fillableAmount); + expect( + await contractWrappers.token.getBalanceAsync(takerTokenAddress, makerAddress), + ).to.be.bignumber.equal(0); + expect( + await contractWrappers.token.getBalanceAsync(makerTokenAddress, takerAddress), + ).to.be.bignumber.equal(0); + expect( + await contractWrappers.token.getBalanceAsync(takerTokenAddress, takerAddress), + ).to.be.bignumber.equal(fillableAmount); + const txHash = await contractWrappers.exchange.fillOrderAsync( signedOrder, takerTokenFillAmount, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress, ); - await zeroEx.awaitTransactionMinedAsync(txHash); - expect(await zeroEx.token.getBalanceAsync(makerTokenAddress, makerAddress)).to.be.bignumber.equal( - fillableAmount.minus(takerTokenFillAmount), - ); - expect(await zeroEx.token.getBalanceAsync(takerTokenAddress, makerAddress)).to.be.bignumber.equal( - takerTokenFillAmount, - ); - expect(await zeroEx.token.getBalanceAsync(makerTokenAddress, takerAddress)).to.be.bignumber.equal( - takerTokenFillAmount, - ); - expect(await zeroEx.token.getBalanceAsync(takerTokenAddress, takerAddress)).to.be.bignumber.equal( - fillableAmount.minus(takerTokenFillAmount), - ); + await web3Wrapper.awaitTransactionMinedAsync(txHash); + expect( + await contractWrappers.token.getBalanceAsync(makerTokenAddress, makerAddress), + ).to.be.bignumber.equal(fillableAmount.minus(takerTokenFillAmount)); + expect( + await contractWrappers.token.getBalanceAsync(takerTokenAddress, makerAddress), + ).to.be.bignumber.equal(takerTokenFillAmount); + expect( + await contractWrappers.token.getBalanceAsync(makerTokenAddress, takerAddress), + ).to.be.bignumber.equal(takerTokenFillAmount); + expect( + await contractWrappers.token.getBalanceAsync(takerTokenAddress, takerAddress), + ).to.be.bignumber.equal(fillableAmount.minus(takerTokenFillAmount)); }); it('should partially fill the valid order', async () => { const signedOrder = await fillScenarios.createFillableSignedOrderAsync( @@ -295,25 +298,25 @@ describe('ExchangeWrapper', () => { fillableAmount, ); const partialFillAmount = new BigNumber(3); - const txHash = await zeroEx.exchange.fillOrderAsync( + const txHash = await contractWrappers.exchange.fillOrderAsync( signedOrder, partialFillAmount, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress, ); - await zeroEx.awaitTransactionMinedAsync(txHash); - expect(await zeroEx.token.getBalanceAsync(makerTokenAddress, makerAddress)).to.be.bignumber.equal( - fillableAmount.minus(partialFillAmount), - ); - expect(await zeroEx.token.getBalanceAsync(takerTokenAddress, makerAddress)).to.be.bignumber.equal( - partialFillAmount, - ); - expect(await zeroEx.token.getBalanceAsync(makerTokenAddress, takerAddress)).to.be.bignumber.equal( - partialFillAmount, - ); - expect(await zeroEx.token.getBalanceAsync(takerTokenAddress, takerAddress)).to.be.bignumber.equal( - fillableAmount.minus(partialFillAmount), - ); + await web3Wrapper.awaitTransactionMinedAsync(txHash); + expect( + await contractWrappers.token.getBalanceAsync(makerTokenAddress, makerAddress), + ).to.be.bignumber.equal(fillableAmount.minus(partialFillAmount)); + expect( + await contractWrappers.token.getBalanceAsync(takerTokenAddress, makerAddress), + ).to.be.bignumber.equal(partialFillAmount); + expect( + await contractWrappers.token.getBalanceAsync(makerTokenAddress, takerAddress), + ).to.be.bignumber.equal(partialFillAmount); + expect( + await contractWrappers.token.getBalanceAsync(takerTokenAddress, takerAddress), + ).to.be.bignumber.equal(fillableAmount.minus(partialFillAmount)); }); it('should fill the valid orders with fees', async () => { const makerFee = new BigNumber(1); @@ -328,16 +331,16 @@ describe('ExchangeWrapper', () => { fillableAmount, feeRecipient, ); - const txHash = await zeroEx.exchange.fillOrderAsync( + const txHash = await contractWrappers.exchange.fillOrderAsync( signedOrder, takerTokenFillAmount, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress, ); - await zeroEx.awaitTransactionMinedAsync(txHash); - expect(await zeroEx.token.getBalanceAsync(zrxTokenAddress, feeRecipient)).to.be.bignumber.equal( - makerFee.plus(takerFee), - ); + await web3Wrapper.awaitTransactionMinedAsync(txHash); + expect( + await contractWrappers.token.getBalanceAsync(zrxTokenAddress, feeRecipient), + ).to.be.bignumber.equal(makerFee.plus(takerFee)); }); }); describe('order transaction options', () => { @@ -354,7 +357,7 @@ describe('ExchangeWrapper', () => { }); it('should validate when orderTransactionOptions are not present', async () => { return expect( - zeroEx.exchange.fillOrderAsync( + contractWrappers.exchange.fillOrderAsync( signedOrder, emptyFillTakerAmount, shouldThrowOnInsufficientBalanceOrAllowance, @@ -364,7 +367,7 @@ describe('ExchangeWrapper', () => { }); it('should validate when orderTransactionOptions specify to validate', async () => { return expect( - zeroEx.exchange.fillOrderAsync( + contractWrappers.exchange.fillOrderAsync( signedOrder, emptyFillTakerAmount, shouldThrowOnInsufficientBalanceOrAllowance, @@ -377,7 +380,7 @@ describe('ExchangeWrapper', () => { }); it('should not validate when orderTransactionOptions specify not to validate', async () => { return expect( - zeroEx.exchange.fillOrderAsync( + contractWrappers.exchange.fillOrderAsync( signedOrder, emptyFillTakerAmount, shouldThrowOnInsufficientBalanceOrAllowance, @@ -403,7 +406,7 @@ describe('ExchangeWrapper', () => { }); it('should not allow the exchange wrapper to fill if amount is negative', async () => { return expect( - zeroEx.exchange.fillOrderAsync( + contractWrappers.exchange.fillOrderAsync( signedOrder, negativeFillTakerAmount, shouldThrowOnInsufficientBalanceOrAllowance, @@ -427,7 +430,7 @@ describe('ExchangeWrapper', () => { takerAddress, fillableAmount, ); - signedOrderHashHex = ZeroEx.getOrderHashHex(signedOrder); + signedOrderHashHex = getOrderHashHex(signedOrder); anotherSignedOrder = await fillScenarios.createFillableSignedOrderAsync( makerTokenAddress, takerTokenAddress, @@ -435,7 +438,7 @@ describe('ExchangeWrapper', () => { takerAddress, fillableAmount, ); - anotherOrderHashHex = ZeroEx.getOrderHashHex(anotherSignedOrder); + anotherOrderHashHex = getOrderHashHex(anotherSignedOrder); }); describe('successful batch fills', () => { beforeEach(() => { @@ -452,7 +455,7 @@ describe('ExchangeWrapper', () => { }); it('should throw if a batch is empty', async () => { return expect( - zeroEx.exchange.batchFillOrdersAsync( + contractWrappers.exchange.batchFillOrdersAsync( [], shouldThrowOnInsufficientBalanceOrAllowance, takerAddress, @@ -460,14 +463,16 @@ describe('ExchangeWrapper', () => { ).to.be.rejectedWith(ExchangeContractErrs.BatchOrdersMustHaveAtLeastOneItem); }); it('should successfully fill multiple orders', async () => { - const txHash = await zeroEx.exchange.batchFillOrdersAsync( + const txHash = await contractWrappers.exchange.batchFillOrdersAsync( orderFillBatch, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress, ); - await zeroEx.awaitTransactionMinedAsync(txHash); - const filledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(signedOrderHashHex); - const anotherFilledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(anotherOrderHashHex); + await web3Wrapper.awaitTransactionMinedAsync(txHash); + const filledAmount = await contractWrappers.exchange.getFilledTakerAmountAsync(signedOrderHashHex); + const anotherFilledAmount = await contractWrappers.exchange.getFilledTakerAmountAsync( + anotherOrderHashHex, + ); expect(filledAmount).to.be.bignumber.equal(takerTokenFillAmount); expect(anotherFilledAmount).to.be.bignumber.equal(takerTokenFillAmount); }); @@ -488,7 +493,7 @@ describe('ExchangeWrapper', () => { }); it('should validate when orderTransactionOptions are not present', async () => { return expect( - zeroEx.exchange.batchFillOrdersAsync( + contractWrappers.exchange.batchFillOrdersAsync( orderFillBatch, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress, @@ -497,7 +502,7 @@ describe('ExchangeWrapper', () => { }); it('should validate when orderTransactionOptions specify to validate', async () => { return expect( - zeroEx.exchange.batchFillOrdersAsync( + contractWrappers.exchange.batchFillOrdersAsync( orderFillBatch, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress, @@ -509,7 +514,7 @@ describe('ExchangeWrapper', () => { }); it('should not validate when orderTransactionOptions specify not to validate', async () => { return expect( - zeroEx.exchange.batchFillOrdersAsync( + contractWrappers.exchange.batchFillOrdersAsync( orderFillBatch, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress, @@ -536,7 +541,7 @@ describe('ExchangeWrapper', () => { }); it('should not allow the exchange wrapper to batch fill if any amount is negative', async () => { return expect( - zeroEx.exchange.batchFillOrdersAsync( + contractWrappers.exchange.batchFillOrdersAsync( orderFillBatch, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress, @@ -560,7 +565,7 @@ describe('ExchangeWrapper', () => { takerAddress, fillableAmount, ); - signedOrderHashHex = ZeroEx.getOrderHashHex(signedOrder); + signedOrderHashHex = getOrderHashHex(signedOrder); anotherSignedOrder = await fillScenarios.createFillableSignedOrderAsync( makerTokenAddress, takerTokenAddress, @@ -568,13 +573,13 @@ describe('ExchangeWrapper', () => { takerAddress, fillableAmount, ); - anotherOrderHashHex = ZeroEx.getOrderHashHex(anotherSignedOrder); + anotherOrderHashHex = getOrderHashHex(anotherSignedOrder); signedOrders = [signedOrder, anotherSignedOrder]; }); describe('successful batch fills', () => { it('should throw if a batch is empty', async () => { return expect( - zeroEx.exchange.fillOrdersUpToAsync( + contractWrappers.exchange.fillOrdersUpToAsync( [], fillUpToAmount, shouldThrowOnInsufficientBalanceOrAllowance, @@ -583,45 +588,54 @@ describe('ExchangeWrapper', () => { ).to.be.rejectedWith(ExchangeContractErrs.BatchOrdersMustHaveAtLeastOneItem); }); it('should successfully fill up to specified amount when all orders are fully funded', async () => { - const txHash = await zeroEx.exchange.fillOrdersUpToAsync( + const txHash = await contractWrappers.exchange.fillOrdersUpToAsync( signedOrders, fillUpToAmount, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress, ); - await zeroEx.awaitTransactionMinedAsync(txHash); - const filledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(signedOrderHashHex); - const anotherFilledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(anotherOrderHashHex); + await web3Wrapper.awaitTransactionMinedAsync(txHash); + const filledAmount = await contractWrappers.exchange.getFilledTakerAmountAsync(signedOrderHashHex); + const anotherFilledAmount = await contractWrappers.exchange.getFilledTakerAmountAsync( + anotherOrderHashHex, + ); expect(filledAmount).to.be.bignumber.equal(fillableAmount); const remainingFillAmount = fillableAmount.minus(1); expect(anotherFilledAmount).to.be.bignumber.equal(remainingFillAmount); }); it('should successfully fill up to specified amount and leave the rest of the orders untouched', async () => { - const txHash = await zeroEx.exchange.fillOrdersUpToAsync( + const txHash = await contractWrappers.exchange.fillOrdersUpToAsync( signedOrders, fillableAmount, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress, ); - await zeroEx.awaitTransactionMinedAsync(txHash); - const filledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(signedOrderHashHex); - const zeroAmount = await zeroEx.exchange.getFilledTakerAmountAsync(anotherOrderHashHex); + await web3Wrapper.awaitTransactionMinedAsync(txHash); + const filledAmount = await contractWrappers.exchange.getFilledTakerAmountAsync(signedOrderHashHex); + const zeroAmount = await contractWrappers.exchange.getFilledTakerAmountAsync(anotherOrderHashHex); expect(filledAmount).to.be.bignumber.equal(fillableAmount); expect(zeroAmount).to.be.bignumber.equal(0); }); it('should successfully fill up to specified amount even if filling all orders would fail', async () => { const missingBalance = new BigNumber(1); // User will still have enough balance to fill up to 9, // but won't have 10 to fully fill all orders in a batch. - await zeroEx.token.transferAsync(makerTokenAddress, makerAddress, coinbase, missingBalance); - const txHash = await zeroEx.exchange.fillOrdersUpToAsync( + await contractWrappers.token.transferAsync( + makerTokenAddress, + makerAddress, + coinbase, + missingBalance, + ); + const txHash = await contractWrappers.exchange.fillOrdersUpToAsync( signedOrders, fillUpToAmount, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress, ); - await zeroEx.awaitTransactionMinedAsync(txHash); - const filledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(signedOrderHashHex); - const anotherFilledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(anotherOrderHashHex); + await web3Wrapper.awaitTransactionMinedAsync(txHash); + const filledAmount = await contractWrappers.exchange.getFilledTakerAmountAsync(signedOrderHashHex); + const anotherFilledAmount = await contractWrappers.exchange.getFilledTakerAmountAsync( + anotherOrderHashHex, + ); expect(filledAmount).to.be.bignumber.equal(fillableAmount); const remainingFillAmount = fillableAmount.minus(1); expect(anotherFilledAmount).to.be.bignumber.equal(remainingFillAmount); @@ -630,9 +644,14 @@ describe('ExchangeWrapper', () => { describe('failed batch fills', () => { it("should fail validation if user doesn't have enough balance without fill up to", async () => { const missingBalance = new BigNumber(2); // User will only have enough balance to fill up to 8 - await zeroEx.token.transferAsync(makerTokenAddress, makerAddress, coinbase, missingBalance); + await contractWrappers.token.transferAsync( + makerTokenAddress, + makerAddress, + coinbase, + missingBalance, + ); return expect( - zeroEx.exchange.fillOrdersUpToAsync( + contractWrappers.exchange.fillOrdersUpToAsync( signedOrders, fillUpToAmount, shouldThrowOnInsufficientBalanceOrAllowance, @@ -645,7 +664,7 @@ describe('ExchangeWrapper', () => { const emptyFillUpToAmount = new BigNumber(0); it('should validate when orderTransactionOptions are not present', async () => { return expect( - zeroEx.exchange.fillOrdersUpToAsync( + contractWrappers.exchange.fillOrdersUpToAsync( signedOrders, emptyFillUpToAmount, shouldThrowOnInsufficientBalanceOrAllowance, @@ -655,7 +674,7 @@ describe('ExchangeWrapper', () => { }); it('should validate when orderTransactionOptions specify to validate', async () => { return expect( - zeroEx.exchange.fillOrdersUpToAsync( + contractWrappers.exchange.fillOrdersUpToAsync( signedOrders, emptyFillUpToAmount, shouldThrowOnInsufficientBalanceOrAllowance, @@ -668,7 +687,7 @@ describe('ExchangeWrapper', () => { }); it('should not validate when orderTransactionOptions specify not to validate', async () => { return expect( - zeroEx.exchange.fillOrdersUpToAsync( + contractWrappers.exchange.fillOrdersUpToAsync( signedOrders, emptyFillUpToAmount, shouldThrowOnInsufficientBalanceOrAllowance, @@ -704,14 +723,14 @@ describe('ExchangeWrapper', () => { takerAddress, fillableAmount, ); - orderHashHex = ZeroEx.getOrderHashHex(signedOrder); + orderHashHex = getOrderHashHex(signedOrder); }); describe('#cancelOrderAsync', () => { describe('successful cancels', () => { it('should cancel an order', async () => { - const txHash = await zeroEx.exchange.cancelOrderAsync(signedOrder, cancelAmount); - await zeroEx.awaitTransactionMinedAsync(txHash); - const cancelledAmount = await zeroEx.exchange.getCancelledTakerAmountAsync(orderHashHex); + const txHash = await contractWrappers.exchange.cancelOrderAsync(signedOrder, cancelAmount); + await web3Wrapper.awaitTransactionMinedAsync(txHash); + const cancelledAmount = await contractWrappers.exchange.getCancelledTakerAmountAsync(orderHashHex); expect(cancelledAmount).to.be.bignumber.equal(cancelAmount); }); }); @@ -719,19 +738,19 @@ describe('ExchangeWrapper', () => { const emptyCancelTakerTokenAmount = new BigNumber(0); it('should validate when orderTransactionOptions are not present', async () => { return expect( - zeroEx.exchange.cancelOrderAsync(signedOrder, emptyCancelTakerTokenAmount), + contractWrappers.exchange.cancelOrderAsync(signedOrder, emptyCancelTakerTokenAmount), ).to.be.rejectedWith(ExchangeContractErrs.OrderCancelAmountZero); }); it('should validate when orderTransactionOptions specify to validate', async () => { return expect( - zeroEx.exchange.cancelOrderAsync(signedOrder, emptyCancelTakerTokenAmount, { + contractWrappers.exchange.cancelOrderAsync(signedOrder, emptyCancelTakerTokenAmount, { shouldValidate: true, }), ).to.be.rejectedWith(ExchangeContractErrs.OrderCancelAmountZero); }); it('should not validate when orderTransactionOptions specify not to validate', async () => { return expect( - zeroEx.exchange.cancelOrderAsync(signedOrder, emptyCancelTakerTokenAmount, { + contractWrappers.exchange.cancelOrderAsync(signedOrder, emptyCancelTakerTokenAmount, { shouldValidate: false, }), ).to.not.be.rejectedWith(ExchangeContractErrs.OrderCancelAmountZero); @@ -750,7 +769,7 @@ describe('ExchangeWrapper', () => { takerAddress, fillableAmount, ); - anotherOrderHashHex = ZeroEx.getOrderHashHex(anotherSignedOrder); + anotherOrderHashHex = getOrderHashHex(anotherSignedOrder); cancelBatch = [ { order: signedOrder, @@ -772,7 +791,7 @@ describe('ExchangeWrapper', () => { fillableAmount, ); return expect( - zeroEx.exchange.batchCancelOrdersAsync([ + contractWrappers.exchange.batchCancelOrdersAsync([ cancelBatch[0], { order: signedOrderWithDifferentMaker, @@ -784,9 +803,9 @@ describe('ExchangeWrapper', () => { }); describe('successful batch cancels', () => { it('should cancel a batch of orders', async () => { - await zeroEx.exchange.batchCancelOrdersAsync(cancelBatch); - const cancelledAmount = await zeroEx.exchange.getCancelledTakerAmountAsync(orderHashHex); - const anotherCancelledAmount = await zeroEx.exchange.getCancelledTakerAmountAsync( + await contractWrappers.exchange.batchCancelOrdersAsync(cancelBatch); + const cancelledAmount = await contractWrappers.exchange.getCancelledTakerAmountAsync(orderHashHex); + const anotherCancelledAmount = await contractWrappers.exchange.getCancelledTakerAmountAsync( anotherOrderHashHex, ); expect(cancelledAmount).to.be.bignumber.equal(cancelAmount); @@ -808,20 +827,20 @@ describe('ExchangeWrapper', () => { ]; }); it('should validate when orderTransactionOptions are not present', async () => { - return expect(zeroEx.exchange.batchCancelOrdersAsync(cancelBatch)).to.be.rejectedWith( + return expect(contractWrappers.exchange.batchCancelOrdersAsync(cancelBatch)).to.be.rejectedWith( ExchangeContractErrs.OrderCancelAmountZero, ); }); it('should validate when orderTransactionOptions specify to validate', async () => { return expect( - zeroEx.exchange.batchCancelOrdersAsync(cancelBatch, { + contractWrappers.exchange.batchCancelOrdersAsync(cancelBatch, { shouldValidate: true, }), ).to.be.rejectedWith(ExchangeContractErrs.OrderCancelAmountZero); }); it('should not validate when orderTransactionOptions specify not to validate', async () => { return expect( - zeroEx.exchange.batchCancelOrdersAsync(cancelBatch, { + contractWrappers.exchange.batchCancelOrdersAsync(cancelBatch, { shouldValidate: false, }), ).to.not.be.rejectedWith(ExchangeContractErrs.OrderCancelAmountZero); @@ -854,53 +873,63 @@ describe('ExchangeWrapper', () => { fillableAmount, partialFillAmount, ); - orderHash = ZeroEx.getOrderHashHex(signedOrder); + orderHash = getOrderHashHex(signedOrder); }); describe('#getUnavailableTakerAmountAsync', () => { it('should throw if passed an invalid orderHash', async () => { const invalidOrderHashHex = '0x123'; - return expect(zeroEx.exchange.getUnavailableTakerAmountAsync(invalidOrderHashHex)).to.be.rejected(); + return expect( + contractWrappers.exchange.getUnavailableTakerAmountAsync(invalidOrderHashHex), + ).to.be.rejected(); }); it('should return zero if passed a valid but non-existent orderHash', async () => { - const unavailableValueT = await zeroEx.exchange.getUnavailableTakerAmountAsync(NON_EXISTENT_ORDER_HASH); + const unavailableValueT = await contractWrappers.exchange.getUnavailableTakerAmountAsync( + NON_EXISTENT_ORDER_HASH, + ); expect(unavailableValueT).to.be.bignumber.equal(0); }); it('should return the unavailableValueT for a valid and partially filled orderHash', async () => { - const unavailableValueT = await zeroEx.exchange.getUnavailableTakerAmountAsync(orderHash); + const unavailableValueT = await contractWrappers.exchange.getUnavailableTakerAmountAsync(orderHash); expect(unavailableValueT).to.be.bignumber.equal(partialFillAmount); }); }); describe('#getFilledTakerAmountAsync', () => { it('should throw if passed an invalid orderHash', async () => { const invalidOrderHashHex = '0x123'; - return expect(zeroEx.exchange.getFilledTakerAmountAsync(invalidOrderHashHex)).to.be.rejected(); + return expect( + contractWrappers.exchange.getFilledTakerAmountAsync(invalidOrderHashHex), + ).to.be.rejected(); }); it('should return zero if passed a valid but non-existent orderHash', async () => { - const filledValueT = await zeroEx.exchange.getFilledTakerAmountAsync(NON_EXISTENT_ORDER_HASH); + const filledValueT = await contractWrappers.exchange.getFilledTakerAmountAsync(NON_EXISTENT_ORDER_HASH); expect(filledValueT).to.be.bignumber.equal(0); }); it('should return the filledValueT for a valid and partially filled orderHash', async () => { - const filledValueT = await zeroEx.exchange.getFilledTakerAmountAsync(orderHash); + const filledValueT = await contractWrappers.exchange.getFilledTakerAmountAsync(orderHash); expect(filledValueT).to.be.bignumber.equal(partialFillAmount); }); }); describe('#getCancelledTakerAmountAsync', () => { it('should throw if passed an invalid orderHash', async () => { const invalidOrderHashHex = '0x123'; - return expect(zeroEx.exchange.getCancelledTakerAmountAsync(invalidOrderHashHex)).to.be.rejected(); + return expect( + contractWrappers.exchange.getCancelledTakerAmountAsync(invalidOrderHashHex), + ).to.be.rejected(); }); it('should return zero if passed a valid but non-existent orderHash', async () => { - const cancelledValueT = await zeroEx.exchange.getCancelledTakerAmountAsync(NON_EXISTENT_ORDER_HASH); + const cancelledValueT = await contractWrappers.exchange.getCancelledTakerAmountAsync( + NON_EXISTENT_ORDER_HASH, + ); expect(cancelledValueT).to.be.bignumber.equal(0); }); it('should return the cancelledValueT for a valid and partially filled orderHash', async () => { - const cancelledValueT = await zeroEx.exchange.getCancelledTakerAmountAsync(orderHash); + const cancelledValueT = await contractWrappers.exchange.getCancelledTakerAmountAsync(orderHash); expect(cancelledValueT).to.be.bignumber.equal(0); }); it('should return the cancelledValueT for a valid and cancelled orderHash', async () => { const cancelAmount = fillableAmount.minus(partialFillAmount); - await zeroEx.exchange.cancelOrderAsync(signedOrder, cancelAmount); - const cancelledValueT = await zeroEx.exchange.getCancelledTakerAmountAsync(orderHash); + await contractWrappers.exchange.cancelOrderAsync(signedOrder, cancelAmount); + const cancelledValueT = await contractWrappers.exchange.getCancelledTakerAmountAsync(orderHash); expect(cancelledValueT).to.be.bignumber.equal(cancelAmount); }); }); @@ -934,7 +963,7 @@ describe('ExchangeWrapper', () => { ); }); afterEach(async () => { - zeroEx.exchange.unsubscribeAll(); + contractWrappers.exchange.unsubscribeAll(); }); // Hack: Mocha does not allow a test to be both async and have a `done` callback // Since we need to await the receipt of the event in the `subscribe` callback, @@ -943,13 +972,13 @@ describe('ExchangeWrapper', () => { // Source: https://github.com/mochajs/mocha/issues/2407 it('Should receive the LogFill event when an order is filled', (done: DoneCallback) => { (async () => { - const callback = reportNodeCallbackErrors(done)( + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)( (logEvent: DecodedLogEvent<LogFillContractEventArgs>) => { expect(logEvent.log.event).to.be.equal(ExchangeEvents.LogFill); }, ); - zeroEx.exchange.subscribe(ExchangeEvents.LogFill, indexFilterValues, callback); - await zeroEx.exchange.fillOrderAsync( + contractWrappers.exchange.subscribe(ExchangeEvents.LogFill, indexFilterValues, callback); + await contractWrappers.exchange.fillOrderAsync( signedOrder, takerTokenFillAmountInBaseUnits, shouldThrowOnInsufficientBalanceOrAllowance, @@ -959,33 +988,33 @@ describe('ExchangeWrapper', () => { }); it('Should receive the LogCancel event when an order is cancelled', (done: DoneCallback) => { (async () => { - const callback = reportNodeCallbackErrors(done)( + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)( (logEvent: DecodedLogEvent<LogCancelContractEventArgs>) => { expect(logEvent.log.event).to.be.equal(ExchangeEvents.LogCancel); }, ); - zeroEx.exchange.subscribe(ExchangeEvents.LogCancel, indexFilterValues, callback); - await zeroEx.exchange.cancelOrderAsync(signedOrder, cancelTakerAmountInBaseUnits); + contractWrappers.exchange.subscribe(ExchangeEvents.LogCancel, indexFilterValues, callback); + await contractWrappers.exchange.cancelOrderAsync(signedOrder, cancelTakerAmountInBaseUnits); })().catch(done); }); - it('Outstanding subscriptions are cancelled when zeroEx.setProvider called', (done: DoneCallback) => { + it('Outstanding subscriptions are cancelled when contractWrappers.setProvider called', (done: DoneCallback) => { (async () => { - const callbackNeverToBeCalled = reportNodeCallbackErrors(done)( + const callbackNeverToBeCalled = callbackErrorReporter.reportNodeCallbackErrors(done)( (logEvent: DecodedLogEvent<LogFillContractEventArgs>) => { done(new Error('Expected this subscription to have been cancelled')); }, ); - zeroEx.exchange.subscribe(ExchangeEvents.LogFill, indexFilterValues, callbackNeverToBeCalled); + contractWrappers.exchange.subscribe(ExchangeEvents.LogFill, indexFilterValues, callbackNeverToBeCalled); - zeroEx.setProvider(provider, constants.TESTRPC_NETWORK_ID); + contractWrappers.setProvider(provider, constants.TESTRPC_NETWORK_ID); - const callback = reportNodeCallbackErrors(done)( + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)( (logEvent: DecodedLogEvent<LogFillContractEventArgs>) => { expect(logEvent.log.event).to.be.equal(ExchangeEvents.LogFill); }, ); - zeroEx.exchange.subscribe(ExchangeEvents.LogFill, indexFilterValues, callback); - await zeroEx.exchange.fillOrderAsync( + contractWrappers.exchange.subscribe(ExchangeEvents.LogFill, indexFilterValues, callback); + await contractWrappers.exchange.fillOrderAsync( signedOrder, takerTokenFillAmountInBaseUnits, shouldThrowOnInsufficientBalanceOrAllowance, @@ -995,18 +1024,18 @@ describe('ExchangeWrapper', () => { }); it('Should cancel subscription when unsubscribe called', (done: DoneCallback) => { (async () => { - const callbackNeverToBeCalled = reportNodeCallbackErrors(done)( + const callbackNeverToBeCalled = callbackErrorReporter.reportNodeCallbackErrors(done)( (logEvent: DecodedLogEvent<LogFillContractEventArgs>) => { done(new Error('Expected this subscription to have been cancelled')); }, ); - const subscriptionToken = zeroEx.exchange.subscribe( + const subscriptionToken = contractWrappers.exchange.subscribe( ExchangeEvents.LogFill, indexFilterValues, callbackNeverToBeCalled, ); - zeroEx.exchange.unsubscribe(subscriptionToken); - await zeroEx.exchange.fillOrderAsync( + contractWrappers.exchange.unsubscribe(subscriptionToken); + await contractWrappers.exchange.fillOrderAsync( signedOrder, takerTokenFillAmountInBaseUnits, shouldThrowOnInsufficientBalanceOrAllowance, @@ -1036,8 +1065,8 @@ describe('ExchangeWrapper', () => { takerAddress, fillableAmount, ); - const orderHash = ZeroEx.getOrderHashHex(signedOrder); - const orderHashFromContract = await (zeroEx.exchange as any)._getOrderHashHexUsingContractCallAsync( + const orderHash = getOrderHashHex(signedOrder); + const orderHashFromContract = await (contractWrappers.exchange as any)._getOrderHashHexUsingContractCallAsync( signedOrder, ); expect(orderHash).to.equal(orderHashFromContract); @@ -1045,7 +1074,7 @@ describe('ExchangeWrapper', () => { }); describe('#getZRXTokenAddressAsync', () => { it('gets the same token as is in token registry', () => { - const zrxAddress = zeroEx.exchange.getZRXTokenAddress(); + const zrxAddress = contractWrappers.exchange.getZRXTokenAddress(); const zrxToken = tokenUtils.getProtocolTokenOrThrow(); expect(zrxAddress).to.equal(zrxToken.address); }); @@ -1076,16 +1105,16 @@ describe('ExchangeWrapper', () => { takerAddress, fillableAmount, ); - txHash = await zeroEx.exchange.fillOrderAsync( + txHash = await contractWrappers.exchange.fillOrderAsync( signedOrder, fillableAmount, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress, ); - await zeroEx.awaitTransactionMinedAsync(txHash); + await web3Wrapper.awaitTransactionMinedAsync(txHash); const eventName = ExchangeEvents.LogFill; const indexFilterValues = {}; - const logs = await zeroEx.exchange.getLogsAsync(eventName, blockRange, indexFilterValues); + const logs = await contractWrappers.exchange.getLogsAsync(eventName, blockRange, indexFilterValues); expect(logs).to.have.length(1); expect(logs[0].event).to.be.equal(eventName); }); @@ -1097,16 +1126,20 @@ describe('ExchangeWrapper', () => { takerAddress, fillableAmount, ); - txHash = await zeroEx.exchange.fillOrderAsync( + txHash = await contractWrappers.exchange.fillOrderAsync( signedOrder, fillableAmount, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress, ); - await zeroEx.awaitTransactionMinedAsync(txHash); + await web3Wrapper.awaitTransactionMinedAsync(txHash); const differentEventName = ExchangeEvents.LogCancel; const indexFilterValues = {}; - const logs = await zeroEx.exchange.getLogsAsync(differentEventName, blockRange, indexFilterValues); + const logs = await contractWrappers.exchange.getLogsAsync( + differentEventName, + blockRange, + indexFilterValues, + ); expect(logs).to.have.length(0); }); it('should only get the logs with the correct indexed fields', async () => { @@ -1117,13 +1150,13 @@ describe('ExchangeWrapper', () => { takerAddress, fillableAmount, ); - txHash = await zeroEx.exchange.fillOrderAsync( + txHash = await contractWrappers.exchange.fillOrderAsync( signedOrder, fillableAmount, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress, ); - await zeroEx.awaitTransactionMinedAsync(txHash); + await web3Wrapper.awaitTransactionMinedAsync(txHash); const differentMakerAddress = userAddresses[2]; const anotherSignedOrder = await fillScenarios.createFillableSignedOrderAsync( @@ -1133,19 +1166,19 @@ describe('ExchangeWrapper', () => { takerAddress, fillableAmount, ); - txHash = await zeroEx.exchange.fillOrderAsync( + txHash = await contractWrappers.exchange.fillOrderAsync( anotherSignedOrder, fillableAmount, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress, ); - await zeroEx.awaitTransactionMinedAsync(txHash); + await web3Wrapper.awaitTransactionMinedAsync(txHash); const eventName = ExchangeEvents.LogFill; const indexFilterValues = { maker: differentMakerAddress, }; - const logs = await zeroEx.exchange.getLogsAsync<LogFillContractEventArgs>( + const logs = await contractWrappers.exchange.getLogsAsync<LogFillContractEventArgs>( eventName, blockRange, indexFilterValues, @@ -1162,10 +1195,10 @@ describe('ExchangeWrapper', () => { let takerToken: Token; let signedOrder: SignedOrder; let orderState: OrderState; - const fillableAmount = ZeroEx.toBaseUnitAmount(new BigNumber(5), constants.ZRX_DECIMALS); + const fillableAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(5), constants.ZRX_DECIMALS); before(async () => { [, maker, taker] = userAddresses; - tokens = await zeroEx.tokenRegistry.getTokensAsync(); + tokens = await contractWrappers.tokenRegistry.getTokensAsync(); [makerToken, takerToken] = tokenUtils.getDummyTokens(); }); it('should report orderStateValid when order is fillable', async () => { @@ -1176,7 +1209,7 @@ describe('ExchangeWrapper', () => { taker, fillableAmount, ); - orderState = await zeroEx.exchange.getOrderStateAsync(signedOrder); + orderState = await contractWrappers.exchange.getOrderStateAsync(signedOrder); expect(orderState.isValid).to.be.true(); }); it('should report orderStateInvalid when maker allowance set to 0', async () => { @@ -1187,8 +1220,8 @@ describe('ExchangeWrapper', () => { taker, fillableAmount, ); - await zeroEx.token.setProxyAllowanceAsync(makerToken.address, maker, new BigNumber(0)); - orderState = await zeroEx.exchange.getOrderStateAsync(signedOrder); + await contractWrappers.token.setProxyAllowanceAsync(makerToken.address, maker, new BigNumber(0)); + orderState = await contractWrappers.exchange.getOrderStateAsync(signedOrder); expect(orderState.isValid).to.be.false(); }); }); diff --git a/packages/contract-wrappers/test/global_hooks.ts b/packages/contract-wrappers/test/global_hooks.ts new file mode 100644 index 000000000..e3c986524 --- /dev/null +++ b/packages/contract-wrappers/test/global_hooks.ts @@ -0,0 +1,7 @@ +import { runMigrationsAsync } from '@0xproject/migrations'; + +import { deployer } from './utils/deployer'; + +before('migrate contracts', async () => { + await runMigrationsAsync(deployer); +}); diff --git a/packages/0x.js/test/order_validation_test.ts b/packages/contract-wrappers/test/order_validation_test.ts index 0cb95c1b6..d28549ba2 100644 --- a/packages/0x.js/test/order_validation_test.ts +++ b/packages/contract-wrappers/test/order_validation_test.ts @@ -1,18 +1,18 @@ import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils'; +import { FillScenarios } from '@0xproject/fill-scenarios'; import { OrderError } from '@0xproject/order-utils'; import { BlockParamLiteral } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import * as Sinon from 'sinon'; -import { ExchangeContractErrs, SignedOrder, Token, ZeroEx, ZeroExError } from '../src'; +import { ContractWrappers, ContractWrappersError, ExchangeContractErrs, SignedOrder, Token } from '../src'; import { TradeSide, TransferType } from '../src/types'; import { ExchangeTransferSimulator } from '../src/utils/exchange_transfer_simulator'; import { OrderValidationUtils } from '../src/utils/order_validation_utils'; import { chaiSetup } from './utils/chai_setup'; import { constants } from './utils/constants'; -import { FillScenarios } from './utils/fill_scenarios'; import { TokenUtils } from './utils/token_utils'; import { provider, web3Wrapper } from './utils/web3_wrapper'; @@ -21,7 +21,7 @@ const expect = chai.expect; const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); describe('OrderValidation', () => { - let zeroEx: ZeroEx; + let contractWrappers: ContractWrappers; let userAddresses: string[]; let tokens: Token[]; let tokenUtils: TokenUtils; @@ -40,14 +40,14 @@ describe('OrderValidation', () => { networkId: constants.TESTRPC_NETWORK_ID, }; before(async () => { - zeroEx = new ZeroEx(provider, config); - exchangeContractAddress = zeroEx.exchange.getContractAddress(); - userAddresses = await zeroEx.getAvailableAddressesAsync(); + contractWrappers = new ContractWrappers(provider, config); + exchangeContractAddress = contractWrappers.exchange.getContractAddress(); + userAddresses = await web3Wrapper.getAvailableAddressesAsync(); [coinbase, makerAddress, takerAddress, feeRecipient] = userAddresses; - tokens = await zeroEx.tokenRegistry.getTokensAsync(); + tokens = await contractWrappers.tokenRegistry.getTokensAsync(); tokenUtils = new TokenUtils(tokens); zrxTokenAddress = tokenUtils.getProtocolTokenOrThrow().address; - fillScenarios = new FillScenarios(zeroEx, userAddresses, tokens, zrxTokenAddress, exchangeContractAddress); + fillScenarios = new FillScenarios(provider, userAddresses, tokens, zrxTokenAddress, exchangeContractAddress); const [makerToken, takerToken] = tokenUtils.getDummyTokens(); makerTokenAddress = makerToken.address; takerTokenAddress = takerToken.address; @@ -67,7 +67,7 @@ describe('OrderValidation', () => { takerAddress, fillableAmount, ); - await zeroEx.exchange.validateOrderFillableOrThrowAsync(signedOrder); + await contractWrappers.exchange.validateOrderFillableOrThrowAsync(signedOrder); }); it('should succeed if the maker is buying ZRX and has no ZRX balance', async () => { const makerFee = new BigNumber(2); @@ -82,9 +82,9 @@ describe('OrderValidation', () => { fillableAmount, feeRecipient, ); - const zrxMakerBalance = await zeroEx.token.getBalanceAsync(zrxTokenAddress, makerAddress); - await zeroEx.token.transferAsync(zrxTokenAddress, makerAddress, takerAddress, zrxMakerBalance); - await zeroEx.exchange.validateOrderFillableOrThrowAsync(signedOrder); + const zrxMakerBalance = await contractWrappers.token.getBalanceAsync(zrxTokenAddress, makerAddress); + await contractWrappers.token.transferAsync(zrxTokenAddress, makerAddress, takerAddress, zrxMakerBalance); + await contractWrappers.exchange.validateOrderFillableOrThrowAsync(signedOrder); }); it('should succeed if the maker is buying ZRX and has no ZRX balance and there is no specified taker', async () => { const makerFee = new BigNumber(2); @@ -99,9 +99,9 @@ describe('OrderValidation', () => { fillableAmount, feeRecipient, ); - const zrxMakerBalance = await zeroEx.token.getBalanceAsync(zrxTokenAddress, makerAddress); - await zeroEx.token.transferAsync(zrxTokenAddress, makerAddress, takerAddress, zrxMakerBalance); - await zeroEx.exchange.validateOrderFillableOrThrowAsync(signedOrder); + const zrxMakerBalance = await contractWrappers.token.getBalanceAsync(zrxTokenAddress, makerAddress); + await contractWrappers.token.transferAsync(zrxTokenAddress, makerAddress, takerAddress, zrxMakerBalance); + await contractWrappers.exchange.validateOrderFillableOrThrowAsync(signedOrder); }); it('should succeed if the order is asymmetric and fillable', async () => { const makerFillableAmount = fillableAmount; @@ -114,7 +114,7 @@ describe('OrderValidation', () => { makerFillableAmount, takerFillableAmount, ); - await zeroEx.exchange.validateOrderFillableOrThrowAsync(signedOrder); + await contractWrappers.exchange.validateOrderFillableOrThrowAsync(signedOrder); }); it('should throw when the order is fully filled or cancelled', async () => { const signedOrder = await fillScenarios.createFillableSignedOrderAsync( @@ -124,8 +124,8 @@ describe('OrderValidation', () => { takerAddress, fillableAmount, ); - await zeroEx.exchange.cancelOrderAsync(signedOrder, fillableAmount); - return expect(zeroEx.exchange.validateOrderFillableOrThrowAsync(signedOrder)).to.be.rejectedWith( + await contractWrappers.exchange.cancelOrderAsync(signedOrder, fillableAmount); + return expect(contractWrappers.exchange.validateOrderFillableOrThrowAsync(signedOrder)).to.be.rejectedWith( ExchangeContractErrs.OrderRemainingFillAmountZero, ); }); @@ -139,7 +139,7 @@ describe('OrderValidation', () => { fillableAmount, expirationInPast, ); - return expect(zeroEx.exchange.validateOrderFillableOrThrowAsync(signedOrder)).to.be.rejectedWith( + return expect(contractWrappers.exchange.validateOrderFillableOrThrowAsync(signedOrder)).to.be.rejectedWith( ExchangeContractErrs.OrderFillExpired, ); }); @@ -155,7 +155,11 @@ describe('OrderValidation', () => { ); const zeroFillAmount = new BigNumber(0); return expect( - zeroEx.exchange.validateFillOrderThrowIfInvalidAsync(signedOrder, zeroFillAmount, takerAddress), + contractWrappers.exchange.validateFillOrderThrowIfInvalidAsync( + signedOrder, + zeroFillAmount, + takerAddress, + ), ).to.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero); }); it('should throw when the signature is invalid', async () => { @@ -169,7 +173,11 @@ describe('OrderValidation', () => { // 27 <--> 28 signedOrder.ecSignature.v = 28 - signedOrder.ecSignature.v + 27; return expect( - zeroEx.exchange.validateFillOrderThrowIfInvalidAsync(signedOrder, fillableAmount, takerAddress), + contractWrappers.exchange.validateFillOrderThrowIfInvalidAsync( + signedOrder, + fillableAmount, + takerAddress, + ), ).to.be.rejectedWith(OrderError.InvalidSignature); }); it('should throw when the order is fully filled or cancelled', async () => { @@ -180,9 +188,13 @@ describe('OrderValidation', () => { takerAddress, fillableAmount, ); - await zeroEx.exchange.cancelOrderAsync(signedOrder, fillableAmount); + await contractWrappers.exchange.cancelOrderAsync(signedOrder, fillableAmount); return expect( - zeroEx.exchange.validateFillOrderThrowIfInvalidAsync(signedOrder, fillableAmount, takerAddress), + contractWrappers.exchange.validateFillOrderThrowIfInvalidAsync( + signedOrder, + fillableAmount, + takerAddress, + ), ).to.be.rejectedWith(ExchangeContractErrs.OrderRemainingFillAmountZero); }); it('should throw when sender is not a taker', async () => { @@ -195,7 +207,11 @@ describe('OrderValidation', () => { ); const nonTakerAddress = userAddresses[6]; return expect( - zeroEx.exchange.validateFillOrderThrowIfInvalidAsync(signedOrder, fillTakerAmount, nonTakerAddress), + contractWrappers.exchange.validateFillOrderThrowIfInvalidAsync( + signedOrder, + fillTakerAmount, + nonTakerAddress, + ), ).to.be.rejectedWith(ExchangeContractErrs.TransactionSenderIsNotFillOrderTaker); }); it('should throw when order is expired', async () => { @@ -209,7 +225,11 @@ describe('OrderValidation', () => { expirationInPast, ); return expect( - zeroEx.exchange.validateFillOrderThrowIfInvalidAsync(signedOrder, fillTakerAmount, takerAddress), + contractWrappers.exchange.validateFillOrderThrowIfInvalidAsync( + signedOrder, + fillTakerAmount, + takerAddress, + ), ).to.be.rejectedWith(ExchangeContractErrs.OrderFillExpired); }); it('should throw when there a rounding error would have occurred', async () => { @@ -225,7 +245,7 @@ describe('OrderValidation', () => { ); const fillTakerAmountThatCausesRoundingError = new BigNumber(3); return expect( - zeroEx.exchange.validateFillOrderThrowIfInvalidAsync( + contractWrappers.exchange.validateFillOrderThrowIfInvalidAsync( signedOrder, fillTakerAmountThatCausesRoundingError, takerAddress, @@ -244,13 +264,13 @@ describe('OrderValidation', () => { ); const tooLargeFillAmount = new BigNumber(7); const fillAmountDifference = tooLargeFillAmount.minus(fillableAmount); - await zeroEx.token.transferAsync(takerTokenAddress, coinbase, takerAddress, fillAmountDifference); - await zeroEx.token.setProxyAllowanceAsync(takerTokenAddress, takerAddress, tooLargeFillAmount); - await zeroEx.token.transferAsync(makerTokenAddress, coinbase, makerAddress, fillAmountDifference); - await zeroEx.token.setProxyAllowanceAsync(makerTokenAddress, makerAddress, tooLargeFillAmount); + await contractWrappers.token.transferAsync(takerTokenAddress, coinbase, takerAddress, fillAmountDifference); + await contractWrappers.token.setProxyAllowanceAsync(takerTokenAddress, takerAddress, tooLargeFillAmount); + await contractWrappers.token.transferAsync(makerTokenAddress, coinbase, makerAddress, fillAmountDifference); + await contractWrappers.token.setProxyAllowanceAsync(makerTokenAddress, makerAddress, tooLargeFillAmount); return expect( - zeroEx.exchange.validateFillOrKillOrderThrowIfInvalidAsync( + contractWrappers.exchange.validateFillOrKillOrderThrowIfInvalidAsync( signedOrder, tooLargeFillAmount, takerAddress, @@ -277,7 +297,7 @@ describe('OrderValidation', () => { it('should throw when cancel amount is zero', async () => { const zeroCancelAmount = new BigNumber(0); return expect( - zeroEx.exchange.validateCancelOrderThrowIfInvalidAsync(signedOrder, zeroCancelAmount), + contractWrappers.exchange.validateCancelOrderThrowIfInvalidAsync(signedOrder, zeroCancelAmount), ).to.be.rejectedWith(ExchangeContractErrs.OrderCancelAmountZero); }); it('should throw when order is expired', async () => { @@ -291,13 +311,13 @@ describe('OrderValidation', () => { expirationInPast, ); return expect( - zeroEx.exchange.validateCancelOrderThrowIfInvalidAsync(expiredSignedOrder, cancelAmount), + contractWrappers.exchange.validateCancelOrderThrowIfInvalidAsync(expiredSignedOrder, cancelAmount), ).to.be.rejectedWith(ExchangeContractErrs.OrderCancelExpired); }); it('should throw when order is already cancelled or filled', async () => { - await zeroEx.exchange.cancelOrderAsync(signedOrder, fillableAmount); + await contractWrappers.exchange.cancelOrderAsync(signedOrder, fillableAmount); return expect( - zeroEx.exchange.validateCancelOrderThrowIfInvalidAsync(signedOrder, fillableAmount), + contractWrappers.exchange.validateCancelOrderThrowIfInvalidAsync(signedOrder, fillableAmount), ).to.be.rejectedWith(ExchangeContractErrs.OrderAlreadyCancelledOrFilled); }); }); @@ -308,7 +328,7 @@ describe('OrderValidation', () => { return Sinon.match((value: BigNumber) => value.eq(expected)); }; beforeEach('create exchangeTransferSimulator', async () => { - exchangeTransferSimulator = new ExchangeTransferSimulator(zeroEx.token, BlockParamLiteral.Latest); + exchangeTransferSimulator = new ExchangeTransferSimulator(contractWrappers.token, BlockParamLiteral.Latest); transferFromAsync = Sinon.spy(); exchangeTransferSimulator.transferFromAsync = transferFromAsync as any; }); @@ -391,7 +411,7 @@ describe('OrderValidation', () => { makerFee, takerFee, makerAddress, - ZeroEx.NULL_ADDRESS, + constants.NULL_ADDRESS, fillableAmount, feeRecipient, ); @@ -485,7 +505,7 @@ describe('OrderValidation', () => { makerAddress, takerAddress, fillableAmount, - ZeroEx.NULL_ADDRESS, + constants.NULL_ADDRESS, ); const fillTakerTokenAmount = fillableAmount.div(2).round(0); await OrderValidationUtils.validateFillOrderBalancesAllowancesThrowIfInvalidAsync( diff --git a/packages/0x.js/test/subscription_test.ts b/packages/contract-wrappers/test/subscription_test.ts index ed4f838c0..64262ad9c 100644 --- a/packages/0x.js/test/subscription_test.ts +++ b/packages/contract-wrappers/test/subscription_test.ts @@ -1,22 +1,21 @@ -import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils'; +import { BlockchainLifecycle, callbackErrorReporter, devConstants } from '@0xproject/dev-utils'; +import { DoneCallback } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import 'mocha'; import * as Sinon from 'sinon'; -import { ApprovalContractEventArgs, DecodedLogEvent, Token, TokenEvents, ZeroEx } from '../src'; -import { DoneCallback } from '../src/types'; +import { ApprovalContractEventArgs, ContractWrappers, DecodedLogEvent, Token, TokenEvents } from '../src'; import { chaiSetup } from './utils/chai_setup'; import { constants } from './utils/constants'; -import { assertNodeCallbackError } from './utils/report_callback_errors'; import { provider, web3Wrapper } from './utils/web3_wrapper'; chaiSetup.configure(); const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); describe('SubscriptionTest', () => { - let zeroEx: ZeroEx; + let contractWrappers: ContractWrappers; let userAddresses: string[]; let tokens: Token[]; let coinbase: string; @@ -25,9 +24,9 @@ describe('SubscriptionTest', () => { networkId: constants.TESTRPC_NETWORK_ID, }; before(async () => { - zeroEx = new ZeroEx(provider, config); - userAddresses = await zeroEx.getAvailableAddressesAsync(); - tokens = await zeroEx.tokenRegistry.getTokensAsync(); + contractWrappers = new ContractWrappers(provider, config); + userAddresses = await web3Wrapper.getAvailableAddressesAsync(); + tokens = await contractWrappers.tokenRegistry.getTokensAsync(); coinbase = userAddresses[0]; addressWithoutFunds = userAddresses[1]; }); @@ -47,34 +46,48 @@ describe('SubscriptionTest', () => { tokenAddress = token.address; }); afterEach(() => { - zeroEx.token.unsubscribeAll(); + contractWrappers.token.unsubscribeAll(); _.each(stubs, s => s.restore()); stubs = []; }); it('Should receive the Error when an error occurs while fetching the block', (done: DoneCallback) => { (async () => { const errMsg = 'Error fetching block'; - const callback = assertNodeCallbackError(done, errMsg); - stubs = [Sinon.stub((zeroEx as any)._web3Wrapper, 'getBlockAsync').throws(new Error(errMsg))]; - zeroEx.token.subscribe(tokenAddress, TokenEvents.Approval, indexFilterValues, callback); - await zeroEx.token.setAllowanceAsync(tokenAddress, coinbase, addressWithoutFunds, allowanceAmount); + const callback = callbackErrorReporter.assertNodeCallbackError(done, errMsg); + stubs = [Sinon.stub((contractWrappers as any)._web3Wrapper, 'getBlockAsync').throws(new Error(errMsg))]; + contractWrappers.token.subscribe(tokenAddress, TokenEvents.Approval, indexFilterValues, callback); + await contractWrappers.token.setAllowanceAsync( + tokenAddress, + coinbase, + addressWithoutFunds, + allowanceAmount, + ); })().catch(done); }); it('Should receive the Error when an error occurs while reconciling the new block', (done: DoneCallback) => { (async () => { const errMsg = 'Error fetching logs'; - const callback = assertNodeCallbackError(done, errMsg); - stubs = [Sinon.stub((zeroEx as any)._web3Wrapper, 'getLogsAsync').throws(new Error(errMsg))]; - zeroEx.token.subscribe(tokenAddress, TokenEvents.Approval, indexFilterValues, callback); - await zeroEx.token.setAllowanceAsync(tokenAddress, coinbase, addressWithoutFunds, allowanceAmount); + const callback = callbackErrorReporter.assertNodeCallbackError(done, errMsg); + stubs = [Sinon.stub((contractWrappers as any)._web3Wrapper, 'getLogsAsync').throws(new Error(errMsg))]; + contractWrappers.token.subscribe(tokenAddress, TokenEvents.Approval, indexFilterValues, callback); + await contractWrappers.token.setAllowanceAsync( + tokenAddress, + coinbase, + addressWithoutFunds, + allowanceAmount, + ); })().catch(done); }); it('Should allow unsubscribeAll to be called successfully after an error', (done: DoneCallback) => { (async () => { const callback = (err: Error | null, logEvent?: DecodedLogEvent<ApprovalContractEventArgs>) => _.noop; - zeroEx.token.subscribe(tokenAddress, TokenEvents.Approval, indexFilterValues, callback); - stubs = [Sinon.stub((zeroEx as any)._web3Wrapper, 'getBlockAsync').throws(new Error('JSON RPC error'))]; - zeroEx.token.unsubscribeAll(); + contractWrappers.token.subscribe(tokenAddress, TokenEvents.Approval, indexFilterValues, callback); + stubs = [ + Sinon.stub((contractWrappers as any)._web3Wrapper, 'getBlockAsync').throws( + new Error('JSON RPC error'), + ), + ]; + contractWrappers.token.unsubscribeAll(); done(); })().catch(done); }); diff --git a/packages/0x.js/test/token_registry_wrapper_test.ts b/packages/contract-wrappers/test/token_registry_wrapper_test.ts index 19caa2ed4..1b8ce4d74 100644 --- a/packages/0x.js/test/token_registry_wrapper_test.ts +++ b/packages/contract-wrappers/test/token_registry_wrapper_test.ts @@ -4,7 +4,7 @@ import * as chai from 'chai'; import * as _ from 'lodash'; import 'mocha'; -import { Token, ZeroEx } from '../src'; +import { ContractWrappers, Token } from '../src'; import { chaiSetup } from './utils/chai_setup'; import { constants } from './utils/constants'; @@ -17,7 +17,7 @@ const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); const TOKEN_REGISTRY_SIZE_AFTER_MIGRATION = 7; describe('TokenRegistryWrapper', () => { - let zeroEx: ZeroEx; + let contractWrappers: ContractWrappers; let tokens: Token[]; const tokenAddressBySymbol: { [symbol: string]: string } = {}; const tokenAddressByName: { [symbol: string]: string } = {}; @@ -31,8 +31,8 @@ describe('TokenRegistryWrapper', () => { networkId: constants.TESTRPC_NETWORK_ID, }; before(async () => { - zeroEx = new ZeroEx(provider, config); - tokens = await zeroEx.tokenRegistry.getTokensAsync(); + contractWrappers = new ContractWrappers(provider, config); + tokens = await contractWrappers.tokenRegistry.getTokensAsync(); _.map(tokens, token => { tokenAddressBySymbol[token.symbol] = token.address; tokenAddressByName[token.name] = token.address; @@ -59,54 +59,60 @@ describe('TokenRegistryWrapper', () => { }); describe('#getTokenAddressesAsync', () => { it('should return all the token addresses added to the tokenRegistry during the migration', async () => { - const tokenAddresses = await zeroEx.tokenRegistry.getTokenAddressesAsync(); + const tokenAddresses = await contractWrappers.tokenRegistry.getTokenAddressesAsync(); expect(tokenAddresses).to.have.lengthOf(TOKEN_REGISTRY_SIZE_AFTER_MIGRATION); const schemaValidator = new SchemaValidator(); _.each(tokenAddresses, tokenAddress => { const validationResult = schemaValidator.validate(tokenAddress, schemas.addressSchema); expect(validationResult.errors).to.have.lengthOf(0); - expect(tokenAddress).to.not.be.equal(ZeroEx.NULL_ADDRESS); + expect(tokenAddress).to.not.be.equal(constants.NULL_ADDRESS); }); }); }); describe('#getTokenAddressBySymbol', () => { it('should return correct address for a token in the registry', async () => { - const tokenAddress = await zeroEx.tokenRegistry.getTokenAddressBySymbolIfExistsAsync(registeredSymbol); + const tokenAddress = await contractWrappers.tokenRegistry.getTokenAddressBySymbolIfExistsAsync( + registeredSymbol, + ); expect(tokenAddress).to.be.equal(tokenAddressBySymbol[registeredSymbol]); }); it('should return undefined for a token out of registry', async () => { - const tokenAddress = await zeroEx.tokenRegistry.getTokenAddressBySymbolIfExistsAsync(unregisteredSymbol); + const tokenAddress = await contractWrappers.tokenRegistry.getTokenAddressBySymbolIfExistsAsync( + unregisteredSymbol, + ); expect(tokenAddress).to.be.undefined(); }); }); describe('#getTokenAddressByName', () => { it('should return correct address for a token in the registry', async () => { - const tokenAddress = await zeroEx.tokenRegistry.getTokenAddressByNameIfExistsAsync(registeredName); + const tokenAddress = await contractWrappers.tokenRegistry.getTokenAddressByNameIfExistsAsync(registeredName); expect(tokenAddress).to.be.equal(tokenAddressByName[registeredName]); }); it('should return undefined for a token out of registry', async () => { - const tokenAddress = await zeroEx.tokenRegistry.getTokenAddressByNameIfExistsAsync(unregisteredName); + const tokenAddress = await contractWrappers.tokenRegistry.getTokenAddressByNameIfExistsAsync( + unregisteredName, + ); expect(tokenAddress).to.be.undefined(); }); }); describe('#getTokenBySymbol', () => { it('should return correct token for a token in the registry', async () => { - const token = await zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(registeredSymbol); + const token = await contractWrappers.tokenRegistry.getTokenBySymbolIfExistsAsync(registeredSymbol); expect(token).to.be.deep.equal(tokenBySymbol[registeredSymbol]); }); it('should return undefined for a token out of registry', async () => { - const token = await zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(unregisteredSymbol); + const token = await contractWrappers.tokenRegistry.getTokenBySymbolIfExistsAsync(unregisteredSymbol); expect(token).to.be.undefined(); }); }); describe('#getTokenByName', () => { it('should return correct token for a token in the registry', async () => { - const token = await zeroEx.tokenRegistry.getTokenByNameIfExistsAsync(registeredName); + const token = await contractWrappers.tokenRegistry.getTokenByNameIfExistsAsync(registeredName); expect(token).to.be.deep.equal(tokenByName[registeredName]); }); it('should return undefined for a token out of registry', async () => { - const token = await zeroEx.tokenRegistry.getTokenByNameIfExistsAsync(unregisteredName); + const token = await contractWrappers.tokenRegistry.getTokenByNameIfExistsAsync(unregisteredName); expect(token).to.be.undefined(); }); }); @@ -114,14 +120,14 @@ describe('TokenRegistryWrapper', () => { it('should return the token added to the tokenRegistry during the migration', async () => { const aToken = tokens[0]; - const token = await zeroEx.tokenRegistry.getTokenIfExistsAsync(aToken.address); + const token = await contractWrappers.tokenRegistry.getTokenIfExistsAsync(aToken.address); const schemaValidator = new SchemaValidator(); const validationResult = schemaValidator.validate(token, schemas.tokenSchema); expect(validationResult.errors).to.have.lengthOf(0); }); it('should return return undefined when passed a token address not in the tokenRegistry', async () => { const unregisteredTokenAddress = '0x5409ed021d9299bf6814279a6a1411a7e866a631'; - const tokenIfExists = await zeroEx.tokenRegistry.getTokenIfExistsAsync(unregisteredTokenAddress); + const tokenIfExists = await contractWrappers.tokenRegistry.getTokenIfExistsAsync(unregisteredTokenAddress); expect(tokenIfExists).to.be.undefined(); }); }); diff --git a/packages/0x.js/test/token_transfer_proxy_wrapper_test.ts b/packages/contract-wrappers/test/token_transfer_proxy_wrapper_test.ts index 9415d7c08..0b66985aa 100644 --- a/packages/0x.js/test/token_transfer_proxy_wrapper_test.ts +++ b/packages/contract-wrappers/test/token_transfer_proxy_wrapper_test.ts @@ -1,6 +1,6 @@ import * as chai from 'chai'; -import { ZeroEx } from '../src'; +import { ContractWrappers } from '../src'; import { chaiSetup } from './utils/chai_setup'; import { constants } from './utils/constants'; @@ -10,24 +10,24 @@ chaiSetup.configure(); const expect = chai.expect; describe('TokenTransferProxyWrapper', () => { - let zeroEx: ZeroEx; + let contractWrappers: ContractWrappers; const config = { networkId: constants.TESTRPC_NETWORK_ID, }; before(async () => { - zeroEx = new ZeroEx(provider, config); + contractWrappers = new ContractWrappers(provider, config); }); describe('#isAuthorizedAsync', () => { it('should return false if the address is not authorized', async () => { - const isAuthorized = await zeroEx.proxy.isAuthorizedAsync(ZeroEx.NULL_ADDRESS); + const isAuthorized = await contractWrappers.proxy.isAuthorizedAsync(constants.NULL_ADDRESS); expect(isAuthorized).to.be.false(); }); }); describe('#getAuthorizedAddressesAsync', () => { it('should return the list of authorized addresses', async () => { - const authorizedAddresses = await zeroEx.proxy.getAuthorizedAddressesAsync(); + const authorizedAddresses = await contractWrappers.proxy.getAuthorizedAddressesAsync(); for (const authorizedAddress of authorizedAddresses) { - const isAuthorized = await zeroEx.proxy.isAuthorizedAsync(authorizedAddress); + const isAuthorized = await contractWrappers.proxy.isAuthorizedAsync(authorizedAddress); expect(isAuthorized).to.be.true(); } }); diff --git a/packages/0x.js/test/token_wrapper_test.ts b/packages/contract-wrappers/test/token_wrapper_test.ts index 04fd943aa..053901c85 100644 --- a/packages/0x.js/test/token_wrapper_test.ts +++ b/packages/contract-wrappers/test/token_wrapper_test.ts @@ -1,6 +1,6 @@ -import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils'; +import { BlockchainLifecycle, callbackErrorReporter, devConstants } from '@0xproject/dev-utils'; import { EmptyWalletSubprovider } from '@0xproject/subproviders'; -import { Provider } from '@0xproject/types'; +import { DoneCallback, Provider } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import 'mocha'; @@ -10,18 +10,16 @@ import { ApprovalContractEventArgs, BlockParamLiteral, BlockRange, + ContractWrappers, + ContractWrappersError, DecodedLogEvent, Token, TokenEvents, TransferContractEventArgs, - ZeroEx, - ZeroExError, } from '../src'; -import { DoneCallback } from '../src/types'; import { chaiSetup } from './utils/chai_setup'; import { constants } from './utils/constants'; -import { reportNodeCallbackErrors } from './utils/report_callback_errors'; import { TokenUtils } from './utils/token_utils'; import { provider, web3Wrapper } from './utils/web3_wrapper'; @@ -30,7 +28,7 @@ const expect = chai.expect; const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); describe('TokenWrapper', () => { - let zeroEx: ZeroEx; + let contractWrappers: ContractWrappers; let userAddresses: string[]; let tokens: Token[]; let tokenUtils: TokenUtils; @@ -40,9 +38,9 @@ describe('TokenWrapper', () => { networkId: constants.TESTRPC_NETWORK_ID, }; before(async () => { - zeroEx = new ZeroEx(provider, config); - userAddresses = await zeroEx.getAvailableAddressesAsync(); - tokens = await zeroEx.tokenRegistry.getTokensAsync(); + contractWrappers = new ContractWrappers(provider, config); + userAddresses = await web3Wrapper.getAvailableAddressesAsync(); + tokens = await contractWrappers.tokenRegistry.getTokensAsync(); tokenUtils = new TokenUtils(tokens); coinbase = userAddresses[0]; addressWithoutFunds = userAddresses[1]; @@ -63,26 +61,26 @@ describe('TokenWrapper', () => { it('should successfully transfer tokens', async () => { const fromAddress = coinbase; const toAddress = addressWithoutFunds; - const preBalance = await zeroEx.token.getBalanceAsync(token.address, toAddress); + const preBalance = await contractWrappers.token.getBalanceAsync(token.address, toAddress); expect(preBalance).to.be.bignumber.equal(0); - await zeroEx.token.transferAsync(token.address, fromAddress, toAddress, transferAmount); - const postBalance = await zeroEx.token.getBalanceAsync(token.address, toAddress); + await contractWrappers.token.transferAsync(token.address, fromAddress, toAddress, transferAmount); + const postBalance = await contractWrappers.token.getBalanceAsync(token.address, toAddress); return expect(postBalance).to.be.bignumber.equal(transferAmount); }); it('should fail to transfer tokens if fromAddress has an insufficient balance', async () => { const fromAddress = addressWithoutFunds; const toAddress = coinbase; return expect( - zeroEx.token.transferAsync(token.address, fromAddress, toAddress, transferAmount), - ).to.be.rejectedWith(ZeroExError.InsufficientBalanceForTransfer); + contractWrappers.token.transferAsync(token.address, fromAddress, toAddress, transferAmount), + ).to.be.rejectedWith(ContractWrappersError.InsufficientBalanceForTransfer); }); it('should throw a CONTRACT_DOES_NOT_EXIST error for a non-existent token contract', async () => { const nonExistentTokenAddress = '0x9dd402f14d67e001d8efbe6583e51bf9706aa065'; const fromAddress = coinbase; const toAddress = coinbase; return expect( - zeroEx.token.transferAsync(nonExistentTokenAddress, fromAddress, toAddress, transferAmount), - ).to.be.rejectedWith(ZeroExError.TokenContractDoesNotExist); + contractWrappers.token.transferAsync(nonExistentTokenAddress, fromAddress, toAddress, transferAmount), + ).to.be.rejectedWith(ContractWrappersError.TokenContractDoesNotExist); }); }); describe('#transferFromAsync', () => { @@ -98,35 +96,51 @@ describe('TokenWrapper', () => { const fromAddress = coinbase; const transferAmount = new BigNumber(42); - const fromAddressBalance = await zeroEx.token.getBalanceAsync(token.address, fromAddress); + const fromAddressBalance = await contractWrappers.token.getBalanceAsync(token.address, fromAddress); expect(fromAddressBalance).to.be.bignumber.greaterThan(transferAmount); - const fromAddressAllowance = await zeroEx.token.getAllowanceAsync(token.address, fromAddress, toAddress); + const fromAddressAllowance = await contractWrappers.token.getAllowanceAsync( + token.address, + fromAddress, + toAddress, + ); expect(fromAddressAllowance).to.be.bignumber.equal(0); return expect( - zeroEx.token.transferFromAsync(token.address, fromAddress, toAddress, senderAddress, transferAmount), - ).to.be.rejectedWith(ZeroExError.InsufficientAllowanceForTransfer); + contractWrappers.token.transferFromAsync( + token.address, + fromAddress, + toAddress, + senderAddress, + transferAmount, + ), + ).to.be.rejectedWith(ContractWrappersError.InsufficientAllowanceForTransfer); }); it('[regression] should fail to transfer tokens if set allowance for toAddress instead of senderAddress', async () => { const fromAddress = coinbase; const transferAmount = new BigNumber(42); - await zeroEx.token.setAllowanceAsync(token.address, fromAddress, toAddress, transferAmount); + await contractWrappers.token.setAllowanceAsync(token.address, fromAddress, toAddress, transferAmount); return expect( - zeroEx.token.transferFromAsync(token.address, fromAddress, toAddress, senderAddress, transferAmount), - ).to.be.rejectedWith(ZeroExError.InsufficientAllowanceForTransfer); + contractWrappers.token.transferFromAsync( + token.address, + fromAddress, + toAddress, + senderAddress, + transferAmount, + ), + ).to.be.rejectedWith(ContractWrappersError.InsufficientAllowanceForTransfer); }); it('should fail to transfer tokens if fromAddress has insufficient balance', async () => { const fromAddress = addressWithoutFunds; const transferAmount = new BigNumber(42); - const fromAddressBalance = await zeroEx.token.getBalanceAsync(token.address, fromAddress); + const fromAddressBalance = await contractWrappers.token.getBalanceAsync(token.address, fromAddress); expect(fromAddressBalance).to.be.bignumber.equal(0); - await zeroEx.token.setAllowanceAsync(token.address, fromAddress, senderAddress, transferAmount); - const fromAddressAllowance = await zeroEx.token.getAllowanceAsync( + await contractWrappers.token.setAllowanceAsync(token.address, fromAddress, senderAddress, transferAmount); + const fromAddressAllowance = await contractWrappers.token.getAllowanceAsync( token.address, fromAddress, senderAddress, @@ -134,34 +148,46 @@ describe('TokenWrapper', () => { expect(fromAddressAllowance).to.be.bignumber.equal(transferAmount); return expect( - zeroEx.token.transferFromAsync(token.address, fromAddress, toAddress, senderAddress, transferAmount), - ).to.be.rejectedWith(ZeroExError.InsufficientBalanceForTransfer); + contractWrappers.token.transferFromAsync( + token.address, + fromAddress, + toAddress, + senderAddress, + transferAmount, + ), + ).to.be.rejectedWith(ContractWrappersError.InsufficientBalanceForTransfer); }); it('should successfully transfer tokens', async () => { const fromAddress = coinbase; - const preBalance = await zeroEx.token.getBalanceAsync(token.address, toAddress); + const preBalance = await contractWrappers.token.getBalanceAsync(token.address, toAddress); expect(preBalance).to.be.bignumber.equal(0); const transferAmount = new BigNumber(42); - await zeroEx.token.setAllowanceAsync(token.address, fromAddress, senderAddress, transferAmount); + await contractWrappers.token.setAllowanceAsync(token.address, fromAddress, senderAddress, transferAmount); - await zeroEx.token.transferFromAsync(token.address, fromAddress, toAddress, senderAddress, transferAmount); - const postBalance = await zeroEx.token.getBalanceAsync(token.address, toAddress); + await contractWrappers.token.transferFromAsync( + token.address, + fromAddress, + toAddress, + senderAddress, + transferAmount, + ); + const postBalance = await contractWrappers.token.getBalanceAsync(token.address, toAddress); return expect(postBalance).to.be.bignumber.equal(transferAmount); }); it('should throw a CONTRACT_DOES_NOT_EXIST error for a non-existent token contract', async () => { const fromAddress = coinbase; const nonExistentTokenAddress = '0x9dd402f14d67e001d8efbe6583e51bf9706aa065'; return expect( - zeroEx.token.transferFromAsync( + contractWrappers.token.transferFromAsync( nonExistentTokenAddress, fromAddress, toAddress, senderAddress, new BigNumber(42), ), - ).to.be.rejectedWith(ZeroExError.TokenContractDoesNotExist); + ).to.be.rejectedWith(ContractWrappersError.TokenContractDoesNotExist); }); }); describe('#getBalanceAsync', () => { @@ -169,36 +195,36 @@ describe('TokenWrapper', () => { it('should return the balance for an existing ERC20 token', async () => { const token = tokens[0]; const ownerAddress = coinbase; - const balance = await zeroEx.token.getBalanceAsync(token.address, ownerAddress); + const balance = await contractWrappers.token.getBalanceAsync(token.address, ownerAddress); const expectedBalance = new BigNumber('1000000000000000000000000000'); return expect(balance).to.be.bignumber.equal(expectedBalance); }); it('should throw a CONTRACT_DOES_NOT_EXIST error for a non-existent token contract', async () => { const nonExistentTokenAddress = '0x9dd402f14d67e001d8efbe6583e51bf9706aa065'; const ownerAddress = coinbase; - return expect(zeroEx.token.getBalanceAsync(nonExistentTokenAddress, ownerAddress)).to.be.rejectedWith( - ZeroExError.TokenContractDoesNotExist, - ); + return expect( + contractWrappers.token.getBalanceAsync(nonExistentTokenAddress, ownerAddress), + ).to.be.rejectedWith(ContractWrappersError.TokenContractDoesNotExist); }); it('should return a balance of 0 for a non-existent owner address', async () => { const token = tokens[0]; const nonExistentOwner = '0x198c6ad858f213fb31b6fe809e25040e6b964593'; - const balance = await zeroEx.token.getBalanceAsync(token.address, nonExistentOwner); + const balance = await contractWrappers.token.getBalanceAsync(token.address, nonExistentOwner); const expectedBalance = new BigNumber(0); return expect(balance).to.be.bignumber.equal(expectedBalance); }); }); describe('With provider without accounts', () => { - let zeroExWithoutAccounts: ZeroEx; + let zeroExContractWithoutAccounts: ContractWrappers; before(async () => { const hasAddresses = false; const emptyWalletProvider = addEmptyWalletSubprovider(provider); - zeroExWithoutAccounts = new ZeroEx(emptyWalletProvider, config); + zeroExContractWithoutAccounts = new ContractWrappers(emptyWalletProvider, config); }); it('should return balance even when called with provider instance without addresses', async () => { const token = tokens[0]; const ownerAddress = coinbase; - const balance = await zeroExWithoutAccounts.token.getBalanceAsync(token.address, ownerAddress); + const balance = await zeroExContractWithoutAccounts.token.getBalanceAsync(token.address, ownerAddress); const expectedBalance = new BigNumber('1000000000000000000000000000'); return expect(balance).to.be.bignumber.equal(expectedBalance); }); @@ -210,7 +236,7 @@ describe('TokenWrapper', () => { const ownerAddress = coinbase; const spenderAddress = addressWithoutFunds; - const allowanceBeforeSet = await zeroEx.token.getAllowanceAsync( + const allowanceBeforeSet = await contractWrappers.token.getAllowanceAsync( token.address, ownerAddress, spenderAddress, @@ -219,9 +245,18 @@ describe('TokenWrapper', () => { expect(allowanceBeforeSet).to.be.bignumber.equal(expectedAllowanceBeforeAllowanceSet); const amountInBaseUnits = new BigNumber(50); - await zeroEx.token.setAllowanceAsync(token.address, ownerAddress, spenderAddress, amountInBaseUnits); + await contractWrappers.token.setAllowanceAsync( + token.address, + ownerAddress, + spenderAddress, + amountInBaseUnits, + ); - const allowanceAfterSet = await zeroEx.token.getAllowanceAsync(token.address, ownerAddress, spenderAddress); + const allowanceAfterSet = await contractWrappers.token.getAllowanceAsync( + token.address, + ownerAddress, + spenderAddress, + ); const expectedAllowanceAfterAllowanceSet = amountInBaseUnits; return expect(allowanceAfterSet).to.be.bignumber.equal(expectedAllowanceAfterAllowanceSet); }); @@ -232,30 +267,39 @@ describe('TokenWrapper', () => { const ownerAddress = coinbase; const spenderAddress = addressWithoutFunds; - await zeroEx.token.setUnlimitedAllowanceAsync(token.address, ownerAddress, spenderAddress); - const allowance = await zeroEx.token.getAllowanceAsync(token.address, ownerAddress, spenderAddress); - return expect(allowance).to.be.bignumber.equal(zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS); + await contractWrappers.token.setUnlimitedAllowanceAsync(token.address, ownerAddress, spenderAddress); + const allowance = await contractWrappers.token.getAllowanceAsync( + token.address, + ownerAddress, + spenderAddress, + ); + return expect(allowance).to.be.bignumber.equal(contractWrappers.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS); }); it('should reduce the gas cost for transfers including tokens with unlimited allowance support', async () => { const transferAmount = new BigNumber(5); const zrx = tokenUtils.getProtocolTokenOrThrow(); const [, userWithNormalAllowance, userWithUnlimitedAllowance] = userAddresses; - await zeroEx.token.setAllowanceAsync(zrx.address, coinbase, userWithNormalAllowance, transferAmount); - await zeroEx.token.setUnlimitedAllowanceAsync(zrx.address, coinbase, userWithUnlimitedAllowance); + await contractWrappers.token.setAllowanceAsync( + zrx.address, + coinbase, + userWithNormalAllowance, + transferAmount, + ); + await contractWrappers.token.setUnlimitedAllowanceAsync(zrx.address, coinbase, userWithUnlimitedAllowance); const initBalanceWithNormalAllowance = await web3Wrapper.getBalanceInWeiAsync(userWithNormalAllowance); const initBalanceWithUnlimitedAllowance = await web3Wrapper.getBalanceInWeiAsync( userWithUnlimitedAllowance, ); - await zeroEx.token.transferFromAsync( + await contractWrappers.token.transferFromAsync( zrx.address, coinbase, userWithNormalAllowance, userWithNormalAllowance, transferAmount, ); - await zeroEx.token.transferFromAsync( + await contractWrappers.token.transferFromAsync( zrx.address, coinbase, userWithUnlimitedAllowance, @@ -285,9 +329,18 @@ describe('TokenWrapper', () => { const spenderAddress = addressWithoutFunds; const amountInBaseUnits = new BigNumber(50); - await zeroEx.token.setAllowanceAsync(token.address, ownerAddress, spenderAddress, amountInBaseUnits); + await contractWrappers.token.setAllowanceAsync( + token.address, + ownerAddress, + spenderAddress, + amountInBaseUnits, + ); - const allowance = await zeroEx.token.getAllowanceAsync(token.address, ownerAddress, spenderAddress); + const allowance = await contractWrappers.token.getAllowanceAsync( + token.address, + ownerAddress, + spenderAddress, + ); const expectedAllowance = amountInBaseUnits; return expect(allowance).to.be.bignumber.equal(expectedAllowance); }); @@ -295,17 +348,21 @@ describe('TokenWrapper', () => { const token = tokens[0]; const ownerAddress = coinbase; const spenderAddress = addressWithoutFunds; - const allowance = await zeroEx.token.getAllowanceAsync(token.address, ownerAddress, spenderAddress); + const allowance = await contractWrappers.token.getAllowanceAsync( + token.address, + ownerAddress, + spenderAddress, + ); const expectedAllowance = new BigNumber(0); return expect(allowance).to.be.bignumber.equal(expectedAllowance); }); }); describe('With provider without accounts', () => { - let zeroExWithoutAccounts: ZeroEx; + let zeroExContractWithoutAccounts: ContractWrappers; before(async () => { const hasAddresses = false; const emptyWalletProvider = addEmptyWalletSubprovider(provider); - zeroExWithoutAccounts = new ZeroEx(emptyWalletProvider, config); + zeroExContractWithoutAccounts = new ContractWrappers(emptyWalletProvider, config); }); it('should get the proxy allowance', async () => { const token = tokens[0]; @@ -313,9 +370,14 @@ describe('TokenWrapper', () => { const spenderAddress = addressWithoutFunds; const amountInBaseUnits = new BigNumber(50); - await zeroEx.token.setAllowanceAsync(token.address, ownerAddress, spenderAddress, amountInBaseUnits); + await contractWrappers.token.setAllowanceAsync( + token.address, + ownerAddress, + spenderAddress, + amountInBaseUnits, + ); - const allowance = await zeroExWithoutAccounts.token.getAllowanceAsync( + const allowance = await zeroExContractWithoutAccounts.token.getAllowanceAsync( token.address, ownerAddress, spenderAddress, @@ -331,9 +393,9 @@ describe('TokenWrapper', () => { const ownerAddress = coinbase; const amountInBaseUnits = new BigNumber(50); - await zeroEx.token.setProxyAllowanceAsync(token.address, ownerAddress, amountInBaseUnits); + await contractWrappers.token.setProxyAllowanceAsync(token.address, ownerAddress, amountInBaseUnits); - const allowance = await zeroEx.token.getProxyAllowanceAsync(token.address, ownerAddress); + const allowance = await contractWrappers.token.getProxyAllowanceAsync(token.address, ownerAddress); const expectedAllowance = amountInBaseUnits; return expect(allowance).to.be.bignumber.equal(expectedAllowance); }); @@ -343,14 +405,14 @@ describe('TokenWrapper', () => { const token = tokens[0]; const ownerAddress = coinbase; - const allowanceBeforeSet = await zeroEx.token.getProxyAllowanceAsync(token.address, ownerAddress); + const allowanceBeforeSet = await contractWrappers.token.getProxyAllowanceAsync(token.address, ownerAddress); const expectedAllowanceBeforeAllowanceSet = new BigNumber(0); expect(allowanceBeforeSet).to.be.bignumber.equal(expectedAllowanceBeforeAllowanceSet); const amountInBaseUnits = new BigNumber(50); - await zeroEx.token.setProxyAllowanceAsync(token.address, ownerAddress, amountInBaseUnits); + await contractWrappers.token.setProxyAllowanceAsync(token.address, ownerAddress, amountInBaseUnits); - const allowanceAfterSet = await zeroEx.token.getProxyAllowanceAsync(token.address, ownerAddress); + const allowanceAfterSet = await contractWrappers.token.getProxyAllowanceAsync(token.address, ownerAddress); const expectedAllowanceAfterAllowanceSet = amountInBaseUnits; return expect(allowanceAfterSet).to.be.bignumber.equal(expectedAllowanceAfterAllowanceSet); }); @@ -360,9 +422,9 @@ describe('TokenWrapper', () => { const token = tokens[0]; const ownerAddress = coinbase; - await zeroEx.token.setUnlimitedProxyAllowanceAsync(token.address, ownerAddress); - const allowance = await zeroEx.token.getProxyAllowanceAsync(token.address, ownerAddress); - return expect(allowance).to.be.bignumber.equal(zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS); + await contractWrappers.token.setUnlimitedProxyAllowanceAsync(token.address, ownerAddress); + const allowance = await contractWrappers.token.getProxyAllowanceAsync(token.address, ownerAddress); + return expect(allowance).to.be.bignumber.equal(contractWrappers.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS); }); }); describe('#subscribe', () => { @@ -375,7 +437,7 @@ describe('TokenWrapper', () => { tokenAddress = token.address; }); afterEach(() => { - zeroEx.token.unsubscribeAll(); + contractWrappers.token.unsubscribeAll(); }); // Hack: Mocha does not allow a test to be both async and have a `done` callback // Since we need to await the receipt of the event in the `subscribe` callback, @@ -384,7 +446,7 @@ describe('TokenWrapper', () => { // Source: https://github.com/mochajs/mocha/issues/2407 it('Should receive the Transfer event when tokens are transfered', (done: DoneCallback) => { (async () => { - const callback = reportNodeCallbackErrors(done)( + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)( (logEvent: DecodedLogEvent<TransferContractEventArgs>) => { expect(logEvent.isRemoved).to.be.false(); expect(logEvent.log.logIndex).to.be.equal(0); @@ -396,13 +458,13 @@ describe('TokenWrapper', () => { expect(args._value).to.be.bignumber.equal(transferAmount); }, ); - zeroEx.token.subscribe(tokenAddress, TokenEvents.Transfer, indexFilterValues, callback); - await zeroEx.token.transferAsync(tokenAddress, coinbase, addressWithoutFunds, transferAmount); + contractWrappers.token.subscribe(tokenAddress, TokenEvents.Transfer, indexFilterValues, callback); + await contractWrappers.token.transferAsync(tokenAddress, coinbase, addressWithoutFunds, transferAmount); })().catch(done); }); it('Should receive the Approval event when allowance is being set', (done: DoneCallback) => { (async () => { - const callback = reportNodeCallbackErrors(done)( + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)( (logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => { expect(logEvent).to.not.be.undefined(); expect(logEvent.isRemoved).to.be.false(); @@ -412,39 +474,54 @@ describe('TokenWrapper', () => { expect(args._value).to.be.bignumber.equal(allowanceAmount); }, ); - zeroEx.token.subscribe(tokenAddress, TokenEvents.Approval, indexFilterValues, callback); - await zeroEx.token.setAllowanceAsync(tokenAddress, coinbase, addressWithoutFunds, allowanceAmount); + contractWrappers.token.subscribe(tokenAddress, TokenEvents.Approval, indexFilterValues, callback); + await contractWrappers.token.setAllowanceAsync( + tokenAddress, + coinbase, + addressWithoutFunds, + allowanceAmount, + ); })().catch(done); }); - it('Outstanding subscriptions are cancelled when zeroEx.setProvider called', (done: DoneCallback) => { + it('Outstanding subscriptions are cancelled when contractWrappers.setProvider called', (done: DoneCallback) => { (async () => { - const callbackNeverToBeCalled = reportNodeCallbackErrors(done)( + const callbackNeverToBeCalled = callbackErrorReporter.reportNodeCallbackErrors(done)( (logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => { done(new Error('Expected this subscription to have been cancelled')); }, ); - zeroEx.token.subscribe(tokenAddress, TokenEvents.Transfer, indexFilterValues, callbackNeverToBeCalled); - const callbackToBeCalled = reportNodeCallbackErrors(done)(); - zeroEx.setProvider(provider, constants.TESTRPC_NETWORK_ID); - zeroEx.token.subscribe(tokenAddress, TokenEvents.Transfer, indexFilterValues, callbackToBeCalled); - await zeroEx.token.transferAsync(tokenAddress, coinbase, addressWithoutFunds, transferAmount); + contractWrappers.token.subscribe( + tokenAddress, + TokenEvents.Transfer, + indexFilterValues, + callbackNeverToBeCalled, + ); + const callbackToBeCalled = callbackErrorReporter.reportNodeCallbackErrors(done)(); + contractWrappers.setProvider(provider, constants.TESTRPC_NETWORK_ID); + contractWrappers.token.subscribe( + tokenAddress, + TokenEvents.Transfer, + indexFilterValues, + callbackToBeCalled, + ); + await contractWrappers.token.transferAsync(tokenAddress, coinbase, addressWithoutFunds, transferAmount); })().catch(done); }); it('Should cancel subscription when unsubscribe called', (done: DoneCallback) => { (async () => { - const callbackNeverToBeCalled = reportNodeCallbackErrors(done)( + const callbackNeverToBeCalled = callbackErrorReporter.reportNodeCallbackErrors(done)( (logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => { done(new Error('Expected this subscription to have been cancelled')); }, ); - const subscriptionToken = zeroEx.token.subscribe( + const subscriptionToken = contractWrappers.token.subscribe( tokenAddress, TokenEvents.Transfer, indexFilterValues, callbackNeverToBeCalled, ); - zeroEx.token.unsubscribe(subscriptionToken); - await zeroEx.token.transferAsync(tokenAddress, coinbase, addressWithoutFunds, transferAmount); + contractWrappers.token.unsubscribe(subscriptionToken); + await contractWrappers.token.transferAsync(tokenAddress, coinbase, addressWithoutFunds, transferAmount); done(); })().catch(done); }); @@ -460,14 +537,14 @@ describe('TokenWrapper', () => { before(() => { const token = tokens[0]; tokenAddress = token.address; - tokenTransferProxyAddress = zeroEx.proxy.getContractAddress(); + tokenTransferProxyAddress = contractWrappers.proxy.getContractAddress(); }); it('should get logs with decoded args emitted by Approval', async () => { - txHash = await zeroEx.token.setUnlimitedProxyAllowanceAsync(tokenAddress, coinbase); - await zeroEx.awaitTransactionMinedAsync(txHash); + txHash = await contractWrappers.token.setUnlimitedProxyAllowanceAsync(tokenAddress, coinbase); + await web3Wrapper.awaitTransactionMinedAsync(txHash); const eventName = TokenEvents.Approval; const indexFilterValues = {}; - const logs = await zeroEx.token.getLogsAsync<ApprovalContractEventArgs>( + const logs = await contractWrappers.token.getLogsAsync<ApprovalContractEventArgs>( tokenAddress, eventName, blockRange, @@ -478,14 +555,14 @@ describe('TokenWrapper', () => { expect(logs[0].event).to.be.equal(eventName); expect(args._owner).to.be.equal(coinbase); expect(args._spender).to.be.equal(tokenTransferProxyAddress); - expect(args._value).to.be.bignumber.equal(zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS); + expect(args._value).to.be.bignumber.equal(contractWrappers.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS); }); it('should only get the logs with the correct event name', async () => { - txHash = await zeroEx.token.setUnlimitedProxyAllowanceAsync(tokenAddress, coinbase); - await zeroEx.awaitTransactionMinedAsync(txHash); + txHash = await contractWrappers.token.setUnlimitedProxyAllowanceAsync(tokenAddress, coinbase); + await web3Wrapper.awaitTransactionMinedAsync(txHash); const differentEventName = TokenEvents.Transfer; const indexFilterValues = {}; - const logs = await zeroEx.token.getLogsAsync( + const logs = await contractWrappers.token.getLogsAsync( tokenAddress, differentEventName, blockRange, @@ -494,15 +571,15 @@ describe('TokenWrapper', () => { expect(logs).to.have.length(0); }); it('should only get the logs with the correct indexed fields', async () => { - txHash = await zeroEx.token.setUnlimitedProxyAllowanceAsync(tokenAddress, coinbase); - await zeroEx.awaitTransactionMinedAsync(txHash); - txHash = await zeroEx.token.setUnlimitedProxyAllowanceAsync(tokenAddress, addressWithoutFunds); - await zeroEx.awaitTransactionMinedAsync(txHash); + txHash = await contractWrappers.token.setUnlimitedProxyAllowanceAsync(tokenAddress, coinbase); + await web3Wrapper.awaitTransactionMinedAsync(txHash); + txHash = await contractWrappers.token.setUnlimitedProxyAllowanceAsync(tokenAddress, addressWithoutFunds); + await web3Wrapper.awaitTransactionMinedAsync(txHash); const eventName = TokenEvents.Approval; const indexFilterValues = { _owner: coinbase, }; - const logs = await zeroEx.token.getLogsAsync<ApprovalContractEventArgs>( + const logs = await contractWrappers.token.getLogsAsync<ApprovalContractEventArgs>( tokenAddress, eventName, blockRange, diff --git a/packages/contract-wrappers/test/utils/chai_setup.ts b/packages/contract-wrappers/test/utils/chai_setup.ts new file mode 100644 index 000000000..078edd309 --- /dev/null +++ b/packages/contract-wrappers/test/utils/chai_setup.ts @@ -0,0 +1,13 @@ +import * as chai from 'chai'; +import chaiAsPromised = require('chai-as-promised'); +import ChaiBigNumber = require('chai-bignumber'); +import * as dirtyChai from 'dirty-chai'; + +export const chaiSetup = { + configure() { + chai.config.includeStack = true; + chai.use(ChaiBigNumber()); + chai.use(dirtyChai); + chai.use(chaiAsPromised); + }, +}; diff --git a/packages/contract-wrappers/test/utils/constants.ts b/packages/contract-wrappers/test/utils/constants.ts new file mode 100644 index 000000000..cf030259c --- /dev/null +++ b/packages/contract-wrappers/test/utils/constants.ts @@ -0,0 +1,9 @@ +export const constants = { + NULL_ADDRESS: '0x0000000000000000000000000000000000000000', + ROPSTEN_NETWORK_ID: 3, + KOVAN_NETWORK_ID: 42, + TESTRPC_NETWORK_ID: 50, + KOVAN_RPC_URL: 'https://kovan.infura.io/', + ROPSTEN_RPC_URL: 'https://ropsten.infura.io/', + ZRX_DECIMALS: 18, +}; diff --git a/packages/contract-wrappers/test/utils/deployer.ts b/packages/contract-wrappers/test/utils/deployer.ts new file mode 100644 index 000000000..b092322e2 --- /dev/null +++ b/packages/contract-wrappers/test/utils/deployer.ts @@ -0,0 +1,18 @@ +import { Deployer } from '@0xproject/deployer'; +import { devConstants } from '@0xproject/dev-utils'; +import * as path from 'path'; + +import { constants } from './constants'; + +import { provider } from './web3_wrapper'; + +const artifactsDir = path.resolve('test', 'artifacts'); +const deployerOpts = { + artifactsDir, + provider, + networkId: constants.TESTRPC_NETWORK_ID, + defaults: { + gas: devConstants.GAS_ESTIMATE, + }, +}; +export const deployer = new Deployer(deployerOpts); diff --git a/packages/contract-wrappers/test/utils/token_utils.ts b/packages/contract-wrappers/test/utils/token_utils.ts new file mode 100644 index 000000000..fe85de085 --- /dev/null +++ b/packages/contract-wrappers/test/utils/token_utils.ts @@ -0,0 +1,33 @@ +import * as _ from 'lodash'; + +import { InternalContractWrappersError, Token } from '../../src/types'; + +const PROTOCOL_TOKEN_SYMBOL = 'ZRX'; +const WETH_TOKEN_SYMBOL = 'WETH'; + +export class TokenUtils { + private _tokens: Token[]; + constructor(tokens: Token[]) { + this._tokens = tokens; + } + public getProtocolTokenOrThrow(): Token { + const zrxToken = _.find(this._tokens, { symbol: PROTOCOL_TOKEN_SYMBOL }); + if (_.isUndefined(zrxToken)) { + throw new Error(InternalContractWrappersError.ZrxNotInTokenRegistry); + } + return zrxToken; + } + public getWethTokenOrThrow(): Token { + const wethToken = _.find(this._tokens, { symbol: WETH_TOKEN_SYMBOL }); + if (_.isUndefined(wethToken)) { + throw new Error(InternalContractWrappersError.WethNotInTokenRegistry); + } + return wethToken; + } + public getDummyTokens(): Token[] { + const dummyTokens = _.filter(this._tokens, token => { + return !_.includes([PROTOCOL_TOKEN_SYMBOL, WETH_TOKEN_SYMBOL], token.symbol); + }); + return dummyTokens; + } +} diff --git a/packages/contract-wrappers/test/utils/web3_wrapper.ts b/packages/contract-wrappers/test/utils/web3_wrapper.ts new file mode 100644 index 000000000..b0ccfa546 --- /dev/null +++ b/packages/contract-wrappers/test/utils/web3_wrapper.ts @@ -0,0 +1,9 @@ +import { devConstants, web3Factory } from '@0xproject/dev-utils'; +import { Provider } from '@0xproject/types'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; + +const web3 = web3Factory.create({ shouldUseInProcessGanache: true }); +const provider: Provider = web3.currentProvider; +const web3Wrapper = new Web3Wrapper(web3.currentProvider); + +export { provider, web3Wrapper }; diff --git a/packages/contract-wrappers/tsconfig.json b/packages/contract-wrappers/tsconfig.json new file mode 100644 index 000000000..e35816553 --- /dev/null +++ b/packages/contract-wrappers/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig", + "compilerOptions": { + "outDir": "lib" + }, + "include": ["./src/**/*", "./test/**/*"] +} diff --git a/packages/contract-wrappers/tslint.json b/packages/contract-wrappers/tslint.json new file mode 100644 index 000000000..ffaefe83a --- /dev/null +++ b/packages/contract-wrappers/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": ["@0xproject/tslint-config"] +} diff --git a/packages/contracts/test/ether_token.ts b/packages/contracts/test/ether_token.ts index 4023abad0..2123d60dd 100644 --- a/packages/contracts/test/ether_token.ts +++ b/packages/contracts/test/ether_token.ts @@ -1,4 +1,4 @@ -import { ZeroEx, ZeroExError } from '0x.js'; +import { ZeroEx, ContractWrappersError } from '0x.js'; import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils'; import { BigNumber, promisify } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; @@ -43,7 +43,7 @@ describe('EtherToken', () => { const ethToDeposit = initEthBalance.plus(1); return expect(zeroEx.etherToken.depositAsync(etherTokenAddress, ethToDeposit, account)).to.be.rejectedWith( - ZeroExError.InsufficientEthBalanceForDeposit, + ContractWrappersError.InsufficientEthBalanceForDeposit, ); }); @@ -72,7 +72,7 @@ describe('EtherToken', () => { return expect( zeroEx.etherToken.withdrawAsync(etherTokenAddress, ethTokensToWithdraw, account), - ).to.be.rejectedWith(ZeroExError.InsufficientWEthBalanceForWithdrawal); + ).to.be.rejectedWith(ContractWrappersError.InsufficientWEthBalanceForWithdrawal); }); it('should convert ether tokens to ether with sufficient balance', async () => { diff --git a/packages/contracts/test/multi_sig_with_time_lock.ts b/packages/contracts/test/multi_sig_with_time_lock.ts index b7604457f..0f1e3bd11 100644 --- a/packages/contracts/test/multi_sig_with_time_lock.ts +++ b/packages/contracts/test/multi_sig_with_time_lock.ts @@ -17,7 +17,7 @@ import { chaiSetup } from './utils/chai_setup'; import { deployer } from './utils/deployer'; import { provider, web3Wrapper } from './utils/web3_wrapper'; -const MULTI_SIG_ABI = artifacts.MultiSigWalletWithTimeLockArtifact.networks[constants.TESTRPC_NETWORK_ID].abi; +const MULTI_SIG_ABI = artifacts.MultiSigWalletWithTimeLock.networks[constants.TESTRPC_NETWORK_ID].abi; chaiSetup.configure(); const expect = chai.expect; const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); diff --git a/packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts b/packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts index 2f928ede2..006d7f3c6 100644 --- a/packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts +++ b/packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts @@ -17,9 +17,9 @@ import { ContractName, SubmissionContractEventArgs, TransactionDataParams } from import { chaiSetup } from './utils/chai_setup'; import { deployer } from './utils/deployer'; import { provider, web3Wrapper } from './utils/web3_wrapper'; -const PROXY_ABI = artifacts.TokenTransferProxyArtifact.networks[constants.TESTRPC_NETWORK_ID].abi; +const PROXY_ABI = artifacts.TokenTransferProxy.networks[constants.TESTRPC_NETWORK_ID].abi; const MUTISIG_WALLET_WITH_TIME_LOCK_EXCEPT_REMOVE_AUTHORIZED_ADDRESS_ABI = - artifacts.MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressArtifact.networks[constants.TESTRPC_NETWORK_ID] + artifacts.MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.networks[constants.TESTRPC_NETWORK_ID] .abi; chaiSetup.configure(); diff --git a/packages/contracts/test/tutorials/arbitrage.ts b/packages/contracts/test/tutorials/arbitrage.ts index ad83bbca3..2fbf850d0 100644 --- a/packages/contracts/test/tutorials/arbitrage.ts +++ b/packages/contracts/test/tutorials/arbitrage.ts @@ -1,5 +1,6 @@ import { ECSignature, SignedOrder, ZeroEx } from '0x.js'; import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils'; +import { ExchangeContractErrs } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; @@ -14,7 +15,7 @@ import { constants } from '../../util/constants'; import { crypto } from '../../util/crypto'; import { ExchangeWrapper } from '../../util/exchange_wrapper'; import { OrderFactory } from '../../util/order_factory'; -import { BalancesByOwner, ContractName, ExchangeContractErrs } from '../../util/types'; +import { BalancesByOwner, ContractName } from '../../util/types'; import { chaiSetup } from '../utils/chai_setup'; import { deployer } from '../utils/deployer'; import { provider, web3Wrapper } from '../utils/web3_wrapper'; diff --git a/packages/contracts/util/artifacts.ts b/packages/contracts/util/artifacts.ts index 7c375c1b7..f427c6d9a 100644 --- a/packages/contracts/util/artifacts.ts +++ b/packages/contracts/util/artifacts.ts @@ -1,25 +1,25 @@ -import * as DummyTokenArtifact from '../src/artifacts/DummyToken.json'; -import * as ExchangeArtifact from '../src/artifacts/Exchange.json'; -import * as MaliciousTokenArtifact from '../src/artifacts/MaliciousToken.json'; -import * as MultiSigWalletWithTimeLockArtifact from '../src/artifacts/MultiSigWalletWithTimeLock.json'; -import * as MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressArtifact from '../src/artifacts/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.json'; -import * as TokenArtifact from '../src/artifacts/Token.json'; -import * as TokenRegistryArtifact from '../src/artifacts/TokenRegistry.json'; -import * as TokenTransferProxyArtifact from '../src/artifacts/TokenTransferProxy.json'; -import * as EtherTokenArtifact from '../src/artifacts/WETH9.json'; -import * as ZRXArtifact from '../src/artifacts/ZRXToken.json'; +import * as DummyToken from '../src/artifacts/DummyToken.json'; +import * as Exchange from '../src/artifacts/Exchange.json'; +import * as MaliciousToken from '../src/artifacts/MaliciousToken.json'; +import * as MultiSigWalletWithTimeLock from '../src/artifacts/MultiSigWalletWithTimeLock.json'; +import * as MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress from '../src/artifacts/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.json'; +import * as Token from '../src/artifacts/Token.json'; +import * as TokenRegistry from '../src/artifacts/TokenRegistry.json'; +import * as TokenTransferProxy from '../src/artifacts/TokenTransferProxy.json'; +import * as EtherToken from '../src/artifacts/WETH9.json'; +import * as ZRX from '../src/artifacts/ZRXToken.json'; import { Artifact } from './types'; export const artifacts = { - ZRXArtifact: (ZRXArtifact as any) as Artifact, - DummyTokenArtifact: (DummyTokenArtifact as any) as Artifact, - TokenArtifact: (TokenArtifact as any) as Artifact, - ExchangeArtifact: (ExchangeArtifact as any) as Artifact, - EtherTokenArtifact: (EtherTokenArtifact as any) as Artifact, - TokenRegistryArtifact: (TokenRegistryArtifact as any) as Artifact, - MaliciousTokenArtifact: (MaliciousTokenArtifact as any) as Artifact, - TokenTransferProxyArtifact: (TokenTransferProxyArtifact as any) as Artifact, - MultiSigWalletWithTimeLockArtifact: (MultiSigWalletWithTimeLockArtifact as any) as Artifact, - MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressArtifact: (MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressArtifact as any) as Artifact, + ZRX: (ZRX as any) as Artifact, + DummyToken: (DummyToken as any) as Artifact, + Token: (Token as any) as Artifact, + Exchange: (Exchange as any) as Artifact, + EtherToken: (EtherToken as any) as Artifact, + TokenRegistry: (TokenRegistry as any) as Artifact, + MaliciousToken: (MaliciousToken as any) as Artifact, + TokenTransferProxy: (TokenTransferProxy as any) as Artifact, + MultiSigWalletWithTimeLock: (MultiSigWalletWithTimeLock as any) as Artifact, + MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress: (MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress as any) as Artifact, }; diff --git a/packages/deployer/test/compiler_test.ts b/packages/deployer/test/compiler_test.ts index b03ae7935..bec111ffa 100644 --- a/packages/deployer/test/compiler_test.ts +++ b/packages/deployer/test/compiler_test.ts @@ -1,9 +1,10 @@ +import { DoneCallback } from '@0xproject/types'; import * as chai from 'chai'; import 'mocha'; import { Compiler } from '../src/compiler'; import { fsWrapper } from '../src/utils/fs_wrapper'; -import { CompilerOptions, ContractArtifact, ContractNetworkData, DoneCallback } from '../src/utils/types'; +import { CompilerOptions, ContractArtifact, ContractNetworkData } from '../src/utils/types'; import { exchange_binary } from './fixtures/exchange_bin'; import { constants } from './util/constants'; diff --git a/packages/deployer/test/deployer_test.ts b/packages/deployer/test/deployer_test.ts index 238624220..d024b0c8c 100644 --- a/packages/deployer/test/deployer_test.ts +++ b/packages/deployer/test/deployer_test.ts @@ -1,10 +1,11 @@ +import { DoneCallback } from '@0xproject/types'; import * as chai from 'chai'; import 'mocha'; import { Compiler } from '../src/compiler'; import { Deployer } from '../src/deployer'; import { fsWrapper } from '../src/utils/fs_wrapper'; -import { CompilerOptions, ContractArtifact, ContractNetworkData, DoneCallback } from '../src/utils/types'; +import { CompilerOptions, ContractArtifact, ContractNetworkData } from '../src/utils/types'; import { constructor_args, exchange_binary } from './fixtures/exchange_bin'; import { constants } from './util/constants'; diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json index 9da323f48..97ba89e3e 100644 --- a/packages/dev-utils/CHANGELOG.json +++ b/packages/dev-utils/CHANGELOG.json @@ -1,5 +1,13 @@ [ { + "version": "0.4.2", + "changes": [ + { + "note": "Move callbackErrorReporter over from 0x.js" + } + ] + }, + { "timestamp": 1525477860, "version": "0.4.1", "changes": [ diff --git a/packages/dev-utils/src/callback_error_reporter.ts b/packages/dev-utils/src/callback_error_reporter.ts new file mode 100644 index 000000000..874343ccc --- /dev/null +++ b/packages/dev-utils/src/callback_error_reporter.ts @@ -0,0 +1,66 @@ +import * as chai from 'chai'; +import * as _ from 'lodash'; + +import { DoneCallback } from '@0xproject/types'; + +const expect = chai.expect; + +export const callbackErrorReporter = { + reportNoErrorCallbackErrors(done: DoneCallback, expectToBeCalledOnce = true) { + return <T>(f?: (value: T) => void) => { + const wrapped = (value: T) => { + if (_.isUndefined(f)) { + done(); + return; + } + try { + f(value); + if (expectToBeCalledOnce) { + done(); + } + } catch (err) { + done(err); + } + }; + return wrapped; + }; + }, + reportNodeCallbackErrors(done: DoneCallback, expectToBeCalledOnce = true) { + return <T>(f?: (value: T) => void) => { + const wrapped = (error: Error | null, value: T | undefined) => { + if (!_.isNull(error)) { + done(error); + } else { + if (_.isUndefined(f)) { + done(); + return; + } + try { + f(value as T); + if (expectToBeCalledOnce) { + done(); + } + } catch (err) { + done(err); + } + } + }; + return wrapped; + }; + }, + assertNodeCallbackError(done: DoneCallback, errMsg: string) { + const wrapped = <T>(error: Error | null, value: T | undefined) => { + if (_.isNull(error)) { + done(new Error('Expected callback to receive an error')); + } else { + try { + expect(error.message).to.be.equal(errMsg); + done(); + } catch (err) { + done(err); + } + } + }; + return wrapped; + }, +}; diff --git a/packages/dev-utils/src/index.ts b/packages/dev-utils/src/index.ts index 2ff2a2238..9124f3e28 100644 --- a/packages/dev-utils/src/index.ts +++ b/packages/dev-utils/src/index.ts @@ -3,3 +3,4 @@ export { web3Factory } from './web3_factory'; export { constants as devConstants } from './constants'; export { coverage } from './coverage'; export { env, EnvVars } from './env'; +export { callbackErrorReporter } from './callback_error_reporter'; diff --git a/packages/fill-scenarios/.npmignore b/packages/fill-scenarios/.npmignore new file mode 100644 index 000000000..24e65ad5b --- /dev/null +++ b/packages/fill-scenarios/.npmignore @@ -0,0 +1,6 @@ +.* +yarn-error.log +/scripts/ +/src/ +tsconfig.json +/lib/monorepo_scripts/ diff --git a/packages/fill-scenarios/CHANGELOG.json b/packages/fill-scenarios/CHANGELOG.json new file mode 100644 index 000000000..5f688ef88 --- /dev/null +++ b/packages/fill-scenarios/CHANGELOG.json @@ -0,0 +1,10 @@ +[ + { + "version": "0.0.1", + "changes": [ + { + "note": "Move FillScenarios out of 0x.js" + } + ] + } +] diff --git a/packages/fill-scenarios/README.md b/packages/fill-scenarios/README.md new file mode 100644 index 000000000..e4cec0695 --- /dev/null +++ b/packages/fill-scenarios/README.md @@ -0,0 +1,75 @@ +## @0xproject/fill-scenarios + +0x order fill scenario generator + +## Installation + +```bash +yarn add @0xproject/fill-scenarios +``` + +If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`: + +```json +"compilerOptions": { + "typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"], +} +``` + +## Contributing + +We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository. + +Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started. + +### Install dependencies + +If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them: + +```bash +yarn config set workspaces-experimental true +``` + +Then install dependencies + +```bash +yarn install +``` + +### Build + +If this is your **first** time building this package, you must first build **all** packages within the monorepo. This is because packages that depend on other packages located inside this monorepo are symlinked when run from **within** the monorepo. This allows you to make changes across multiple packages without first publishing dependent packages to NPM. To build all packages, run the following from the monorepo root directory: + +```bash +yarn lerna:rebuild +``` + +Or continuously rebuild on change: + +```bash +yarn dev +``` + +You can also build this specific package by running the following from within its directory: + +```bash +yarn build +``` + +or continuously rebuild on change: + +```bash +yarn build:watch +``` + +### Clean + +```bash +yarn clean +``` + +### Lint + +```bash +yarn lint +``` diff --git a/packages/fill-scenarios/package.json b/packages/fill-scenarios/package.json new file mode 100644 index 000000000..bb2bcef13 --- /dev/null +++ b/packages/fill-scenarios/package.json @@ -0,0 +1,48 @@ +{ + "name": "@0xproject/fill-scenarios", + "version": "0.0.1", + "description": "0x order fill scenario generator", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "scripts": { + "build:watch": "tsc -w", + "prebuild": "run-s clean generate_contract_wrappers", + "generate_contract_wrappers": "node ../abi-gen/lib/index.js --abis 'src/compact_artifacts/@(Exchange|Token|TokenTransferProxy|EtherToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/generated_contract_wrappers --backend ethers && prettier --write 'src/generated_contract_wrappers/**.ts'", + "build": "tsc && copyfiles -u 2 './src/compact_artifacts/**/*.json' ./lib/compact_artifacts && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "clean": "shx rm -rf lib scripts", + "lint": "tslint --project . 'src/**/*.ts'", + "manual:postpublish": "yarn build; node ./scripts/postpublish.js" + }, + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "https://github.com/0xProject/0x-monorepo.git" + }, + "bugs": { + "url": "https://github.com/0xProject/0x-monorepo/issues" + }, + "homepage": "https://github.com/0xProject/0x-monorepo/packages/fill-scenarios/README.md", + "devDependencies": { + "@0xproject/monorepo-scripts": "^0.1.19", + "@0xproject/tslint-config": "^0.4.17", + "@types/lodash": "4.14.104", + "copyfiles": "^1.2.0", + "npm-run-all": "^4.1.2", + "shx": "^0.2.2", + "tslint": "5.8.0", + "typescript": "2.7.1" + }, + "dependencies": { + "@0xproject/base-contract": "^0.3.1", + "@0xproject/order-utils": "^0.0.4", + "@0xproject/types": "^0.6.3", + "@0xproject/typescript-typings": "^0.3.1", + "@0xproject/utils": "^0.6.1", + "@0xproject/web3-wrapper": "^0.6.3", + "ethers": "^3.0.15", + "lodash": "^4.17.4" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/fill-scenarios/src/artifacts.ts b/packages/fill-scenarios/src/artifacts.ts new file mode 100644 index 000000000..aa60e2fc4 --- /dev/null +++ b/packages/fill-scenarios/src/artifacts.ts @@ -0,0 +1,13 @@ +import { Artifact } from '@0xproject/types'; + +import * as DummyToken from './compact_artifacts/DummyToken.json'; +import * as Exchange from './compact_artifacts/Exchange.json'; +import * as Token from './compact_artifacts/Token.json'; +import * as TokenTransferProxy from './compact_artifacts/TokenTransferProxy.json'; + +export const artifacts = { + DummyToken: (DummyToken as any) as Artifact, + Token: (Token as any) as Artifact, + TokenTransferProxy: (TokenTransferProxy as any) as Artifact, + Exchange: (Exchange as any) as Artifact, +}; diff --git a/packages/fill-scenarios/src/compact_artifacts/DummyToken.json b/packages/fill-scenarios/src/compact_artifacts/DummyToken.json new file mode 100644 index 000000000..f64a8cd3d --- /dev/null +++ b/packages/fill-scenarios/src/compact_artifacts/DummyToken.json @@ -0,0 +1,22 @@ +{ + "contract_name": "DummyToken", + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "_target", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "setBalance", + "outputs": [], + "payable": false, + "type": "function" + } + ] +} diff --git a/packages/fill-scenarios/src/compact_artifacts/EtherToken.json b/packages/fill-scenarios/src/compact_artifacts/EtherToken.json new file mode 100644 index 000000000..26cca57cd --- /dev/null +++ b/packages/fill-scenarios/src/compact_artifacts/EtherToken.json @@ -0,0 +1,287 @@ +{ + "contract_name": "EtherToken", + "abi": [ + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_spender", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "name": "", + "type": "uint8" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "deposit", + "outputs": [], + "payable": true, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "payable": true, + "type": "fallback" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_from", + "type": "address" + }, + { + "indexed": true, + "name": "_to", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "name": "_spender", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Withdrawal", + "type": "event" + } + ], + "networks": { + "1": { + "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" + }, + "3": { + "address": "0xc00fd9820cd2898cc4c054b7bf142de637ad129a" + }, + "4": { + "address": "0xc778417e063141139fce010982780140aa0cd5ab" + }, + "42": { + "address": "0x653e49e301e508a13237c0ddc98ae7d4cd2667a1" + }, + "50": { + "address": "0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c" + } + } +} diff --git a/packages/fill-scenarios/src/compact_artifacts/Exchange.json b/packages/fill-scenarios/src/compact_artifacts/Exchange.json new file mode 100644 index 000000000..af8db7360 --- /dev/null +++ b/packages/fill-scenarios/src/compact_artifacts/Exchange.json @@ -0,0 +1,610 @@ +{ + "contract_name": "Exchange", + "abi": [ + { + "constant": true, + "inputs": [ + { + "name": "numerator", + "type": "uint256" + }, + { + "name": "denominator", + "type": "uint256" + }, + { + "name": "target", + "type": "uint256" + } + ], + "name": "isRoundingError", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "name": "filled", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "name": "cancelled", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5][]" + }, + { + "name": "orderValues", + "type": "uint256[6][]" + }, + { + "name": "fillTakerTokenAmount", + "type": "uint256" + }, + { + "name": "shouldThrowOnInsufficientBalanceOrAllowance", + "type": "bool" + }, + { + "name": "v", + "type": "uint8[]" + }, + { + "name": "r", + "type": "bytes32[]" + }, + { + "name": "s", + "type": "bytes32[]" + } + ], + "name": "fillOrdersUpTo", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5]" + }, + { + "name": "orderValues", + "type": "uint256[6]" + }, + { + "name": "cancelTakerTokenAmount", + "type": "uint256" + } + ], + "name": "cancelOrder", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "ZRX_TOKEN_CONTRACT", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5][]" + }, + { + "name": "orderValues", + "type": "uint256[6][]" + }, + { + "name": "fillTakerTokenAmounts", + "type": "uint256[]" + }, + { + "name": "v", + "type": "uint8[]" + }, + { + "name": "r", + "type": "bytes32[]" + }, + { + "name": "s", + "type": "bytes32[]" + } + ], + "name": "batchFillOrKillOrders", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5]" + }, + { + "name": "orderValues", + "type": "uint256[6]" + }, + { + "name": "fillTakerTokenAmount", + "type": "uint256" + }, + { + "name": "v", + "type": "uint8" + }, + { + "name": "r", + "type": "bytes32" + }, + { + "name": "s", + "type": "bytes32" + } + ], + "name": "fillOrKillOrder", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "getUnavailableTakerTokenAmount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "signer", + "type": "address" + }, + { + "name": "hash", + "type": "bytes32" + }, + { + "name": "v", + "type": "uint8" + }, + { + "name": "r", + "type": "bytes32" + }, + { + "name": "s", + "type": "bytes32" + } + ], + "name": "isValidSignature", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "numerator", + "type": "uint256" + }, + { + "name": "denominator", + "type": "uint256" + }, + { + "name": "target", + "type": "uint256" + } + ], + "name": "getPartialAmount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "TOKEN_TRANSFER_PROXY_CONTRACT", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5][]" + }, + { + "name": "orderValues", + "type": "uint256[6][]" + }, + { + "name": "fillTakerTokenAmounts", + "type": "uint256[]" + }, + { + "name": "shouldThrowOnInsufficientBalanceOrAllowance", + "type": "bool" + }, + { + "name": "v", + "type": "uint8[]" + }, + { + "name": "r", + "type": "bytes32[]" + }, + { + "name": "s", + "type": "bytes32[]" + } + ], + "name": "batchFillOrders", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5][]" + }, + { + "name": "orderValues", + "type": "uint256[6][]" + }, + { + "name": "cancelTakerTokenAmounts", + "type": "uint256[]" + } + ], + "name": "batchCancelOrders", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5]" + }, + { + "name": "orderValues", + "type": "uint256[6]" + }, + { + "name": "fillTakerTokenAmount", + "type": "uint256" + }, + { + "name": "shouldThrowOnInsufficientBalanceOrAllowance", + "type": "bool" + }, + { + "name": "v", + "type": "uint8" + }, + { + "name": "r", + "type": "bytes32" + }, + { + "name": "s", + "type": "bytes32" + } + ], + "name": "fillOrder", + "outputs": [ + { + "name": "filledTakerTokenAmount", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5]" + }, + { + "name": "orderValues", + "type": "uint256[6]" + } + ], + "name": "getOrderHash", + "outputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "EXTERNAL_QUERY_GAS_LIMIT", + "outputs": [ + { + "name": "", + "type": "uint16" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "VERSION", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "type": "function" + }, + { + "inputs": [ + { + "name": "_zrxToken", + "type": "address" + }, + { + "name": "_tokenTransferProxy", + "type": "address" + } + ], + "payable": false, + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "maker", + "type": "address" + }, + { + "indexed": false, + "name": "taker", + "type": "address" + }, + { + "indexed": true, + "name": "feeRecipient", + "type": "address" + }, + { + "indexed": false, + "name": "makerToken", + "type": "address" + }, + { + "indexed": false, + "name": "takerToken", + "type": "address" + }, + { + "indexed": false, + "name": "filledMakerTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "name": "filledTakerTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "name": "paidMakerFee", + "type": "uint256" + }, + { + "indexed": false, + "name": "paidTakerFee", + "type": "uint256" + }, + { + "indexed": true, + "name": "tokens", + "type": "bytes32" + }, + { + "indexed": false, + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "LogFill", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "maker", + "type": "address" + }, + { + "indexed": true, + "name": "feeRecipient", + "type": "address" + }, + { + "indexed": false, + "name": "makerToken", + "type": "address" + }, + { + "indexed": false, + "name": "takerToken", + "type": "address" + }, + { + "indexed": false, + "name": "cancelledMakerTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "name": "cancelledTakerTokenAmount", + "type": "uint256" + }, + { + "indexed": true, + "name": "tokens", + "type": "bytes32" + }, + { + "indexed": false, + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "LogCancel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "errorId", + "type": "uint8" + }, + { + "indexed": true, + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "LogError", + "type": "event" + } + ], + "networks": { + "1": { + "address": "0x12459c951127e0c374ff9105dda097662a027093" + }, + "3": { + "address": "0x479cc461fecd078f766ecc58533d6f69580cf3ac" + }, + "4": { + "address": "0x1d16ef40fac01cec8adac2ac49427b9384192c05" + }, + "42": { + "address": "0x90fe2af704b34e0224bf2299c838e04d4dcf1364" + }, + "50": { + "address": "0x48bacb9266a570d521063ef5dd96e61686dbe788" + } + } +} diff --git a/packages/fill-scenarios/src/compact_artifacts/Token.json b/packages/fill-scenarios/src/compact_artifacts/Token.json new file mode 100644 index 000000000..3b5a86ae0 --- /dev/null +++ b/packages/fill-scenarios/src/compact_artifacts/Token.json @@ -0,0 +1,172 @@ +{ + "contract_name": "Token", + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "_spender", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "name": "success", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "name": "supply", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "success", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "balance", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "name": "success", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "name": "remaining", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_from", + "type": "address" + }, + { + "indexed": true, + "name": "_to", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "name": "_spender", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + } + ] +} diff --git a/packages/fill-scenarios/src/compact_artifacts/TokenRegistry.json b/packages/fill-scenarios/src/compact_artifacts/TokenRegistry.json new file mode 100644 index 000000000..0f583628c --- /dev/null +++ b/packages/fill-scenarios/src/compact_artifacts/TokenRegistry.json @@ -0,0 +1,547 @@ +{ + "contract_name": "TokenRegistry", + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_index", + "type": "uint256" + } + ], + "name": "removeToken", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_name", + "type": "string" + } + ], + "name": "getTokenAddressByName", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_symbol", + "type": "string" + } + ], + "name": "getTokenAddressBySymbol", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_swarmHash", + "type": "bytes" + } + ], + "name": "setTokenSwarmHash", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_token", + "type": "address" + } + ], + "name": "getTokenMetaData", + "outputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "uint8" + }, + { + "name": "", + "type": "bytes" + }, + { + "name": "", + "type": "bytes" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_name", + "type": "string" + }, + { + "name": "_symbol", + "type": "string" + }, + { + "name": "_decimals", + "type": "uint8" + }, + { + "name": "_ipfsHash", + "type": "bytes" + }, + { + "name": "_swarmHash", + "type": "bytes" + } + ], + "name": "addToken", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_name", + "type": "string" + } + ], + "name": "setTokenName", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "tokens", + "outputs": [ + { + "name": "token", + "type": "address" + }, + { + "name": "name", + "type": "string" + }, + { + "name": "symbol", + "type": "string" + }, + { + "name": "decimals", + "type": "uint8" + }, + { + "name": "ipfsHash", + "type": "bytes" + }, + { + "name": "swarmHash", + "type": "bytes" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "tokenAddresses", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_name", + "type": "string" + } + ], + "name": "getTokenByName", + "outputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "uint8" + }, + { + "name": "", + "type": "bytes" + }, + { + "name": "", + "type": "bytes" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getTokenAddresses", + "outputs": [ + { + "name": "", + "type": "address[]" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_ipfsHash", + "type": "bytes" + } + ], + "name": "setTokenIpfsHash", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_symbol", + "type": "string" + } + ], + "name": "getTokenBySymbol", + "outputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "uint8" + }, + { + "name": "", + "type": "bytes" + }, + { + "name": "", + "type": "bytes" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_symbol", + "type": "string" + } + ], + "name": "setTokenSymbol", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "name", + "type": "string" + }, + { + "indexed": false, + "name": "symbol", + "type": "string" + }, + { + "indexed": false, + "name": "decimals", + "type": "uint8" + }, + { + "indexed": false, + "name": "ipfsHash", + "type": "bytes" + }, + { + "indexed": false, + "name": "swarmHash", + "type": "bytes" + } + ], + "name": "LogAddToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "name", + "type": "string" + }, + { + "indexed": false, + "name": "symbol", + "type": "string" + }, + { + "indexed": false, + "name": "decimals", + "type": "uint8" + }, + { + "indexed": false, + "name": "ipfsHash", + "type": "bytes" + }, + { + "indexed": false, + "name": "swarmHash", + "type": "bytes" + } + ], + "name": "LogRemoveToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "oldName", + "type": "string" + }, + { + "indexed": false, + "name": "newName", + "type": "string" + } + ], + "name": "LogTokenNameChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "oldSymbol", + "type": "string" + }, + { + "indexed": false, + "name": "newSymbol", + "type": "string" + } + ], + "name": "LogTokenSymbolChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "oldIpfsHash", + "type": "bytes" + }, + { + "indexed": false, + "name": "newIpfsHash", + "type": "bytes" + } + ], + "name": "LogTokenIpfsHashChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "oldSwarmHash", + "type": "bytes" + }, + { + "indexed": false, + "name": "newSwarmHash", + "type": "bytes" + } + ], + "name": "LogTokenSwarmHashChange", + "type": "event" + } + ], + "networks": { + "1": { + "address": "0x926a74c5c36adf004c87399e65f75628b0f98d2c" + }, + "3": { + "address": "0x6b1a50f0bb5a7995444bd3877b22dc89c62843ed" + }, + "4": { + "address": "0x4e9aad8184de8833365fea970cd9149372fdf1e6" + }, + "42": { + "address": "0xf18e504561f4347bea557f3d4558f559dddbae7f" + }, + "50": { + "address": "0x0b1ba0af832d7c05fd64161e0db78e85978e8082" + } + } +} diff --git a/packages/fill-scenarios/src/compact_artifacts/TokenTransferProxy.json b/packages/fill-scenarios/src/compact_artifacts/TokenTransferProxy.json new file mode 100644 index 000000000..8cf551ddb --- /dev/null +++ b/packages/fill-scenarios/src/compact_artifacts/TokenTransferProxy.json @@ -0,0 +1,187 @@ +{ + "contract_name": "TokenTransferProxy", + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "token", + "type": "address" + }, + { + "name": "from", + "type": "address" + }, + { + "name": "to", + "type": "address" + }, + { + "name": "value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "target", + "type": "address" + } + ], + "name": "addAuthorizedAddress", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "authorities", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "target", + "type": "address" + } + ], + "name": "removeAuthorizedAddress", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "authorized", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getAuthorizedAddresses", + "outputs": [ + { + "name": "", + "type": "address[]" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "target", + "type": "address" + }, + { + "indexed": true, + "name": "caller", + "type": "address" + } + ], + "name": "LogAuthorizedAddressAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "target", + "type": "address" + }, + { + "indexed": true, + "name": "caller", + "type": "address" + } + ], + "name": "LogAuthorizedAddressRemoved", + "type": "event" + } + ], + "networks": { + "1": { + "address": "0x8da0d80f5007ef1e431dd2127178d224e32c2ef4" + }, + "3": { + "address": "0x4e9aad8184de8833365fea970cd9149372fdf1e6" + }, + "4": { + "address": "0xa8e9fa8f91e5ae138c74648c9c304f1c75003a8d" + }, + "42": { + "address": "0x087eed4bc1ee3de49befbd66c662b434b15d49d4" + }, + "50": { + "address": "0x1dc4c1cefef38a777b15aa20260a54e584b16c48" + } + } +} diff --git a/packages/fill-scenarios/src/compact_artifacts/ZRX.json b/packages/fill-scenarios/src/compact_artifacts/ZRX.json new file mode 100644 index 000000000..e40b8f268 --- /dev/null +++ b/packages/fill-scenarios/src/compact_artifacts/ZRX.json @@ -0,0 +1,20 @@ +{ + "contract_name": "ZRX", + "networks": { + "1": { + "address": "0xe41d2489571d322189246dafa5ebde1f4699f498" + }, + "3": { + "address": "0xa8e9fa8f91e5ae138c74648c9c304f1c75003a8d" + }, + "4": { + "address": "0x00f58d6d585f84b2d7267940cede30ce2fe6eae8" + }, + "42": { + "address": "0x6ff6c0ff1d68b964901f986d4c9fa3ac68346570" + }, + "50": { + "address": "0x1d7022f5b17d2f8b695918fb48fa1089c9f85401" + } + } +} diff --git a/packages/fill-scenarios/src/constants.ts b/packages/fill-scenarios/src/constants.ts new file mode 100644 index 000000000..0cd3d607a --- /dev/null +++ b/packages/fill-scenarios/src/constants.ts @@ -0,0 +1,4 @@ +export const constants = { + NULL_ADDRESS: '0x0000000000000000000000000000000000000000', + TEST_RPC_NETWORK_ID: 50, +}; diff --git a/packages/fill-scenarios/src/globals.d.ts b/packages/fill-scenarios/src/globals.d.ts new file mode 100644 index 000000000..94e63a32d --- /dev/null +++ b/packages/fill-scenarios/src/globals.d.ts @@ -0,0 +1,6 @@ +declare module '*.json' { + const json: any; + /* tslint:disable */ + export default json; + /* tslint:enable */ +} diff --git a/packages/0x.js/test/utils/fill_scenarios.ts b/packages/fill-scenarios/src/index.ts index 5a82a56d2..28b64208b 100644 --- a/packages/0x.js/test/utils/fill_scenarios.ts +++ b/packages/fill-scenarios/src/index.ts @@ -1,30 +1,34 @@ -import { orderFactory } from '@0xproject/order-utils'; +import { formatters, orderFactory } from '@0xproject/order-utils'; +import { Provider, SignedOrder, Token } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import * as _ from 'lodash'; -import { SignedOrder, Token, ZeroEx } from '../../src'; -import { artifacts } from '../../src/artifacts'; -import { DummyTokenContract } from '../../src/contract_wrappers/generated/dummy_token'; - +import { artifacts } from './artifacts'; import { constants } from './constants'; +import { DummyTokenContract } from './generated_contract_wrappers/dummy_token'; +import { ExchangeContract } from './generated_contract_wrappers/exchange'; +import { TokenContract } from './generated_contract_wrappers/token'; const INITIAL_COINBASE_TOKEN_SUPPLY_IN_UNITS = new BigNumber(100); export class FillScenarios { - private _zeroEx: ZeroEx; + private _provider: Provider; + private _web3Wrapper: Web3Wrapper; private _userAddresses: string[]; private _tokens: Token[]; private _coinbase: string; private _zrxTokenAddress: string; private _exchangeContractAddress: string; constructor( - zeroEx: ZeroEx, + provider: Provider, userAddresses: string[], tokens: Token[], zrxTokenAddress: string, exchangeContractAddress: string, ) { - this._zeroEx = zeroEx; + this._provider = provider; + this._web3Wrapper = new Web3Wrapper(this._provider); this._userAddresses = userAddresses; this._tokens = tokens; this._coinbase = userAddresses[0]; @@ -32,21 +36,23 @@ export class FillScenarios { this._exchangeContractAddress = exchangeContractAddress; } public async initTokenBalancesAsync() { - const web3Wrapper = (this._zeroEx as any)._web3Wrapper as Web3Wrapper; for (const token of this._tokens) { if (token.symbol !== 'ZRX' && token.symbol !== 'WETH') { const defaults = {}; const dummyToken = new DummyTokenContract( - artifacts.DummyTokenArtifact.abi, + artifacts.DummyToken.abi, token.address, - web3Wrapper.getProvider(), - web3Wrapper.getContractDefaults(), + this._provider, + this._web3Wrapper.getContractDefaults(), + ); + const tokenSupply = Web3Wrapper.toBaseUnitAmount( + INITIAL_COINBASE_TOKEN_SUPPLY_IN_UNITS, + token.decimals, ); - const tokenSupply = ZeroEx.toBaseUnitAmount(INITIAL_COINBASE_TOKEN_SUPPLY_IN_UNITS, token.decimals); const txHash = await dummyToken.setBalance.sendTransactionAsync(this._coinbase, tokenSupply, { from: this._coinbase, }); - await this._zeroEx.awaitTransactionMinedAsync(txHash); + await this._web3Wrapper.awaitTransactionMinedAsync(txHash); } } } @@ -134,11 +140,24 @@ export class FillScenarios { fillableAmount, ); const shouldThrowOnInsufficientBalanceOrAllowance = false; - await this._zeroEx.exchange.fillOrderAsync( - signedOrder, + const exchangeInstance = new ExchangeContract( + artifacts.Exchange.abi, + signedOrder.exchangeContractAddress, + this._provider, + this._web3Wrapper.getContractDefaults(), + ); + + const [orderAddresses, orderValues] = formatters.getOrderAddressesAndValues(signedOrder); + + await exchangeInstance.fillOrder.sendTransactionAsync( + orderAddresses, + orderValues, partialFillAmount, shouldThrowOnInsufficientBalanceOrAllowance, - takerAddress, + signedOrder.ecSignature.v, + signedOrder.ecSignature.r, + signedOrder.ecSignature.s, + { from: takerAddress }, ); return signedOrder; } @@ -164,7 +183,7 @@ export class FillScenarios { ]); const signedOrder = await orderFactory.createSignedOrderAsync( - this._zeroEx.getProvider(), + this._provider, makerAddress, takerAddress, makerFee, @@ -184,7 +203,7 @@ export class FillScenarios { address: string, amount: BigNumber, ): Promise<void> { - if (amount.isZero() || address === ZeroEx.NULL_ADDRESS) { + if (amount.isZero() || address === constants.NULL_ADDRESS) { return; // noop } await Promise.all([ @@ -193,11 +212,34 @@ export class FillScenarios { ]); } private async _increaseBalanceAsync(tokenAddress: string, address: string, amount: BigNumber): Promise<void> { - await this._zeroEx.token.transferAsync(tokenAddress, this._coinbase, address, amount); + const token = new TokenContract( + artifacts.Token.abi, + tokenAddress, + this._provider, + this._web3Wrapper.getContractDefaults(), + ); + await token.transfer.sendTransactionAsync(address, amount, { + from: this._coinbase, + }); } private async _increaseAllowanceAsync(tokenAddress: string, address: string, amount: BigNumber): Promise<void> { - const oldMakerAllowance = await this._zeroEx.token.getProxyAllowanceAsync(tokenAddress, address); + const tokenInstance = new TokenContract( + artifacts.Token.abi, + tokenAddress, + this._provider, + this._web3Wrapper.getContractDefaults(), + ); + const txData = {}; + const networkArtifactsIfExists = artifacts.TokenTransferProxy.networks[constants.TEST_RPC_NETWORK_ID]; + if (_.isUndefined(networkArtifactsIfExists)) { + throw new Error(`Did not find network artifacts for networkId: ${constants.TEST_RPC_NETWORK_ID}`); + } + const proxyAddress = networkArtifactsIfExists.address; + const oldMakerAllowance = await tokenInstance.allowance.callAsync(address, proxyAddress, txData); const newMakerAllowance = oldMakerAllowance.plus(amount); - await this._zeroEx.token.setProxyAllowanceAsync(tokenAddress, address, newMakerAllowance); + + await tokenInstance.approve.sendTransactionAsync(proxyAddress, newMakerAllowance, { + from: address, + }); } } diff --git a/packages/fill-scenarios/src/monorepo_scripts/postpublish.ts b/packages/fill-scenarios/src/monorepo_scripts/postpublish.ts new file mode 100644 index 000000000..dcb99d0f7 --- /dev/null +++ b/packages/fill-scenarios/src/monorepo_scripts/postpublish.ts @@ -0,0 +1,8 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; + +import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; + +const cwd = `${__dirname}/..`; +// tslint:disable-next-line:no-floating-promises +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/fill-scenarios/tsconfig.json b/packages/fill-scenarios/tsconfig.json new file mode 100644 index 000000000..f5f4b37c2 --- /dev/null +++ b/packages/fill-scenarios/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig", + "compilerOptions": { + "outDir": "lib" + }, + "include": ["src/**/*"] +} diff --git a/packages/fill-scenarios/tslint.json b/packages/fill-scenarios/tslint.json new file mode 100644 index 000000000..ffaefe83a --- /dev/null +++ b/packages/fill-scenarios/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": ["@0xproject/tslint-config"] +} diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json index 44f919bc2..9399379fa 100644 --- a/packages/order-utils/CHANGELOG.json +++ b/packages/order-utils/CHANGELOG.json @@ -1,5 +1,17 @@ [ { + "version": "0.0.5", + "changes": [ + { + "note": "Add formatters package for converting signedOrder to orderAddresses & orderValues", + "note": "Add RemainingFillableCalculator to calculate the remaining fillable amount of an order", + "note": "Add AbstractBalanceAndProxyAllowanceFetcher and AbstractOrderFilledCancelledFetcher", + "note": + "Add orderStateUtils, a module for computing order state needed to decide if an order is still valid" + } + ] + }, + { "timestamp": 1525477860, "version": "0.0.4", "changes": [ diff --git a/packages/0x.js/src/abstract/balance_and_proxy_allowance_fetcher.ts b/packages/order-utils/src/abstract/abstract_balance_and_proxy_allowance_fetcher.ts index c357f8447..857c6167f 100644 --- a/packages/0x.js/src/abstract/balance_and_proxy_allowance_fetcher.ts +++ b/packages/order-utils/src/abstract/abstract_balance_and_proxy_allowance_fetcher.ts @@ -1,6 +1,6 @@ import { BigNumber } from '@0xproject/utils'; -export abstract class BalanceAndProxyAllowanceFetcher { +export abstract class AbstractBalanceAndProxyAllowanceFetcher { public abstract async getBalanceAsync(tokenAddress: string, userAddress: string): Promise<BigNumber>; public abstract async getProxyAllowanceAsync(tokenAddress: string, userAddress: string): Promise<BigNumber>; } diff --git a/packages/0x.js/src/abstract/order_filled_cancelled_fetcher.ts b/packages/order-utils/src/abstract/abstract_order_filled_cancelled_fetcher.ts index 81ae04b9c..f54bed6f1 100644 --- a/packages/0x.js/src/abstract/order_filled_cancelled_fetcher.ts +++ b/packages/order-utils/src/abstract/abstract_order_filled_cancelled_fetcher.ts @@ -1,6 +1,8 @@ import { BigNumber } from '@0xproject/utils'; -export abstract class OrderFilledCancelledFetcher { +export abstract class AbstractOrderFilledCancelledFetcher { public abstract async getFilledTakerAmountAsync(orderHash: string): Promise<BigNumber>; public abstract async getCancelledTakerAmountAsync(orderHash: string): Promise<BigNumber>; + public abstract async getUnavailableTakerAmountAsync(orderHash: string): Promise<BigNumber>; + public abstract getZRXTokenAddress(): string; } diff --git a/packages/order-utils/src/compact_artifacts/DummyToken.json b/packages/order-utils/src/compact_artifacts/DummyToken.json new file mode 100644 index 000000000..f64a8cd3d --- /dev/null +++ b/packages/order-utils/src/compact_artifacts/DummyToken.json @@ -0,0 +1,22 @@ +{ + "contract_name": "DummyToken", + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "_target", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "setBalance", + "outputs": [], + "payable": false, + "type": "function" + } + ] +} diff --git a/packages/order-utils/src/compact_artifacts/EtherToken.json b/packages/order-utils/src/compact_artifacts/EtherToken.json new file mode 100644 index 000000000..26cca57cd --- /dev/null +++ b/packages/order-utils/src/compact_artifacts/EtherToken.json @@ -0,0 +1,287 @@ +{ + "contract_name": "EtherToken", + "abi": [ + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_spender", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "name": "", + "type": "uint8" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "deposit", + "outputs": [], + "payable": true, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "payable": true, + "type": "fallback" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_from", + "type": "address" + }, + { + "indexed": true, + "name": "_to", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "name": "_spender", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Withdrawal", + "type": "event" + } + ], + "networks": { + "1": { + "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" + }, + "3": { + "address": "0xc00fd9820cd2898cc4c054b7bf142de637ad129a" + }, + "4": { + "address": "0xc778417e063141139fce010982780140aa0cd5ab" + }, + "42": { + "address": "0x653e49e301e508a13237c0ddc98ae7d4cd2667a1" + }, + "50": { + "address": "0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c" + } + } +} diff --git a/packages/order-utils/src/compact_artifacts/Exchange.json b/packages/order-utils/src/compact_artifacts/Exchange.json new file mode 100644 index 000000000..af8db7360 --- /dev/null +++ b/packages/order-utils/src/compact_artifacts/Exchange.json @@ -0,0 +1,610 @@ +{ + "contract_name": "Exchange", + "abi": [ + { + "constant": true, + "inputs": [ + { + "name": "numerator", + "type": "uint256" + }, + { + "name": "denominator", + "type": "uint256" + }, + { + "name": "target", + "type": "uint256" + } + ], + "name": "isRoundingError", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "name": "filled", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "name": "cancelled", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5][]" + }, + { + "name": "orderValues", + "type": "uint256[6][]" + }, + { + "name": "fillTakerTokenAmount", + "type": "uint256" + }, + { + "name": "shouldThrowOnInsufficientBalanceOrAllowance", + "type": "bool" + }, + { + "name": "v", + "type": "uint8[]" + }, + { + "name": "r", + "type": "bytes32[]" + }, + { + "name": "s", + "type": "bytes32[]" + } + ], + "name": "fillOrdersUpTo", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5]" + }, + { + "name": "orderValues", + "type": "uint256[6]" + }, + { + "name": "cancelTakerTokenAmount", + "type": "uint256" + } + ], + "name": "cancelOrder", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "ZRX_TOKEN_CONTRACT", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5][]" + }, + { + "name": "orderValues", + "type": "uint256[6][]" + }, + { + "name": "fillTakerTokenAmounts", + "type": "uint256[]" + }, + { + "name": "v", + "type": "uint8[]" + }, + { + "name": "r", + "type": "bytes32[]" + }, + { + "name": "s", + "type": "bytes32[]" + } + ], + "name": "batchFillOrKillOrders", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5]" + }, + { + "name": "orderValues", + "type": "uint256[6]" + }, + { + "name": "fillTakerTokenAmount", + "type": "uint256" + }, + { + "name": "v", + "type": "uint8" + }, + { + "name": "r", + "type": "bytes32" + }, + { + "name": "s", + "type": "bytes32" + } + ], + "name": "fillOrKillOrder", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "getUnavailableTakerTokenAmount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "signer", + "type": "address" + }, + { + "name": "hash", + "type": "bytes32" + }, + { + "name": "v", + "type": "uint8" + }, + { + "name": "r", + "type": "bytes32" + }, + { + "name": "s", + "type": "bytes32" + } + ], + "name": "isValidSignature", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "numerator", + "type": "uint256" + }, + { + "name": "denominator", + "type": "uint256" + }, + { + "name": "target", + "type": "uint256" + } + ], + "name": "getPartialAmount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "TOKEN_TRANSFER_PROXY_CONTRACT", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5][]" + }, + { + "name": "orderValues", + "type": "uint256[6][]" + }, + { + "name": "fillTakerTokenAmounts", + "type": "uint256[]" + }, + { + "name": "shouldThrowOnInsufficientBalanceOrAllowance", + "type": "bool" + }, + { + "name": "v", + "type": "uint8[]" + }, + { + "name": "r", + "type": "bytes32[]" + }, + { + "name": "s", + "type": "bytes32[]" + } + ], + "name": "batchFillOrders", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5][]" + }, + { + "name": "orderValues", + "type": "uint256[6][]" + }, + { + "name": "cancelTakerTokenAmounts", + "type": "uint256[]" + } + ], + "name": "batchCancelOrders", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5]" + }, + { + "name": "orderValues", + "type": "uint256[6]" + }, + { + "name": "fillTakerTokenAmount", + "type": "uint256" + }, + { + "name": "shouldThrowOnInsufficientBalanceOrAllowance", + "type": "bool" + }, + { + "name": "v", + "type": "uint8" + }, + { + "name": "r", + "type": "bytes32" + }, + { + "name": "s", + "type": "bytes32" + } + ], + "name": "fillOrder", + "outputs": [ + { + "name": "filledTakerTokenAmount", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5]" + }, + { + "name": "orderValues", + "type": "uint256[6]" + } + ], + "name": "getOrderHash", + "outputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "EXTERNAL_QUERY_GAS_LIMIT", + "outputs": [ + { + "name": "", + "type": "uint16" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "VERSION", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "type": "function" + }, + { + "inputs": [ + { + "name": "_zrxToken", + "type": "address" + }, + { + "name": "_tokenTransferProxy", + "type": "address" + } + ], + "payable": false, + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "maker", + "type": "address" + }, + { + "indexed": false, + "name": "taker", + "type": "address" + }, + { + "indexed": true, + "name": "feeRecipient", + "type": "address" + }, + { + "indexed": false, + "name": "makerToken", + "type": "address" + }, + { + "indexed": false, + "name": "takerToken", + "type": "address" + }, + { + "indexed": false, + "name": "filledMakerTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "name": "filledTakerTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "name": "paidMakerFee", + "type": "uint256" + }, + { + "indexed": false, + "name": "paidTakerFee", + "type": "uint256" + }, + { + "indexed": true, + "name": "tokens", + "type": "bytes32" + }, + { + "indexed": false, + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "LogFill", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "maker", + "type": "address" + }, + { + "indexed": true, + "name": "feeRecipient", + "type": "address" + }, + { + "indexed": false, + "name": "makerToken", + "type": "address" + }, + { + "indexed": false, + "name": "takerToken", + "type": "address" + }, + { + "indexed": false, + "name": "cancelledMakerTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "name": "cancelledTakerTokenAmount", + "type": "uint256" + }, + { + "indexed": true, + "name": "tokens", + "type": "bytes32" + }, + { + "indexed": false, + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "LogCancel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "errorId", + "type": "uint8" + }, + { + "indexed": true, + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "LogError", + "type": "event" + } + ], + "networks": { + "1": { + "address": "0x12459c951127e0c374ff9105dda097662a027093" + }, + "3": { + "address": "0x479cc461fecd078f766ecc58533d6f69580cf3ac" + }, + "4": { + "address": "0x1d16ef40fac01cec8adac2ac49427b9384192c05" + }, + "42": { + "address": "0x90fe2af704b34e0224bf2299c838e04d4dcf1364" + }, + "50": { + "address": "0x48bacb9266a570d521063ef5dd96e61686dbe788" + } + } +} diff --git a/packages/order-utils/src/compact_artifacts/Token.json b/packages/order-utils/src/compact_artifacts/Token.json new file mode 100644 index 000000000..3b5a86ae0 --- /dev/null +++ b/packages/order-utils/src/compact_artifacts/Token.json @@ -0,0 +1,172 @@ +{ + "contract_name": "Token", + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "_spender", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "name": "success", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "name": "supply", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "success", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "balance", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "name": "success", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "name": "remaining", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_from", + "type": "address" + }, + { + "indexed": true, + "name": "_to", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "name": "_spender", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + } + ] +} diff --git a/packages/order-utils/src/compact_artifacts/TokenRegistry.json b/packages/order-utils/src/compact_artifacts/TokenRegistry.json new file mode 100644 index 000000000..0f583628c --- /dev/null +++ b/packages/order-utils/src/compact_artifacts/TokenRegistry.json @@ -0,0 +1,547 @@ +{ + "contract_name": "TokenRegistry", + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_index", + "type": "uint256" + } + ], + "name": "removeToken", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_name", + "type": "string" + } + ], + "name": "getTokenAddressByName", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_symbol", + "type": "string" + } + ], + "name": "getTokenAddressBySymbol", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_swarmHash", + "type": "bytes" + } + ], + "name": "setTokenSwarmHash", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_token", + "type": "address" + } + ], + "name": "getTokenMetaData", + "outputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "uint8" + }, + { + "name": "", + "type": "bytes" + }, + { + "name": "", + "type": "bytes" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_name", + "type": "string" + }, + { + "name": "_symbol", + "type": "string" + }, + { + "name": "_decimals", + "type": "uint8" + }, + { + "name": "_ipfsHash", + "type": "bytes" + }, + { + "name": "_swarmHash", + "type": "bytes" + } + ], + "name": "addToken", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_name", + "type": "string" + } + ], + "name": "setTokenName", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "tokens", + "outputs": [ + { + "name": "token", + "type": "address" + }, + { + "name": "name", + "type": "string" + }, + { + "name": "symbol", + "type": "string" + }, + { + "name": "decimals", + "type": "uint8" + }, + { + "name": "ipfsHash", + "type": "bytes" + }, + { + "name": "swarmHash", + "type": "bytes" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "tokenAddresses", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_name", + "type": "string" + } + ], + "name": "getTokenByName", + "outputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "uint8" + }, + { + "name": "", + "type": "bytes" + }, + { + "name": "", + "type": "bytes" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getTokenAddresses", + "outputs": [ + { + "name": "", + "type": "address[]" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_ipfsHash", + "type": "bytes" + } + ], + "name": "setTokenIpfsHash", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_symbol", + "type": "string" + } + ], + "name": "getTokenBySymbol", + "outputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "uint8" + }, + { + "name": "", + "type": "bytes" + }, + { + "name": "", + "type": "bytes" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_symbol", + "type": "string" + } + ], + "name": "setTokenSymbol", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "name", + "type": "string" + }, + { + "indexed": false, + "name": "symbol", + "type": "string" + }, + { + "indexed": false, + "name": "decimals", + "type": "uint8" + }, + { + "indexed": false, + "name": "ipfsHash", + "type": "bytes" + }, + { + "indexed": false, + "name": "swarmHash", + "type": "bytes" + } + ], + "name": "LogAddToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "name", + "type": "string" + }, + { + "indexed": false, + "name": "symbol", + "type": "string" + }, + { + "indexed": false, + "name": "decimals", + "type": "uint8" + }, + { + "indexed": false, + "name": "ipfsHash", + "type": "bytes" + }, + { + "indexed": false, + "name": "swarmHash", + "type": "bytes" + } + ], + "name": "LogRemoveToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "oldName", + "type": "string" + }, + { + "indexed": false, + "name": "newName", + "type": "string" + } + ], + "name": "LogTokenNameChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "oldSymbol", + "type": "string" + }, + { + "indexed": false, + "name": "newSymbol", + "type": "string" + } + ], + "name": "LogTokenSymbolChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "oldIpfsHash", + "type": "bytes" + }, + { + "indexed": false, + "name": "newIpfsHash", + "type": "bytes" + } + ], + "name": "LogTokenIpfsHashChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "oldSwarmHash", + "type": "bytes" + }, + { + "indexed": false, + "name": "newSwarmHash", + "type": "bytes" + } + ], + "name": "LogTokenSwarmHashChange", + "type": "event" + } + ], + "networks": { + "1": { + "address": "0x926a74c5c36adf004c87399e65f75628b0f98d2c" + }, + "3": { + "address": "0x6b1a50f0bb5a7995444bd3877b22dc89c62843ed" + }, + "4": { + "address": "0x4e9aad8184de8833365fea970cd9149372fdf1e6" + }, + "42": { + "address": "0xf18e504561f4347bea557f3d4558f559dddbae7f" + }, + "50": { + "address": "0x0b1ba0af832d7c05fd64161e0db78e85978e8082" + } + } +} diff --git a/packages/order-utils/src/compact_artifacts/TokenTransferProxy.json b/packages/order-utils/src/compact_artifacts/TokenTransferProxy.json new file mode 100644 index 000000000..8cf551ddb --- /dev/null +++ b/packages/order-utils/src/compact_artifacts/TokenTransferProxy.json @@ -0,0 +1,187 @@ +{ + "contract_name": "TokenTransferProxy", + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "token", + "type": "address" + }, + { + "name": "from", + "type": "address" + }, + { + "name": "to", + "type": "address" + }, + { + "name": "value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "target", + "type": "address" + } + ], + "name": "addAuthorizedAddress", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "authorities", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "target", + "type": "address" + } + ], + "name": "removeAuthorizedAddress", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "authorized", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getAuthorizedAddresses", + "outputs": [ + { + "name": "", + "type": "address[]" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "target", + "type": "address" + }, + { + "indexed": true, + "name": "caller", + "type": "address" + } + ], + "name": "LogAuthorizedAddressAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "target", + "type": "address" + }, + { + "indexed": true, + "name": "caller", + "type": "address" + } + ], + "name": "LogAuthorizedAddressRemoved", + "type": "event" + } + ], + "networks": { + "1": { + "address": "0x8da0d80f5007ef1e431dd2127178d224e32c2ef4" + }, + "3": { + "address": "0x4e9aad8184de8833365fea970cd9149372fdf1e6" + }, + "4": { + "address": "0xa8e9fa8f91e5ae138c74648c9c304f1c75003a8d" + }, + "42": { + "address": "0x087eed4bc1ee3de49befbd66c662b434b15d49d4" + }, + "50": { + "address": "0x1dc4c1cefef38a777b15aa20260a54e584b16c48" + } + } +} diff --git a/packages/order-utils/src/compact_artifacts/ZRX.json b/packages/order-utils/src/compact_artifacts/ZRX.json new file mode 100644 index 000000000..e40b8f268 --- /dev/null +++ b/packages/order-utils/src/compact_artifacts/ZRX.json @@ -0,0 +1,20 @@ +{ + "contract_name": "ZRX", + "networks": { + "1": { + "address": "0xe41d2489571d322189246dafa5ebde1f4699f498" + }, + "3": { + "address": "0xa8e9fa8f91e5ae138c74648c9c304f1c75003a8d" + }, + "4": { + "address": "0x00f58d6d585f84b2d7267940cede30ce2fe6eae8" + }, + "42": { + "address": "0x6ff6c0ff1d68b964901f986d4c9fa3ac68346570" + }, + "50": { + "address": "0x1d7022f5b17d2f8b695918fb48fa1089c9f85401" + } + } +} diff --git a/packages/order-utils/src/formatters.ts b/packages/order-utils/src/formatters.ts new file mode 100644 index 000000000..2b6f4ddb7 --- /dev/null +++ b/packages/order-utils/src/formatters.ts @@ -0,0 +1,23 @@ +import { Order, OrderAddresses, OrderValues } from '@0xproject/types'; +import { BigNumber } from '@0xproject/utils'; + +export const formatters = { + getOrderAddressesAndValues(order: Order): [OrderAddresses, OrderValues] { + const orderAddresses: OrderAddresses = [ + order.maker, + order.taker, + order.makerTokenAddress, + order.takerTokenAddress, + order.feeRecipient, + ]; + const orderValues: OrderValues = [ + order.makerTokenAmount, + order.takerTokenAmount, + order.makerFee, + order.takerFee, + order.expirationUnixTimestampSec, + order.salt, + ]; + return [orderAddresses, orderValues]; + }, +}; diff --git a/packages/order-utils/src/index.ts b/packages/order-utils/src/index.ts index b85432c84..e9cea95ed 100644 --- a/packages/order-utils/src/index.ts +++ b/packages/order-utils/src/index.ts @@ -4,3 +4,8 @@ export { orderFactory } from './order_factory'; export { constants } from './constants'; export { generatePseudoRandomSalt } from './salt'; export { OrderError } from './types'; +export { formatters } from './formatters'; +export { AbstractBalanceAndProxyAllowanceFetcher } from './abstract/abstract_balance_and_proxy_allowance_fetcher'; +export { AbstractOrderFilledCancelledFetcher } from './abstract/abstract_order_filled_cancelled_fetcher'; +export { RemainingFillableCalculator } from './remaining_fillable_calculator'; +export { OrderStateUtils } from './order_state_utils'; diff --git a/packages/0x.js/src/utils/order_state_utils.ts b/packages/order-utils/src/order_state_utils.ts index b0310d8a8..36171f526 100644 --- a/packages/0x.js/src/utils/order_state_utils.ts +++ b/packages/order-utils/src/order_state_utils.ts @@ -1,19 +1,24 @@ -import { SignedOrder } from '@0xproject/types'; +import { + ExchangeContractErrs, + OrderRelevantState, + OrderState, + OrderStateInvalid, + OrderStateValid, + SignedOrder, +} from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; -import { ZeroEx } from '../0x'; -import { BalanceAndProxyAllowanceFetcher } from '../abstract/balance_and_proxy_allowance_fetcher'; -import { OrderFilledCancelledFetcher } from '../abstract/order_filled_cancelled_fetcher'; -import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper'; -import { RemainingFillableCalculator } from '../order_watcher/remaining_fillable_calculator'; -import { ExchangeContractErrs, OrderRelevantState, OrderState, OrderStateInvalid, OrderStateValid } from '../types'; +import { AbstractBalanceAndProxyAllowanceFetcher } from './abstract/abstract_balance_and_proxy_allowance_fetcher'; +import { AbstractOrderFilledCancelledFetcher } from './abstract/abstract_order_filled_cancelled_fetcher'; +import { getOrderHashHex } from './order_hash'; +import { RemainingFillableCalculator } from './remaining_fillable_calculator'; const ACCEPTABLE_RELATIVE_ROUNDING_ERROR = 0.0001; export class OrderStateUtils { - private _balanceAndProxyAllowanceFetcher: BalanceAndProxyAllowanceFetcher; - private _orderFilledCancelledFetcher: OrderFilledCancelledFetcher; + private _balanceAndProxyAllowanceFetcher: AbstractBalanceAndProxyAllowanceFetcher; + private _orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher; private static _validateIfOrderIsValid(signedOrder: SignedOrder, orderRelevantState: OrderRelevantState): void { const unavailableTakerTokenAmount = orderRelevantState.cancelledTakerTokenAmount.add( orderRelevantState.filledTakerTokenAmount, @@ -49,15 +54,15 @@ export class OrderStateUtils { } } constructor( - balanceAndProxyAllowanceFetcher: BalanceAndProxyAllowanceFetcher, - orderFilledCancelledFetcher: OrderFilledCancelledFetcher, + balanceAndProxyAllowanceFetcher: AbstractBalanceAndProxyAllowanceFetcher, + orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher, ) { this._balanceAndProxyAllowanceFetcher = balanceAndProxyAllowanceFetcher; this._orderFilledCancelledFetcher = orderFilledCancelledFetcher; } public async getOrderStateAsync(signedOrder: SignedOrder): Promise<OrderState> { const orderRelevantState = await this.getOrderRelevantStateAsync(signedOrder); - const orderHash = ZeroEx.getOrderHashHex(signedOrder); + const orderHash = getOrderHashHex(signedOrder); try { OrderStateUtils._validateIfOrderIsValid(signedOrder, orderRelevantState); const orderState: OrderStateValid = { @@ -76,13 +81,8 @@ export class OrderStateUtils { } } public async getOrderRelevantStateAsync(signedOrder: SignedOrder): Promise<OrderRelevantState> { - // HACK: We access the private property here but otherwise the interface will be less nice. - // If we pass it from the instantiator - there is no opportunity to get it there - // because JS doesn't support async constructors. - // Moreover - it's cached under the hood so it's equivalent to an async constructor. - const exchange = (this._orderFilledCancelledFetcher as any)._exchangeWrapper as ExchangeWrapper; - const zrxTokenAddress = exchange.getZRXTokenAddress(); - const orderHash = ZeroEx.getOrderHashHex(signedOrder); + const zrxTokenAddress = this._orderFilledCancelledFetcher.getZRXTokenAddress(); + const orderHash = getOrderHashHex(signedOrder); const makerBalance = await this._balanceAndProxyAllowanceFetcher.getBalanceAsync( signedOrder.makerTokenAddress, signedOrder.maker, @@ -103,7 +103,9 @@ export class OrderStateUtils { const cancelledTakerTokenAmount = await this._orderFilledCancelledFetcher.getCancelledTakerAmountAsync( orderHash, ); - const unavailableTakerTokenAmount = await exchange.getUnavailableTakerAmountAsync(orderHash); + const unavailableTakerTokenAmount = await this._orderFilledCancelledFetcher.getUnavailableTakerAmountAsync( + orderHash, + ); const totalMakerTokenAmount = signedOrder.makerTokenAmount; const totalTakerTokenAmount = signedOrder.takerTokenAmount; const remainingTakerTokenAmount = totalTakerTokenAmount.minus(unavailableTakerTokenAmount); diff --git a/packages/0x.js/src/order_watcher/remaining_fillable_calculator.ts b/packages/order-utils/src/remaining_fillable_calculator.ts index 184c13aa4..184c13aa4 100644 --- a/packages/0x.js/src/order_watcher/remaining_fillable_calculator.ts +++ b/packages/order-utils/src/remaining_fillable_calculator.ts diff --git a/packages/order-watcher/.npmignore b/packages/order-watcher/.npmignore new file mode 100644 index 000000000..c5be1b302 --- /dev/null +++ b/packages/order-watcher/.npmignore @@ -0,0 +1,10 @@ +.* +tsconfig.json +webpack.config.js +yarn-error.log +test/ +/src/ +/_bundles/ +/generated_docs/ +/scripts/ +/lib/src/monorepo_scripts/ diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json new file mode 100644 index 000000000..fde762c72 --- /dev/null +++ b/packages/order-watcher/CHANGELOG.json @@ -0,0 +1,10 @@ +[ + { + "version": "0.0.1", + "changes": [ + { + "note": "Moved OrderWatcher out of 0x.js package" + } + ] + } +] diff --git a/packages/order-watcher/README.md b/packages/order-watcher/README.md new file mode 100644 index 000000000..d461dca8d --- /dev/null +++ b/packages/order-watcher/README.md @@ -0,0 +1,91 @@ +## OrderWatcher + +An order watcher daemon that watches for order validity. + +#### Read the wiki [article](https://0xproject.com/wiki#0x-OrderWatcher). + +## Installation + +**Install** + +```bash +npm install @0xproject/order-watcher --save +``` + +**Import** + +```javascript +import { OrderWatcher } from '@0xproject/order-watcher'; +``` + +If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`: + +```json +"compilerOptions": { + "typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"], +} +``` + +## Contributing + +We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository. + +Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started. + +### Install dependencies + +If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them: + +```bash +yarn config set workspaces-experimental true +``` + +Then install dependencies + +```bash +yarn install +``` + +### Build + +If this is your **first** time building this package, you must first build **all** packages within the monorepo. This is because packages that depend on other packages located inside this monorepo are symlinked when run from **within** the monorepo. This allows you to make changes across multiple packages without first publishing dependent packages to NPM. To build all packages, run the following from the monorepo root directory: + +```bash +yarn lerna:rebuild +``` + +Or continuously rebuild on change: + +```bash +yarn dev +``` + +You can also build this specific package by running the following from within its directory: + +```bash +yarn build +``` + +or continuously rebuild on change: + +```bash +yarn build:watch +``` + +### Clean + +```bash +yarn clean +``` + +### Lint + +```bash +yarn lint +``` + +### Run Tests + +```bash +yarn test +``` diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json new file mode 100644 index 000000000..d91a0bdc7 --- /dev/null +++ b/packages/order-watcher/package.json @@ -0,0 +1,94 @@ +{ + "name": "@0xproject/order-watcher", + "version": "0.0.1", + "description": "An order watcher daemon that watches for order validity", + "keywords": [ + "0x", + "0xproject", + "ethereum", + "exchange", + "orderbook" + ], + "main": "lib/src/index.js", + "types": "lib/src/index.d.ts", + "scripts": { + "build:watch": "tsc -w", + "prebuild": "run-s clean generate_contract_wrappers", + "generate_contract_wrappers": "node ../abi-gen/lib/index.js --abis 'src/compact_artifacts/@(Exchange|Token|TokenTransferProxy|EtherToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/generated_contract_wrappers --backend ethers && prettier --write 'src/generated_contract_wrappers/**.ts'", + "lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'", + "test:circleci": "run-s test:coverage", + "test": "run-s clean build run_mocha", + "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", + "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", + "update_artifacts": "for i in ${npm_package_config_contracts}; do copyfiles -u 4 ../migrations/src/artifacts/$i.json test/artifacts; done;", + "clean": "shx rm -rf _bundles lib test_temp scripts", + "build": "tsc && yarn update_artifacts && copyfiles -u 2 './src/compact_artifacts/**/*.json' ./lib/src/compact_artifacts && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "run_mocha": "mocha lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit", + "manual:postpublish": "yarn build; node ./scripts/postpublish.js" + }, + "config": { + "compact_artifacts": "Exchange DummyToken ZRXToken Token EtherToken TokenTransferProxy TokenRegistry", + "contracts": "Exchange DummyToken ZRXToken Token WETH9 TokenTransferProxy MultiSigWallet MultiSigWalletWithTimeLock MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress MaliciousToken TokenRegistry Arbitrage EtherDelta AccountLevels", + "postpublish": { + "assets": [ + "packages/order-watcher/_bundles/index.js", + "packages/order-watcher/_bundles/index.min.js" + ] + } + }, + "repository": { + "type": "git", + "url": "https://github.com/0xProject/0x-monorepo" + }, + "license": "Apache-2.0", + "engines": { + "node": ">=6.0.0" + }, + "devDependencies": { + "@0xproject/deployer": "^0.4.3", + "@0xproject/dev-utils": "^0.4.1", + "@0xproject/migrations": "^0.0.5", + "@0xproject/monorepo-scripts": "^0.1.19", + "@0xproject/tslint-config": "^0.4.17", + "@types/bintrees": "^1.0.2", + "@types/lodash": "4.14.104", + "@types/mocha": "^2.2.42", + "@types/node": "^8.0.53", + "@types/sinon": "^2.2.2", + "awesome-typescript-loader": "^3.1.3", + "chai": "^4.0.1", + "chai-as-promised": "^7.1.0", + "chai-bignumber": "^2.0.1", + "copyfiles": "^1.2.0", + "dirty-chai": "^2.0.1", + "json-loader": "^0.5.4", + "mocha": "^4.0.1", + "npm-run-all": "^4.1.2", + "nyc": "^11.0.1", + "opn-cli": "^3.1.0", + "prettier": "^1.11.1", + "shx": "^0.2.2", + "sinon": "^4.0.0", + "source-map-support": "^0.5.0", + "tslint": "5.8.0", + "typescript": "2.7.1", + }, + "dependencies": { + "@0xproject/contract-wrappers": "^0.0.1", + "@0xproject/assert": "^0.2.9", + "@0xproject/base-contract": "^0.3.1", + "@0xproject/fill-scenarios": "^0.0.1", + "@0xproject/json-schemas": "^0.7.23", + "@0xproject/order-utils": "^0.0.4", + "@0xproject/types": "^0.6.3", + "@0xproject/typescript-typings": "^0.3.1", + "@0xproject/utils": "^0.6.1", + "@0xproject/web3-wrapper": "^0.6.3", + "bintrees": "^1.0.2", + "ethers": "^3.0.15", + "lodash": "^4.17.4" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/order-watcher/src/artifacts.ts b/packages/order-watcher/src/artifacts.ts new file mode 100644 index 000000000..13587984c --- /dev/null +++ b/packages/order-watcher/src/artifacts.ts @@ -0,0 +1,18 @@ +import { Artifact } from '@0xproject/types'; + +import * as DummyToken from './compact_artifacts/DummyToken.json'; +import * as EtherToken from './compact_artifacts/EtherToken.json'; +import * as Exchange from './compact_artifacts/Exchange.json'; +import * as Token from './compact_artifacts/Token.json'; +import * as TokenRegistry from './compact_artifacts/TokenRegistry.json'; +import * as TokenTransferProxy from './compact_artifacts/TokenTransferProxy.json'; +import * as ZRX from './compact_artifacts/ZRX.json'; +export const artifacts = { + ZRX: (ZRX as any) as Artifact, + DummyToken: (DummyToken as any) as Artifact, + Token: (Token as any) as Artifact, + Exchange: (Exchange as any) as Artifact, + EtherToken: (EtherToken as any) as Artifact, + TokenRegistry: (TokenRegistry as any) as Artifact, + TokenTransferProxy: (TokenTransferProxy as any) as Artifact, +}; diff --git a/packages/order-watcher/src/compact_artifacts/DummyToken.json b/packages/order-watcher/src/compact_artifacts/DummyToken.json new file mode 100644 index 000000000..f64a8cd3d --- /dev/null +++ b/packages/order-watcher/src/compact_artifacts/DummyToken.json @@ -0,0 +1,22 @@ +{ + "contract_name": "DummyToken", + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "_target", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "setBalance", + "outputs": [], + "payable": false, + "type": "function" + } + ] +} diff --git a/packages/order-watcher/src/compact_artifacts/EtherToken.json b/packages/order-watcher/src/compact_artifacts/EtherToken.json new file mode 100644 index 000000000..26cca57cd --- /dev/null +++ b/packages/order-watcher/src/compact_artifacts/EtherToken.json @@ -0,0 +1,287 @@ +{ + "contract_name": "EtherToken", + "abi": [ + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_spender", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "name": "", + "type": "uint8" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "deposit", + "outputs": [], + "payable": true, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "payable": true, + "type": "fallback" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_from", + "type": "address" + }, + { + "indexed": true, + "name": "_to", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "name": "_spender", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Withdrawal", + "type": "event" + } + ], + "networks": { + "1": { + "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" + }, + "3": { + "address": "0xc00fd9820cd2898cc4c054b7bf142de637ad129a" + }, + "4": { + "address": "0xc778417e063141139fce010982780140aa0cd5ab" + }, + "42": { + "address": "0x653e49e301e508a13237c0ddc98ae7d4cd2667a1" + }, + "50": { + "address": "0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c" + } + } +} diff --git a/packages/order-watcher/src/compact_artifacts/Exchange.json b/packages/order-watcher/src/compact_artifacts/Exchange.json new file mode 100644 index 000000000..af8db7360 --- /dev/null +++ b/packages/order-watcher/src/compact_artifacts/Exchange.json @@ -0,0 +1,610 @@ +{ + "contract_name": "Exchange", + "abi": [ + { + "constant": true, + "inputs": [ + { + "name": "numerator", + "type": "uint256" + }, + { + "name": "denominator", + "type": "uint256" + }, + { + "name": "target", + "type": "uint256" + } + ], + "name": "isRoundingError", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "name": "filled", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "name": "cancelled", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5][]" + }, + { + "name": "orderValues", + "type": "uint256[6][]" + }, + { + "name": "fillTakerTokenAmount", + "type": "uint256" + }, + { + "name": "shouldThrowOnInsufficientBalanceOrAllowance", + "type": "bool" + }, + { + "name": "v", + "type": "uint8[]" + }, + { + "name": "r", + "type": "bytes32[]" + }, + { + "name": "s", + "type": "bytes32[]" + } + ], + "name": "fillOrdersUpTo", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5]" + }, + { + "name": "orderValues", + "type": "uint256[6]" + }, + { + "name": "cancelTakerTokenAmount", + "type": "uint256" + } + ], + "name": "cancelOrder", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "ZRX_TOKEN_CONTRACT", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5][]" + }, + { + "name": "orderValues", + "type": "uint256[6][]" + }, + { + "name": "fillTakerTokenAmounts", + "type": "uint256[]" + }, + { + "name": "v", + "type": "uint8[]" + }, + { + "name": "r", + "type": "bytes32[]" + }, + { + "name": "s", + "type": "bytes32[]" + } + ], + "name": "batchFillOrKillOrders", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5]" + }, + { + "name": "orderValues", + "type": "uint256[6]" + }, + { + "name": "fillTakerTokenAmount", + "type": "uint256" + }, + { + "name": "v", + "type": "uint8" + }, + { + "name": "r", + "type": "bytes32" + }, + { + "name": "s", + "type": "bytes32" + } + ], + "name": "fillOrKillOrder", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "getUnavailableTakerTokenAmount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "signer", + "type": "address" + }, + { + "name": "hash", + "type": "bytes32" + }, + { + "name": "v", + "type": "uint8" + }, + { + "name": "r", + "type": "bytes32" + }, + { + "name": "s", + "type": "bytes32" + } + ], + "name": "isValidSignature", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "numerator", + "type": "uint256" + }, + { + "name": "denominator", + "type": "uint256" + }, + { + "name": "target", + "type": "uint256" + } + ], + "name": "getPartialAmount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "TOKEN_TRANSFER_PROXY_CONTRACT", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5][]" + }, + { + "name": "orderValues", + "type": "uint256[6][]" + }, + { + "name": "fillTakerTokenAmounts", + "type": "uint256[]" + }, + { + "name": "shouldThrowOnInsufficientBalanceOrAllowance", + "type": "bool" + }, + { + "name": "v", + "type": "uint8[]" + }, + { + "name": "r", + "type": "bytes32[]" + }, + { + "name": "s", + "type": "bytes32[]" + } + ], + "name": "batchFillOrders", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5][]" + }, + { + "name": "orderValues", + "type": "uint256[6][]" + }, + { + "name": "cancelTakerTokenAmounts", + "type": "uint256[]" + } + ], + "name": "batchCancelOrders", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5]" + }, + { + "name": "orderValues", + "type": "uint256[6]" + }, + { + "name": "fillTakerTokenAmount", + "type": "uint256" + }, + { + "name": "shouldThrowOnInsufficientBalanceOrAllowance", + "type": "bool" + }, + { + "name": "v", + "type": "uint8" + }, + { + "name": "r", + "type": "bytes32" + }, + { + "name": "s", + "type": "bytes32" + } + ], + "name": "fillOrder", + "outputs": [ + { + "name": "filledTakerTokenAmount", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5]" + }, + { + "name": "orderValues", + "type": "uint256[6]" + } + ], + "name": "getOrderHash", + "outputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "EXTERNAL_QUERY_GAS_LIMIT", + "outputs": [ + { + "name": "", + "type": "uint16" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "VERSION", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "type": "function" + }, + { + "inputs": [ + { + "name": "_zrxToken", + "type": "address" + }, + { + "name": "_tokenTransferProxy", + "type": "address" + } + ], + "payable": false, + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "maker", + "type": "address" + }, + { + "indexed": false, + "name": "taker", + "type": "address" + }, + { + "indexed": true, + "name": "feeRecipient", + "type": "address" + }, + { + "indexed": false, + "name": "makerToken", + "type": "address" + }, + { + "indexed": false, + "name": "takerToken", + "type": "address" + }, + { + "indexed": false, + "name": "filledMakerTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "name": "filledTakerTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "name": "paidMakerFee", + "type": "uint256" + }, + { + "indexed": false, + "name": "paidTakerFee", + "type": "uint256" + }, + { + "indexed": true, + "name": "tokens", + "type": "bytes32" + }, + { + "indexed": false, + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "LogFill", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "maker", + "type": "address" + }, + { + "indexed": true, + "name": "feeRecipient", + "type": "address" + }, + { + "indexed": false, + "name": "makerToken", + "type": "address" + }, + { + "indexed": false, + "name": "takerToken", + "type": "address" + }, + { + "indexed": false, + "name": "cancelledMakerTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "name": "cancelledTakerTokenAmount", + "type": "uint256" + }, + { + "indexed": true, + "name": "tokens", + "type": "bytes32" + }, + { + "indexed": false, + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "LogCancel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "errorId", + "type": "uint8" + }, + { + "indexed": true, + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "LogError", + "type": "event" + } + ], + "networks": { + "1": { + "address": "0x12459c951127e0c374ff9105dda097662a027093" + }, + "3": { + "address": "0x479cc461fecd078f766ecc58533d6f69580cf3ac" + }, + "4": { + "address": "0x1d16ef40fac01cec8adac2ac49427b9384192c05" + }, + "42": { + "address": "0x90fe2af704b34e0224bf2299c838e04d4dcf1364" + }, + "50": { + "address": "0x48bacb9266a570d521063ef5dd96e61686dbe788" + } + } +} diff --git a/packages/order-watcher/src/compact_artifacts/Token.json b/packages/order-watcher/src/compact_artifacts/Token.json new file mode 100644 index 000000000..3b5a86ae0 --- /dev/null +++ b/packages/order-watcher/src/compact_artifacts/Token.json @@ -0,0 +1,172 @@ +{ + "contract_name": "Token", + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "_spender", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "name": "success", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "name": "supply", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "success", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "balance", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "name": "success", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "name": "remaining", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_from", + "type": "address" + }, + { + "indexed": true, + "name": "_to", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "name": "_spender", + "type": "address" + }, + { + "indexed": false, + "name": "_value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + } + ] +} diff --git a/packages/order-watcher/src/compact_artifacts/TokenRegistry.json b/packages/order-watcher/src/compact_artifacts/TokenRegistry.json new file mode 100644 index 000000000..0f583628c --- /dev/null +++ b/packages/order-watcher/src/compact_artifacts/TokenRegistry.json @@ -0,0 +1,547 @@ +{ + "contract_name": "TokenRegistry", + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_index", + "type": "uint256" + } + ], + "name": "removeToken", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_name", + "type": "string" + } + ], + "name": "getTokenAddressByName", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_symbol", + "type": "string" + } + ], + "name": "getTokenAddressBySymbol", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_swarmHash", + "type": "bytes" + } + ], + "name": "setTokenSwarmHash", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_token", + "type": "address" + } + ], + "name": "getTokenMetaData", + "outputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "uint8" + }, + { + "name": "", + "type": "bytes" + }, + { + "name": "", + "type": "bytes" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_name", + "type": "string" + }, + { + "name": "_symbol", + "type": "string" + }, + { + "name": "_decimals", + "type": "uint8" + }, + { + "name": "_ipfsHash", + "type": "bytes" + }, + { + "name": "_swarmHash", + "type": "bytes" + } + ], + "name": "addToken", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_name", + "type": "string" + } + ], + "name": "setTokenName", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "tokens", + "outputs": [ + { + "name": "token", + "type": "address" + }, + { + "name": "name", + "type": "string" + }, + { + "name": "symbol", + "type": "string" + }, + { + "name": "decimals", + "type": "uint8" + }, + { + "name": "ipfsHash", + "type": "bytes" + }, + { + "name": "swarmHash", + "type": "bytes" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "tokenAddresses", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_name", + "type": "string" + } + ], + "name": "getTokenByName", + "outputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "uint8" + }, + { + "name": "", + "type": "bytes" + }, + { + "name": "", + "type": "bytes" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getTokenAddresses", + "outputs": [ + { + "name": "", + "type": "address[]" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_ipfsHash", + "type": "bytes" + } + ], + "name": "setTokenIpfsHash", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_symbol", + "type": "string" + } + ], + "name": "getTokenBySymbol", + "outputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "string" + }, + { + "name": "", + "type": "uint8" + }, + { + "name": "", + "type": "bytes" + }, + { + "name": "", + "type": "bytes" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_token", + "type": "address" + }, + { + "name": "_symbol", + "type": "string" + } + ], + "name": "setTokenSymbol", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "name", + "type": "string" + }, + { + "indexed": false, + "name": "symbol", + "type": "string" + }, + { + "indexed": false, + "name": "decimals", + "type": "uint8" + }, + { + "indexed": false, + "name": "ipfsHash", + "type": "bytes" + }, + { + "indexed": false, + "name": "swarmHash", + "type": "bytes" + } + ], + "name": "LogAddToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "name", + "type": "string" + }, + { + "indexed": false, + "name": "symbol", + "type": "string" + }, + { + "indexed": false, + "name": "decimals", + "type": "uint8" + }, + { + "indexed": false, + "name": "ipfsHash", + "type": "bytes" + }, + { + "indexed": false, + "name": "swarmHash", + "type": "bytes" + } + ], + "name": "LogRemoveToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "oldName", + "type": "string" + }, + { + "indexed": false, + "name": "newName", + "type": "string" + } + ], + "name": "LogTokenNameChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "oldSymbol", + "type": "string" + }, + { + "indexed": false, + "name": "newSymbol", + "type": "string" + } + ], + "name": "LogTokenSymbolChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "oldIpfsHash", + "type": "bytes" + }, + { + "indexed": false, + "name": "newIpfsHash", + "type": "bytes" + } + ], + "name": "LogTokenIpfsHashChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "token", + "type": "address" + }, + { + "indexed": false, + "name": "oldSwarmHash", + "type": "bytes" + }, + { + "indexed": false, + "name": "newSwarmHash", + "type": "bytes" + } + ], + "name": "LogTokenSwarmHashChange", + "type": "event" + } + ], + "networks": { + "1": { + "address": "0x926a74c5c36adf004c87399e65f75628b0f98d2c" + }, + "3": { + "address": "0x6b1a50f0bb5a7995444bd3877b22dc89c62843ed" + }, + "4": { + "address": "0x4e9aad8184de8833365fea970cd9149372fdf1e6" + }, + "42": { + "address": "0xf18e504561f4347bea557f3d4558f559dddbae7f" + }, + "50": { + "address": "0x0b1ba0af832d7c05fd64161e0db78e85978e8082" + } + } +} diff --git a/packages/order-watcher/src/compact_artifacts/TokenTransferProxy.json b/packages/order-watcher/src/compact_artifacts/TokenTransferProxy.json new file mode 100644 index 000000000..8cf551ddb --- /dev/null +++ b/packages/order-watcher/src/compact_artifacts/TokenTransferProxy.json @@ -0,0 +1,187 @@ +{ + "contract_name": "TokenTransferProxy", + "abi": [ + { + "constant": false, + "inputs": [ + { + "name": "token", + "type": "address" + }, + { + "name": "from", + "type": "address" + }, + { + "name": "to", + "type": "address" + }, + { + "name": "value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "target", + "type": "address" + } + ], + "name": "addAuthorizedAddress", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "authorities", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "target", + "type": "address" + } + ], + "name": "removeAuthorizedAddress", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "authorized", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getAuthorizedAddresses", + "outputs": [ + { + "name": "", + "type": "address[]" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "target", + "type": "address" + }, + { + "indexed": true, + "name": "caller", + "type": "address" + } + ], + "name": "LogAuthorizedAddressAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "target", + "type": "address" + }, + { + "indexed": true, + "name": "caller", + "type": "address" + } + ], + "name": "LogAuthorizedAddressRemoved", + "type": "event" + } + ], + "networks": { + "1": { + "address": "0x8da0d80f5007ef1e431dd2127178d224e32c2ef4" + }, + "3": { + "address": "0x4e9aad8184de8833365fea970cd9149372fdf1e6" + }, + "4": { + "address": "0xa8e9fa8f91e5ae138c74648c9c304f1c75003a8d" + }, + "42": { + "address": "0x087eed4bc1ee3de49befbd66c662b434b15d49d4" + }, + "50": { + "address": "0x1dc4c1cefef38a777b15aa20260a54e584b16c48" + } + } +} diff --git a/packages/order-watcher/src/compact_artifacts/ZRX.json b/packages/order-watcher/src/compact_artifacts/ZRX.json new file mode 100644 index 000000000..e40b8f268 --- /dev/null +++ b/packages/order-watcher/src/compact_artifacts/ZRX.json @@ -0,0 +1,20 @@ +{ + "contract_name": "ZRX", + "networks": { + "1": { + "address": "0xe41d2489571d322189246dafa5ebde1f4699f498" + }, + "3": { + "address": "0xa8e9fa8f91e5ae138c74648c9c304f1c75003a8d" + }, + "4": { + "address": "0x00f58d6d585f84b2d7267940cede30ce2fe6eae8" + }, + "42": { + "address": "0x6ff6c0ff1d68b964901f986d4c9fa3ac68346570" + }, + "50": { + "address": "0x1d7022f5b17d2f8b695918fb48fa1089c9f85401" + } + } +} diff --git a/packages/order-watcher/src/globals.d.ts b/packages/order-watcher/src/globals.d.ts new file mode 100644 index 000000000..94e63a32d --- /dev/null +++ b/packages/order-watcher/src/globals.d.ts @@ -0,0 +1,6 @@ +declare module '*.json' { + const json: any; + /* tslint:disable */ + export default json; + /* tslint:enable */ +} diff --git a/packages/order-watcher/src/index.ts b/packages/order-watcher/src/index.ts new file mode 100644 index 000000000..390003b1d --- /dev/null +++ b/packages/order-watcher/src/index.ts @@ -0,0 +1,7 @@ +export { OrderWatcher } from './order_watcher/order_watcher'; + +export { OrderStateValid, OrderStateInvalid, OrderState } from '@0xproject/types'; + +export { OnOrderStateChangeCallback, OrderWatcherConfig } from './types'; + +export { BlockParamLiteral, BlockParam, Order, Provider, SignedOrder } from '@0xproject/types'; diff --git a/packages/order-watcher/src/monorepo_scripts/postpublish.ts b/packages/order-watcher/src/monorepo_scripts/postpublish.ts new file mode 100644 index 000000000..dcb99d0f7 --- /dev/null +++ b/packages/order-watcher/src/monorepo_scripts/postpublish.ts @@ -0,0 +1,8 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; + +import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; + +const cwd = `${__dirname}/..`; +// tslint:disable-next-line:no-floating-promises +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/0x.js/src/order_watcher/event_watcher.ts b/packages/order-watcher/src/order_watcher/event_watcher.ts index de5a99a46..f39d3bf0e 100644 --- a/packages/0x.js/src/order_watcher/event_watcher.ts +++ b/packages/order-watcher/src/order_watcher/event_watcher.ts @@ -3,7 +3,7 @@ import { intervalUtils } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; -import { EventWatcherCallback, ZeroExError } from '../types'; +import { EventWatcherCallback, OrderWatcherError } from '../types'; import { assert } from '../utils/assert'; const DEFAULT_EVENT_POLLING_INTERVAL_MS = 200; @@ -37,7 +37,7 @@ export class EventWatcher { public subscribe(callback: EventWatcherCallback): void { assert.isFunction('callback', callback); if (!_.isUndefined(this._intervalIdIfExists)) { - throw new Error(ZeroExError.SubscriptionAlreadyPresent); + throw new Error(OrderWatcherError.SubscriptionAlreadyPresent); } this._intervalIdIfExists = intervalUtils.setAsyncExcludingInterval( this._pollForBlockchainEventsAsync.bind(this, callback), diff --git a/packages/0x.js/src/order_watcher/expiration_watcher.ts b/packages/order-watcher/src/order_watcher/expiration_watcher.ts index 27ec7107d..ec2c1ec35 100644 --- a/packages/0x.js/src/order_watcher/expiration_watcher.ts +++ b/packages/order-watcher/src/order_watcher/expiration_watcher.ts @@ -2,7 +2,7 @@ import { BigNumber, intervalUtils } from '@0xproject/utils'; import { RBTree } from 'bintrees'; import * as _ from 'lodash'; -import { ZeroExError } from '../types'; +import { OrderWatcherError } from '../types'; import { utils } from '../utils/utils'; const DEFAULT_EXPIRATION_MARGIN_MS = 0; @@ -37,7 +37,7 @@ export class ExpirationWatcher { } public subscribe(callback: (orderHash: string) => void): void { if (!_.isUndefined(this._orderExpirationCheckingIntervalIdIfExists)) { - throw new Error(ZeroExError.SubscriptionAlreadyPresent); + throw new Error(OrderWatcherError.SubscriptionAlreadyPresent); } this._orderExpirationCheckingIntervalIdIfExists = intervalUtils.setInterval( this._pruneExpiredOrders.bind(this, callback), @@ -47,7 +47,7 @@ export class ExpirationWatcher { } public unsubscribe(): void { if (_.isUndefined(this._orderExpirationCheckingIntervalIdIfExists)) { - throw new Error(ZeroExError.SubscriptionNotFound); + throw new Error(OrderWatcherError.SubscriptionNotFound); } intervalUtils.clearInterval(this._orderExpirationCheckingIntervalIdIfExists); delete this._orderExpirationCheckingIntervalIdIfExists; diff --git a/packages/0x.js/src/order_watcher/order_state_watcher.ts b/packages/order-watcher/src/order_watcher/order_watcher.ts index a9df8ac9d..63f87b565 100644 --- a/packages/0x.js/src/order_watcher/order_state_watcher.ts +++ b/packages/order-watcher/src/order_watcher/order_watcher.ts @@ -1,45 +1,51 @@ +import { + BalanceAndProxyAllowanceLazyStore, + ContractWrappers, + OrderFilledCancelledLazyStore, +} from '@0xproject/contract-wrappers'; import { schemas } from '@0xproject/json-schemas'; -import { BlockParamLiteral, LogWithDecodedArgs, SignedOrder } from '@0xproject/types'; +import { getOrderHashHex, OrderStateUtils } from '@0xproject/order-utils'; +import { + BlockParamLiteral, + ExchangeContractErrs, + LogEntryEvent, + LogWithDecodedArgs, + OrderState, + Provider, + SignedOrder, +} from '@0xproject/types'; import { AbiDecoder, intervalUtils } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; -import { ZeroEx } from '../0x'; -import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper'; +import { artifacts } from '../artifacts'; import { DepositContractEventArgs, + EtherTokenContractEventArgs, EtherTokenEvents, WithdrawalContractEventArgs, -} from '../contract_wrappers/generated/ether_token'; +} from '../generated_contract_wrappers/ether_token'; import { + ExchangeContractEventArgs, ExchangeEvents, LogCancelContractEventArgs, LogFillContractEventArgs, -} from '../contract_wrappers/generated/exchange'; +} from '../generated_contract_wrappers/exchange'; import { ApprovalContractEventArgs, + TokenContractEventArgs, TokenEvents, TransferContractEventArgs, -} from '../contract_wrappers/generated/token'; -import { TokenWrapper } from '../contract_wrappers/token_wrapper'; -import { BalanceAndProxyAllowanceLazyStore } from '../stores/balance_proxy_allowance_lazy_store'; -import { OrderFilledCancelledLazyStore } from '../stores/order_filled_cancelled_lazy_store'; -import { - ContractEventArgs, - ExchangeContractErrs, - LogEvent, - OnOrderStateChangeCallback, - OrderState, - OrderStateWatcherConfig, - ZeroExError, -} from '../types'; +} from '../generated_contract_wrappers/token'; +import { OnOrderStateChangeCallback, OrderWatcherConfig, OrderWatcherError } from '../types'; import { assert } from '../utils/assert'; -import { OrderStateUtils } from '../utils/order_state_utils'; import { utils } from '../utils/utils'; import { EventWatcher } from './event_watcher'; import { ExpirationWatcher } from './expiration_watcher'; +type ContractEventArgs = EtherTokenContractEventArgs | ExchangeContractEventArgs | TokenContractEventArgs; + interface DependentOrderHashes { [makerAddress: string]: { [makerToken: string]: Set<string>; @@ -62,7 +68,8 @@ const DEFAULT_CLEANUP_JOB_INTERVAL_MS = 1000 * 60 * 60; // 1h * the subscriber of these changes so that a final decision can be made on whether * the order should be deemed invalid. */ -export class OrderStateWatcher { +export class OrderWatcher { + private _contractWrappers: ContractWrappers; private _orderStateByOrderHashCache: OrderStateByOrderHash = {}; private _orderByOrderHash: OrderByOrderHash = {}; private _dependentOrderHashes: DependentOrderHashes = {}; @@ -75,19 +82,26 @@ export class OrderStateWatcher { private _balanceAndProxyAllowanceLazyStore: BalanceAndProxyAllowanceLazyStore; private _cleanupJobInterval: number; private _cleanupJobIntervalIdIfExists?: NodeJS.Timer; - constructor( - web3Wrapper: Web3Wrapper, - token: TokenWrapper, - exchange: ExchangeWrapper, - config?: OrderStateWatcherConfig, - ) { - this._web3Wrapper = web3Wrapper; + constructor(provider: Provider, networkId: number, config?: OrderWatcherConfig) { + this._web3Wrapper = new Web3Wrapper(provider); + const artifactJSONs = _.values(artifacts); + const abiArrays = _.map(artifactJSONs, artifact => artifact.abi); + _.forEach(abiArrays, abi => { + this._web3Wrapper.abiDecoder.addABI(abi); + }); + this._contractWrappers = new ContractWrappers(provider, { networkId }); const pollingIntervalIfExistsMs = _.isUndefined(config) ? undefined : config.eventPollingIntervalMs; const stateLayer = _.isUndefined(config) || _.isUndefined(config.stateLayer) ? BlockParamLiteral.Latest : config.stateLayer; - this._eventWatcher = new EventWatcher(web3Wrapper, pollingIntervalIfExistsMs, stateLayer); - this._balanceAndProxyAllowanceLazyStore = new BalanceAndProxyAllowanceLazyStore(token, stateLayer); - this._orderFilledCancelledLazyStore = new OrderFilledCancelledLazyStore(exchange, stateLayer); + this._eventWatcher = new EventWatcher(this._web3Wrapper, pollingIntervalIfExistsMs, stateLayer); + this._balanceAndProxyAllowanceLazyStore = new BalanceAndProxyAllowanceLazyStore( + this._contractWrappers.token, + stateLayer, + ); + this._orderFilledCancelledLazyStore = new OrderFilledCancelledLazyStore( + this._contractWrappers.exchange, + stateLayer, + ); this._orderStateUtils = new OrderStateUtils( this._balanceAndProxyAllowanceLazyStore, this._orderFilledCancelledLazyStore, @@ -106,13 +120,13 @@ export class OrderStateWatcher { : config.cleanupJobIntervalMs; } /** - * Add an order to the orderStateWatcher. Before the order is added, it's + * Add an order to the orderWatcher. Before the order is added, it's * signature is verified. * @param signedOrder The order you wish to start watching. */ public addOrder(signedOrder: SignedOrder): void { assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema); - const orderHash = ZeroEx.getOrderHashHex(signedOrder); + const orderHash = getOrderHashHex(signedOrder); assert.isValidSignature(orderHash, signedOrder.ecSignature, signedOrder.maker); this._orderByOrderHash[orderHash] = signedOrder; this._addToDependentOrderHashes(signedOrder, orderHash); @@ -120,7 +134,7 @@ export class OrderStateWatcher { this._expirationWatcher.addOrder(orderHash, expirationUnixTimestampMs); } /** - * Removes an order from the orderStateWatcher + * Removes an order from the orderWatcher * @param orderHash The orderHash of the order you wish to stop watching. */ public removeOrder(orderHash: string): void { @@ -131,8 +145,7 @@ export class OrderStateWatcher { } delete this._orderByOrderHash[orderHash]; delete this._orderStateByOrderHashCache[orderHash]; - const exchange = (this._orderFilledCancelledLazyStore as any)._exchangeWrapper as ExchangeWrapper; - const zrxTokenAddress = exchange.getZRXTokenAddress(); + const zrxTokenAddress = this._orderFilledCancelledLazyStore.getZRXTokenAddress(); this._removeFromDependentOrderHashes(signedOrder.maker, zrxTokenAddress, orderHash); if (zrxTokenAddress !== signedOrder.makerTokenAddress) { @@ -142,7 +155,7 @@ export class OrderStateWatcher { this._expirationWatcher.removeOrder(orderHash); } /** - * Starts an orderStateWatcher subscription. The callback will be called every time a watched order's + * Starts an orderWatcher subscription. The callback will be called every time a watched order's * backing blockchain state has changed. This is a call-to-action for the caller to re-validate the order. * @param callback Receives the orderHash of the order that should be re-validated, together * with all the order-relevant blockchain state needed to re-validate the order. @@ -150,7 +163,7 @@ export class OrderStateWatcher { public subscribe(callback: OnOrderStateChangeCallback): void { assert.isFunction('callback', callback); if (!_.isUndefined(this._callbackIfExists)) { - throw new Error(ZeroExError.SubscriptionAlreadyPresent); + throw new Error(OrderWatcherError.SubscriptionAlreadyPresent); } this._callbackIfExists = callback; this._eventWatcher.subscribe(this._onEventWatcherCallbackAsync.bind(this)); @@ -165,11 +178,11 @@ export class OrderStateWatcher { ); } /** - * Ends an orderStateWatcher subscription. + * Ends an orderWatcher subscription. */ public unsubscribe(): void { if (_.isUndefined(this._callbackIfExists) || _.isUndefined(this._cleanupJobIntervalIdIfExists)) { - throw new Error(ZeroExError.SubscriptionNotFound); + throw new Error(OrderWatcherError.SubscriptionNotFound); } this._balanceAndProxyAllowanceLazyStore.deleteAll(); this._orderFilledCancelledLazyStore.deleteAll(); @@ -218,7 +231,7 @@ export class OrderStateWatcher { } } } - private async _onEventWatcherCallbackAsync(err: Error | null, logIfExists?: LogEvent): Promise<void> { + private async _onEventWatcherCallbackAsync(err: Error | null, logIfExists?: LogEntryEvent): Promise<void> { if (!_.isNull(err)) { if (!_.isUndefined(this._callbackIfExists)) { this._callbackIfExists(err); @@ -226,7 +239,7 @@ export class OrderStateWatcher { } return; } - const log = logIfExists as LogEvent; // At this moment we are sure that no error occured and log is defined. + const log = logIfExists as LogEntryEvent; // At this moment we are sure that no error occured and log is defined. const maybeDecodedLog = this._web3Wrapper.abiDecoder.tryToDecodeLogOrNoop<ContractEventArgs>(log); const isLogDecoded = !_.isUndefined(((maybeDecodedLog as any) as LogWithDecodedArgs<ContractEventArgs>).event); if (!isLogDecoded) { @@ -374,8 +387,7 @@ export class OrderStateWatcher { } } private _getZRXTokenAddress(): string { - const exchange = (this._orderFilledCancelledLazyStore as any)._exchangeWrapper as ExchangeWrapper; - const zrxTokenAddress = exchange.getZRXTokenAddress(); + const zrxTokenAddress = this._orderFilledCancelledLazyStore.getZRXTokenAddress(); return zrxTokenAddress; } } diff --git a/packages/order-watcher/src/types.ts b/packages/order-watcher/src/types.ts new file mode 100644 index 000000000..57fa20e47 --- /dev/null +++ b/packages/order-watcher/src/types.ts @@ -0,0 +1,48 @@ +import { BigNumber } from '@0xproject/utils'; + +import { + BlockParam, + BlockParamLiteral, + ContractAbi, + ContractEventArg, + ExchangeContractErrs, + FilterObject, + LogEntryEvent, + LogWithDecodedArgs, + Order, + OrderState, + SignedOrder, +} from '@0xproject/types'; + +export enum OrderWatcherError { + SubscriptionAlreadyPresent = 'SUBSCRIPTION_ALREADY_PRESENT', + SubscriptionNotFound = 'SUBSCRIPTION_NOT_FOUND', +} + +export type EventWatcherCallback = (err: null | Error, log?: LogEntryEvent) => void; + +/** + * orderExpirationCheckingIntervalMs: How often to check for expired orders. Default=50. + * eventPollingIntervalMs: How often to poll the Ethereum node for new events. Default=200. + * expirationMarginMs: Amount of time before order expiry that you'd like to be notified + * of an orders expiration. Default=0. + * cleanupJobIntervalMs: How often to run a cleanup job which revalidates all the orders. Default=1hr. + * stateLayer: Optional blockchain state layer OrderWatcher will monitor for new events. Default=latest. + */ +export interface OrderWatcherConfig { + orderExpirationCheckingIntervalMs?: number; + eventPollingIntervalMs?: number; + expirationMarginMs?: number; + cleanupJobIntervalMs?: number; + stateLayer: BlockParamLiteral; +} + +export type OnOrderStateChangeCallback = (err: Error | null, orderState?: OrderState) => void; + +export enum InternalOrderWatcherError { + NoAbiDecoder = 'NO_ABI_DECODER', + ZrxNotInTokenRegistry = 'ZRX_NOT_IN_TOKEN_REGISTRY', + WethNotInTokenRegistry = 'WETH_NOT_IN_TOKEN_REGISTRY', +} + +// tslint:disable:max-file-line-count diff --git a/packages/order-watcher/src/utils/assert.ts b/packages/order-watcher/src/utils/assert.ts new file mode 100644 index 000000000..f96bcebc1 --- /dev/null +++ b/packages/order-watcher/src/utils/assert.ts @@ -0,0 +1,19 @@ +import { assert as sharedAssert } from '@0xproject/assert'; +// We need those two unused imports because they're actually used by sharedAssert which gets injected here +// tslint:disable-next-line:no-unused-variable +import { Schema } from '@0xproject/json-schemas'; +// tslint:disable-next-line:no-unused-variable +import { ECSignature } from '@0xproject/types'; +import { BigNumber } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import * as _ from 'lodash'; + +import { isValidSignature } from '@0xproject/order-utils'; + +export const assert = { + ...sharedAssert, + isValidSignature(orderHash: string, ecSignature: ECSignature, signerAddress: string) { + const isValid = isValidSignature(orderHash, ecSignature, signerAddress); + this.assert(isValid, `Expected order with hash '${orderHash}' to have a valid signature`); + }, +}; diff --git a/packages/order-watcher/src/utils/utils.ts b/packages/order-watcher/src/utils/utils.ts new file mode 100644 index 000000000..af1125632 --- /dev/null +++ b/packages/order-watcher/src/utils/utils.ts @@ -0,0 +1,13 @@ +import { BigNumber } from '@0xproject/utils'; + +export const utils = { + spawnSwitchErr(name: string, value: any): Error { + return new Error(`Unexpected switch value: ${value} encountered for ${name}`); + }, + getCurrentUnixTimestampSec(): BigNumber { + return new BigNumber(Date.now() / 1000).round(); + }, + getCurrentUnixTimestampMs(): BigNumber { + return new BigNumber(Date.now()); + }, +}; diff --git a/packages/0x.js/test/event_watcher_test.ts b/packages/order-watcher/test/event_watcher_test.ts index 40ffcc2f6..b4eca315e 100644 --- a/packages/0x.js/test/event_watcher_test.ts +++ b/packages/order-watcher/test/event_watcher_test.ts @@ -1,17 +1,14 @@ -import { web3Factory } from '@0xproject/dev-utils'; -import { LogEntry } from '@0xproject/types'; +import { callbackErrorReporter, web3Factory } from '@0xproject/dev-utils'; +import { DoneCallback, LogEntry, LogEntryEvent } from '@0xproject/types'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; import * as _ from 'lodash'; import 'mocha'; import * as Sinon from 'sinon'; -import { LogEvent } from '../src'; import { EventWatcher } from '../src/order_watcher/event_watcher'; -import { DoneCallback } from '../src/types'; import { chaiSetup } from './utils/chai_setup'; -import { reportNodeCallbackErrors } from './utils/report_callback_errors'; import { provider } from './utils/web3_wrapper'; chaiSetup.configure(); @@ -78,13 +75,15 @@ describe('EventWatcher', () => { getLogsStub.onCall(0).returns(logs); stubs.push(getLogsStub); const expectedToBeCalledOnce = false; - const callback = reportNodeCallbackErrors(done, expectedToBeCalledOnce)((event: LogEvent) => { - const expectedLogEvent = expectedLogEvents.shift(); - expect(event).to.be.deep.equal(expectedLogEvent); - if (_.isEmpty(expectedLogEvents)) { - done(); - } - }); + const callback = callbackErrorReporter.reportNodeCallbackErrors(done, expectedToBeCalledOnce)( + (event: LogEntryEvent) => { + const expectedLogEvent = expectedLogEvents.shift(); + expect(event).to.be.deep.equal(expectedLogEvent); + if (_.isEmpty(expectedLogEvents)) { + done(); + } + }, + ); eventWatcher.subscribe(callback); }); it('correctly computes the difference and emits only changes', (done: DoneCallback) => { @@ -113,13 +112,15 @@ describe('EventWatcher', () => { getLogsStub.onCall(1).returns(changedLogs); stubs.push(getLogsStub); const expectedToBeCalledOnce = false; - const callback = reportNodeCallbackErrors(done, expectedToBeCalledOnce)((event: LogEvent) => { - const expectedLogEvent = expectedLogEvents.shift(); - expect(event).to.be.deep.equal(expectedLogEvent); - if (_.isEmpty(expectedLogEvents)) { - done(); - } - }); + const callback = callbackErrorReporter.reportNodeCallbackErrors(done, expectedToBeCalledOnce)( + (event: LogEntryEvent) => { + const expectedLogEvent = expectedLogEvents.shift(); + expect(event).to.be.deep.equal(expectedLogEvent); + if (_.isEmpty(expectedLogEvents)) { + done(); + } + }, + ); eventWatcher.subscribe(callback); }); }); diff --git a/packages/0x.js/test/expiration_watcher_test.ts b/packages/order-watcher/test/expiration_watcher_test.ts index 1b022539a..0a2524d78 100644 --- a/packages/0x.js/test/expiration_watcher_test.ts +++ b/packages/order-watcher/test/expiration_watcher_test.ts @@ -1,19 +1,20 @@ -import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils'; +import { ContractWrappers } from '@0xproject/contract-wrappers'; +import { BlockchainLifecycle, callbackErrorReporter, devConstants } from '@0xproject/dev-utils'; +import { FillScenarios } from '@0xproject/fill-scenarios'; +import { getOrderHashHex } from '@0xproject/order-utils'; +import { DoneCallback, Token } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import * as _ from 'lodash'; import 'mocha'; import * as Sinon from 'sinon'; -import { ZeroEx } from '../src/0x'; +import { artifacts } from '../src/artifacts'; import { ExpirationWatcher } from '../src/order_watcher/expiration_watcher'; -import { DoneCallback, Token } from '../src/types'; import { utils } from '../src/utils/utils'; import { chaiSetup } from './utils/chai_setup'; import { constants } from './utils/constants'; -import { FillScenarios } from './utils/fill_scenarios'; -import { reportNoErrorCallbackErrors } from './utils/report_callback_errors'; import { TokenUtils } from './utils/token_utils'; import { provider, web3Wrapper } from './utils/web3_wrapper'; @@ -22,7 +23,7 @@ const expect = chai.expect; const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); describe('ExpirationWatcher', () => { - let zeroEx: ZeroEx; + let contractWrappers: ContractWrappers; let tokenUtils: TokenUtils; let tokens: Token[]; let userAddresses: string[]; @@ -43,15 +44,15 @@ describe('ExpirationWatcher', () => { const config = { networkId: constants.TESTRPC_NETWORK_ID, }; - zeroEx = new ZeroEx(provider, config); - exchangeContractAddress = zeroEx.exchange.getContractAddress(); - userAddresses = await zeroEx.getAvailableAddressesAsync(); - tokens = await zeroEx.tokenRegistry.getTokensAsync(); + contractWrappers = new ContractWrappers(provider, config); + exchangeContractAddress = contractWrappers.exchange.getContractAddress(); + userAddresses = await web3Wrapper.getAvailableAddressesAsync(); + tokens = await contractWrappers.tokenRegistry.getTokensAsync(); tokenUtils = new TokenUtils(tokens); zrxTokenAddress = tokenUtils.getProtocolTokenOrThrow().address; - fillScenarios = new FillScenarios(zeroEx, userAddresses, tokens, zrxTokenAddress, exchangeContractAddress); + fillScenarios = new FillScenarios(provider, userAddresses, tokens, zrxTokenAddress, exchangeContractAddress); [coinbase, makerAddress, takerAddress, feeRecipient] = userAddresses; - tokens = await zeroEx.tokenRegistry.getTokensAsync(); + tokens = await contractWrappers.tokenRegistry.getTokensAsync(); const [makerToken, takerToken] = tokenUtils.getDummyTokens(); makerTokenAddress = makerToken.address; takerTokenAddress = takerToken.address; @@ -81,9 +82,9 @@ describe('ExpirationWatcher', () => { fillableAmount, expirationUnixTimestampSec, ); - const orderHash = ZeroEx.getOrderHashHex(signedOrder); + const orderHash = getOrderHashHex(signedOrder); expirationWatcher.addOrder(orderHash, signedOrder.expirationUnixTimestampSec.times(1000)); - const callbackAsync = reportNoErrorCallbackErrors(done)((hash: string) => { + const callbackAsync = callbackErrorReporter.reportNoErrorCallbackErrors(done)((hash: string) => { expect(hash).to.be.equal(orderHash); expect(utils.getCurrentUnixTimestampSec()).to.be.bignumber.gte(expirationUnixTimestampSec); }); @@ -103,9 +104,9 @@ describe('ExpirationWatcher', () => { fillableAmount, expirationUnixTimestampSec, ); - const orderHash = ZeroEx.getOrderHashHex(signedOrder); + const orderHash = getOrderHashHex(signedOrder); expirationWatcher.addOrder(orderHash, signedOrder.expirationUnixTimestampSec.times(1000)); - const callbackAsync = reportNoErrorCallbackErrors(done)(async (hash: string) => { + const callbackAsync = callbackErrorReporter.reportNoErrorCallbackErrors(done)(async (hash: string) => { done(new Error('Emitted expiration went before the order actually expired')); }); expirationWatcher.subscribe(callbackAsync); @@ -136,19 +137,21 @@ describe('ExpirationWatcher', () => { fillableAmount, order2ExpirationUnixTimestampSec, ); - const orderHash1 = ZeroEx.getOrderHashHex(signedOrder1); - const orderHash2 = ZeroEx.getOrderHashHex(signedOrder2); + const orderHash1 = getOrderHashHex(signedOrder1); + const orderHash2 = getOrderHashHex(signedOrder2); expirationWatcher.addOrder(orderHash2, signedOrder2.expirationUnixTimestampSec.times(1000)); expirationWatcher.addOrder(orderHash1, signedOrder1.expirationUnixTimestampSec.times(1000)); const expirationOrder = [orderHash1, orderHash2]; const expectToBeCalledOnce = false; - const callbackAsync = reportNoErrorCallbackErrors(done, expectToBeCalledOnce)((hash: string) => { - const orderHash = expirationOrder.shift(); - expect(hash).to.be.equal(orderHash); - if (_.isEmpty(expirationOrder)) { - done(); - } - }); + const callbackAsync = callbackErrorReporter.reportNoErrorCallbackErrors(done, expectToBeCalledOnce)( + (hash: string) => { + const orderHash = expirationOrder.shift(); + expect(hash).to.be.equal(orderHash); + if (_.isEmpty(expirationOrder)) { + done(); + } + }, + ); expirationWatcher.subscribe(callbackAsync); timer.tick(order2Lifetime * 1000); })().catch(done); @@ -175,19 +178,21 @@ describe('ExpirationWatcher', () => { fillableAmount, order2ExpirationUnixTimestampSec, ); - const orderHash1 = ZeroEx.getOrderHashHex(signedOrder1); - const orderHash2 = ZeroEx.getOrderHashHex(signedOrder2); + const orderHash1 = getOrderHashHex(signedOrder1); + const orderHash2 = getOrderHashHex(signedOrder2); expirationWatcher.addOrder(orderHash1, signedOrder1.expirationUnixTimestampSec.times(1000)); expirationWatcher.addOrder(orderHash2, signedOrder2.expirationUnixTimestampSec.times(1000)); const expirationOrder = orderHash1 < orderHash2 ? [orderHash1, orderHash2] : [orderHash2, orderHash1]; const expectToBeCalledOnce = false; - const callbackAsync = reportNoErrorCallbackErrors(done, expectToBeCalledOnce)((hash: string) => { - const orderHash = expirationOrder.shift(); - expect(hash).to.be.equal(orderHash); - if (_.isEmpty(expirationOrder)) { - done(); - } - }); + const callbackAsync = callbackErrorReporter.reportNoErrorCallbackErrors(done, expectToBeCalledOnce)( + (hash: string) => { + const orderHash = expirationOrder.shift(); + expect(hash).to.be.equal(orderHash); + if (_.isEmpty(expirationOrder)) { + done(); + } + }, + ); expirationWatcher.subscribe(callbackAsync); timer.tick(order2Lifetime * 1000); })().catch(done); diff --git a/packages/order-watcher/test/global_hooks.ts b/packages/order-watcher/test/global_hooks.ts new file mode 100644 index 000000000..e3c986524 --- /dev/null +++ b/packages/order-watcher/test/global_hooks.ts @@ -0,0 +1,7 @@ +import { runMigrationsAsync } from '@0xproject/migrations'; + +import { deployer } from './utils/deployer'; + +before('migrate contracts', async () => { + await runMigrationsAsync(deployer); +}); diff --git a/packages/0x.js/test/order_state_watcher_test.ts b/packages/order-watcher/test/order_watcher_test.ts index 45a292c8b..8c9249f58 100644 --- a/packages/0x.js/test/order_state_watcher_test.ts +++ b/packages/order-watcher/test/order_watcher_test.ts @@ -1,26 +1,27 @@ -import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils'; -import { BigNumber } from '@0xproject/utils'; -import * as chai from 'chai'; -import * as _ from 'lodash'; -import 'mocha'; - +import { ContractWrappers } from '@0xproject/contract-wrappers'; +import { BlockchainLifecycle, callbackErrorReporter, devConstants } from '@0xproject/dev-utils'; +import { FillScenarios } from '@0xproject/fill-scenarios'; +import { getOrderHashHex } from '@0xproject/order-utils'; import { + DoneCallback, ExchangeContractErrs, OrderState, OrderStateInvalid, OrderStateValid, SignedOrder, Token, - ZeroEx, - ZeroExError, -} from '../src'; -import { OrderStateWatcher } from '../src/order_watcher/order_state_watcher'; -import { DoneCallback } from '../src/types'; +} from '@0xproject/types'; +import { BigNumber } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import * as chai from 'chai'; +import * as _ from 'lodash'; +import 'mocha'; + +import { OrderWatcher } from '../src/order_watcher/order_watcher'; +import { OrderWatcherError } from '../src/types'; import { chaiSetup } from './utils/chai_setup'; import { constants } from './utils/constants'; -import { FillScenarios } from './utils/fill_scenarios'; -import { reportNodeCallbackErrors } from './utils/report_callback_errors'; import { TokenUtils } from './utils/token_utils'; import { provider, web3Wrapper } from './utils/web3_wrapper'; @@ -30,8 +31,8 @@ chaiSetup.configure(); const expect = chai.expect; const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); -describe('OrderStateWatcher', () => { - let zeroEx: ZeroEx; +describe('OrderWatcher', () => { + let contractWrappers: ContractWrappers; let tokens: Token[]; let tokenUtils: TokenUtils; let fillScenarios: FillScenarios; @@ -43,22 +44,23 @@ describe('OrderStateWatcher', () => { let maker: string; let taker: string; let signedOrder: SignedOrder; - let orderStateWatcher: OrderStateWatcher; + let orderWatcher: OrderWatcher; const config = { networkId: constants.TESTRPC_NETWORK_ID, }; const decimals = constants.ZRX_DECIMALS; - const fillableAmount = ZeroEx.toBaseUnitAmount(new BigNumber(5), decimals); + const fillableAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(5), decimals); before(async () => { - zeroEx = new ZeroEx(provider, config); - orderStateWatcher = zeroEx.createOrderStateWatcher(); - exchangeContractAddress = zeroEx.exchange.getContractAddress(); - userAddresses = await zeroEx.getAvailableAddressesAsync(); + contractWrappers = new ContractWrappers(provider, config); + const networkId = await web3Wrapper.getNetworkIdAsync(); + orderWatcher = new OrderWatcher(provider, constants.TESTRPC_NETWORK_ID); + exchangeContractAddress = contractWrappers.exchange.getContractAddress(); + userAddresses = await web3Wrapper.getAvailableAddressesAsync(); [, maker, taker] = userAddresses; - tokens = await zeroEx.tokenRegistry.getTokensAsync(); + tokens = await contractWrappers.tokenRegistry.getTokensAsync(); tokenUtils = new TokenUtils(tokens); zrxTokenAddress = tokenUtils.getProtocolTokenOrThrow().address; - fillScenarios = new FillScenarios(zeroEx, userAddresses, tokens, zrxTokenAddress, exchangeContractAddress); + fillScenarios = new FillScenarios(provider, userAddresses, tokens, zrxTokenAddress, exchangeContractAddress); await fillScenarios.initTokenBalancesAsync(); [makerToken, takerToken] = tokenUtils.getDummyTokens(); }); @@ -77,18 +79,18 @@ describe('OrderStateWatcher', () => { taker, fillableAmount, ); - const orderHash = ZeroEx.getOrderHashHex(signedOrder); - orderStateWatcher.addOrder(signedOrder); - expect((orderStateWatcher as any)._orderByOrderHash).to.include({ + const orderHash = getOrderHashHex(signedOrder); + orderWatcher.addOrder(signedOrder); + expect((orderWatcher as any)._orderByOrderHash).to.include({ [orderHash]: signedOrder, }); - let dependentOrderHashes = (orderStateWatcher as any)._dependentOrderHashes; + let dependentOrderHashes = (orderWatcher as any)._dependentOrderHashes; expect(dependentOrderHashes[signedOrder.maker][signedOrder.makerTokenAddress]).to.have.keys(orderHash); - orderStateWatcher.removeOrder(orderHash); - expect((orderStateWatcher as any)._orderByOrderHash).to.not.include({ + orderWatcher.removeOrder(orderHash); + expect((orderWatcher as any)._orderByOrderHash).to.not.include({ [orderHash]: signedOrder, }); - dependentOrderHashes = (orderStateWatcher as any)._dependentOrderHashes; + dependentOrderHashes = (orderWatcher as any)._dependentOrderHashes; expect(dependentOrderHashes[signedOrder.maker]).to.be.undefined(); }); it('should no-op when removing a non-existing order', async () => { @@ -99,29 +101,29 @@ describe('OrderStateWatcher', () => { taker, fillableAmount, ); - const orderHash = ZeroEx.getOrderHashHex(signedOrder); + const orderHash = getOrderHashHex(signedOrder); const nonExistentOrderHash = `0x${orderHash .substr(2) .split('') .reverse() .join('')}`; - orderStateWatcher.removeOrder(nonExistentOrderHash); + orderWatcher.removeOrder(nonExistentOrderHash); }); }); describe('#subscribe', async () => { afterEach(async () => { - orderStateWatcher.unsubscribe(); + orderWatcher.unsubscribe(); }); it('should fail when trying to subscribe twice', async () => { - orderStateWatcher.subscribe(_.noop); - expect(() => orderStateWatcher.subscribe(_.noop)).to.throw(ZeroExError.SubscriptionAlreadyPresent); + orderWatcher.subscribe(_.noop); + expect(() => orderWatcher.subscribe(_.noop)).to.throw(OrderWatcherError.SubscriptionAlreadyPresent); }); }); describe('tests with cleanup', async () => { afterEach(async () => { - orderStateWatcher.unsubscribe(); - const orderHash = ZeroEx.getOrderHashHex(signedOrder); - orderStateWatcher.removeOrder(orderHash); + orderWatcher.unsubscribe(); + const orderHash = getOrderHashHex(signedOrder); + orderWatcher.removeOrder(orderHash); }); it('should emit orderStateInvalid when maker allowance set to 0 for watched order', (done: DoneCallback) => { (async () => { @@ -132,16 +134,16 @@ describe('OrderStateWatcher', () => { taker, fillableAmount, ); - const orderHash = ZeroEx.getOrderHashHex(signedOrder); - orderStateWatcher.addOrder(signedOrder); - const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => { + const orderHash = getOrderHashHex(signedOrder); + orderWatcher.addOrder(signedOrder); + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.false(); const invalidOrderState = orderState as OrderStateInvalid; expect(invalidOrderState.orderHash).to.be.equal(orderHash); expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.InsufficientMakerAllowance); }); - orderStateWatcher.subscribe(callback); - await zeroEx.token.setProxyAllowanceAsync(makerToken.address, maker, new BigNumber(0)); + orderWatcher.subscribe(callback); + await contractWrappers.token.setProxyAllowanceAsync(makerToken.address, maker, new BigNumber(0)); })().catch(done); }); it('should not emit an orderState event when irrelevant Transfer event received', (done: DoneCallback) => { @@ -153,15 +155,20 @@ describe('OrderStateWatcher', () => { taker, fillableAmount, ); - orderStateWatcher.addOrder(signedOrder); - const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => { + orderWatcher.addOrder(signedOrder); + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { throw new Error('OrderState callback fired for irrelevant order'); }); - orderStateWatcher.subscribe(callback); + orderWatcher.subscribe(callback); const notTheMaker = userAddresses[0]; const anyRecipient = taker; const transferAmount = new BigNumber(2); - await zeroEx.token.transferAsync(makerToken.address, notTheMaker, anyRecipient, transferAmount); + await contractWrappers.token.transferAsync( + makerToken.address, + notTheMaker, + anyRecipient, + transferAmount, + ); setTimeout(() => { done(); }, TIMEOUT_MS); @@ -176,18 +183,18 @@ describe('OrderStateWatcher', () => { taker, fillableAmount, ); - const orderHash = ZeroEx.getOrderHashHex(signedOrder); - orderStateWatcher.addOrder(signedOrder); - const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => { + const orderHash = getOrderHashHex(signedOrder); + orderWatcher.addOrder(signedOrder); + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.false(); const invalidOrderState = orderState as OrderStateInvalid; expect(invalidOrderState.orderHash).to.be.equal(orderHash); expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.InsufficientMakerBalance); }); - orderStateWatcher.subscribe(callback); + orderWatcher.subscribe(callback); const anyRecipient = taker; - const makerBalance = await zeroEx.token.getBalanceAsync(makerToken.address, maker); - await zeroEx.token.transferAsync(makerToken.address, maker, anyRecipient, makerBalance); + const makerBalance = await contractWrappers.token.getBalanceAsync(makerToken.address, maker); + await contractWrappers.token.transferAsync(makerToken.address, maker, anyRecipient, makerBalance); })().catch(done); }); it('should emit orderStateInvalid when watched order fully filled', (done: DoneCallback) => { @@ -199,19 +206,19 @@ describe('OrderStateWatcher', () => { taker, fillableAmount, ); - const orderHash = ZeroEx.getOrderHashHex(signedOrder); - orderStateWatcher.addOrder(signedOrder); + const orderHash = getOrderHashHex(signedOrder); + orderWatcher.addOrder(signedOrder); - const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => { + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.false(); const invalidOrderState = orderState as OrderStateInvalid; expect(invalidOrderState.orderHash).to.be.equal(orderHash); expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.OrderRemainingFillAmountZero); }); - orderStateWatcher.subscribe(callback); + orderWatcher.subscribe(callback); const shouldThrowOnInsufficientBalanceOrAllowance = true; - await zeroEx.exchange.fillOrderAsync( + await contractWrappers.exchange.fillOrderAsync( signedOrder, fillableAmount, shouldThrowOnInsufficientBalanceOrAllowance, @@ -229,12 +236,12 @@ describe('OrderStateWatcher', () => { fillableAmount, ); - const makerBalance = await zeroEx.token.getBalanceAsync(makerToken.address, maker); + const makerBalance = await contractWrappers.token.getBalanceAsync(makerToken.address, maker); const fillAmountInBaseUnits = new BigNumber(2); - const orderHash = ZeroEx.getOrderHashHex(signedOrder); - orderStateWatcher.addOrder(signedOrder); + const orderHash = getOrderHashHex(signedOrder); + orderWatcher.addOrder(signedOrder); - const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => { + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.true(); const validOrderState = orderState as OrderStateValid; expect(validOrderState.orderHash).to.be.equal(orderHash); @@ -249,9 +256,9 @@ describe('OrderStateWatcher', () => { ); expect(orderRelevantState.makerBalance).to.be.bignumber.equal(remainingMakerBalance); }); - orderStateWatcher.subscribe(callback); + orderWatcher.subscribe(callback); const shouldThrowOnInsufficientBalanceOrAllowance = true; - await zeroEx.exchange.fillOrderAsync( + await contractWrappers.exchange.fillOrderAsync( signedOrder, fillAmountInBaseUnits, shouldThrowOnInsufficientBalanceOrAllowance, @@ -261,8 +268,8 @@ describe('OrderStateWatcher', () => { }); it('should trigger the callback when orders backing ZRX allowance changes', (done: DoneCallback) => { (async () => { - const makerFee = ZeroEx.toBaseUnitAmount(new BigNumber(2), 18); - const takerFee = ZeroEx.toBaseUnitAmount(new BigNumber(0), 18); + const makerFee = Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18); + const takerFee = Web3Wrapper.toBaseUnitAmount(new BigNumber(0), 18); signedOrder = await fillScenarios.createFillableSignedOrderWithFeesAsync( makerToken.address, takerToken.address, @@ -273,17 +280,17 @@ describe('OrderStateWatcher', () => { fillableAmount, taker, ); - const callback = reportNodeCallbackErrors(done)(); - orderStateWatcher.addOrder(signedOrder); - orderStateWatcher.subscribe(callback); - await zeroEx.token.setProxyAllowanceAsync(zrxTokenAddress, maker, new BigNumber(0)); + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)(); + orderWatcher.addOrder(signedOrder); + orderWatcher.subscribe(callback); + await contractWrappers.token.setProxyAllowanceAsync(zrxTokenAddress, maker, new BigNumber(0)); })().catch(done); }); describe('remainingFillable(M|T)akerTokenAmount', () => { it('should calculate correct remaining fillable', (done: DoneCallback) => { (async () => { - const takerFillableAmount = ZeroEx.toBaseUnitAmount(new BigNumber(10), decimals); - const makerFillableAmount = ZeroEx.toBaseUnitAmount(new BigNumber(20), decimals); + const takerFillableAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(10), decimals); + const makerFillableAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(20), decimals); signedOrder = await fillScenarios.createAsymmetricFillableSignedOrderAsync( makerToken.address, takerToken.address, @@ -292,24 +299,24 @@ describe('OrderStateWatcher', () => { makerFillableAmount, takerFillableAmount, ); - const fillAmountInBaseUnits = ZeroEx.toBaseUnitAmount(new BigNumber(2), decimals); - const orderHash = ZeroEx.getOrderHashHex(signedOrder); - orderStateWatcher.addOrder(signedOrder); - const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => { + const fillAmountInBaseUnits = Web3Wrapper.toBaseUnitAmount(new BigNumber(2), decimals); + const orderHash = getOrderHashHex(signedOrder); + orderWatcher.addOrder(signedOrder); + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.true(); const validOrderState = orderState as OrderStateValid; expect(validOrderState.orderHash).to.be.equal(orderHash); const orderRelevantState = validOrderState.orderRelevantState; expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal( - ZeroEx.toBaseUnitAmount(new BigNumber(16), decimals), + Web3Wrapper.toBaseUnitAmount(new BigNumber(16), decimals), ); expect(orderRelevantState.remainingFillableTakerTokenAmount).to.be.bignumber.equal( - ZeroEx.toBaseUnitAmount(new BigNumber(8), decimals), + Web3Wrapper.toBaseUnitAmount(new BigNumber(8), decimals), ); }); - orderStateWatcher.subscribe(callback); + orderWatcher.subscribe(callback); const shouldThrowOnInsufficientBalanceOrAllowance = true; - await zeroEx.exchange.fillOrderAsync( + await contractWrappers.exchange.fillOrderAsync( signedOrder, fillAmountInBaseUnits, shouldThrowOnInsufficientBalanceOrAllowance, @@ -327,10 +334,10 @@ describe('OrderStateWatcher', () => { fillableAmount, ); - const changedMakerApprovalAmount = ZeroEx.toBaseUnitAmount(new BigNumber(3), decimals); - orderStateWatcher.addOrder(signedOrder); + const changedMakerApprovalAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(3), decimals); + orderWatcher.addOrder(signedOrder); - const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => { + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { const validOrderState = orderState as OrderStateValid; const orderRelevantState = validOrderState.orderRelevantState; expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal( @@ -340,8 +347,12 @@ describe('OrderStateWatcher', () => { changedMakerApprovalAmount, ); }); - orderStateWatcher.subscribe(callback); - await zeroEx.token.setProxyAllowanceAsync(makerToken.address, maker, changedMakerApprovalAmount); + orderWatcher.subscribe(callback); + await contractWrappers.token.setProxyAllowanceAsync( + makerToken.address, + maker, + changedMakerApprovalAmount, + ); })().catch(done); }); it('should equal balance amount when balance amount is lowest', (done: DoneCallback) => { @@ -354,13 +365,13 @@ describe('OrderStateWatcher', () => { fillableAmount, ); - const makerBalance = await zeroEx.token.getBalanceAsync(makerToken.address, maker); + const makerBalance = await contractWrappers.token.getBalanceAsync(makerToken.address, maker); - const remainingAmount = ZeroEx.toBaseUnitAmount(new BigNumber(1), decimals); + const remainingAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(1), decimals); const transferAmount = makerBalance.sub(remainingAmount); - orderStateWatcher.addOrder(signedOrder); + orderWatcher.addOrder(signedOrder); - const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => { + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.true(); const validOrderState = orderState as OrderStateValid; const orderRelevantState = validOrderState.orderRelevantState; @@ -371,14 +382,19 @@ describe('OrderStateWatcher', () => { remainingAmount, ); }); - orderStateWatcher.subscribe(callback); - await zeroEx.token.transferAsync(makerToken.address, maker, ZeroEx.NULL_ADDRESS, transferAmount); + orderWatcher.subscribe(callback); + await contractWrappers.token.transferAsync( + makerToken.address, + maker, + constants.NULL_ADDRESS, + transferAmount, + ); })().catch(done); }); it('should equal remaining amount when partially cancelled and order has fees', (done: DoneCallback) => { (async () => { - const takerFee = ZeroEx.toBaseUnitAmount(new BigNumber(0), decimals); - const makerFee = ZeroEx.toBaseUnitAmount(new BigNumber(5), decimals); + const takerFee = Web3Wrapper.toBaseUnitAmount(new BigNumber(0), decimals); + const makerFee = Web3Wrapper.toBaseUnitAmount(new BigNumber(5), decimals); const feeRecipient = taker; signedOrder = await fillScenarios.createFillableSignedOrderWithFeesAsync( makerToken.address, @@ -391,11 +407,11 @@ describe('OrderStateWatcher', () => { feeRecipient, ); - const remainingTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(4), decimals); + const remainingTokenAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(4), decimals); const transferTokenAmount = makerFee.sub(remainingTokenAmount); - orderStateWatcher.addOrder(signedOrder); + orderWatcher.addOrder(signedOrder); - const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => { + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.true(); const validOrderState = orderState as OrderStateValid; const orderRelevantState = validOrderState.orderRelevantState; @@ -403,14 +419,14 @@ describe('OrderStateWatcher', () => { remainingTokenAmount, ); }); - orderStateWatcher.subscribe(callback); - await zeroEx.exchange.cancelOrderAsync(signedOrder, transferTokenAmount); + orderWatcher.subscribe(callback); + await contractWrappers.exchange.cancelOrderAsync(signedOrder, transferTokenAmount); })().catch(done); }); it('should equal ratio amount when fee balance is lowered', (done: DoneCallback) => { (async () => { - const takerFee = ZeroEx.toBaseUnitAmount(new BigNumber(0), decimals); - const makerFee = ZeroEx.toBaseUnitAmount(new BigNumber(5), decimals); + const takerFee = Web3Wrapper.toBaseUnitAmount(new BigNumber(0), decimals); + const makerFee = Web3Wrapper.toBaseUnitAmount(new BigNumber(5), decimals); const feeRecipient = taker; signedOrder = await fillScenarios.createFillableSignedOrderWithFeesAsync( makerToken.address, @@ -423,33 +439,33 @@ describe('OrderStateWatcher', () => { feeRecipient, ); - const remainingFeeAmount = ZeroEx.toBaseUnitAmount(new BigNumber(3), decimals); + const remainingFeeAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(3), decimals); - const remainingTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(4), decimals); + const remainingTokenAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(4), decimals); const transferTokenAmount = makerFee.sub(remainingTokenAmount); - orderStateWatcher.addOrder(signedOrder); + orderWatcher.addOrder(signedOrder); - const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => { + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { const validOrderState = orderState as OrderStateValid; const orderRelevantState = validOrderState.orderRelevantState; expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal( remainingFeeAmount, ); }); - orderStateWatcher.subscribe(callback); - await zeroEx.token.setProxyAllowanceAsync(zrxTokenAddress, maker, remainingFeeAmount); - await zeroEx.token.transferAsync( + orderWatcher.subscribe(callback); + await contractWrappers.token.setProxyAllowanceAsync(zrxTokenAddress, maker, remainingFeeAmount); + await contractWrappers.token.transferAsync( makerToken.address, maker, - ZeroEx.NULL_ADDRESS, + constants.NULL_ADDRESS, transferTokenAmount, ); })().catch(done); }); it('should calculate full amount when all available and non-divisible', (done: DoneCallback) => { (async () => { - const takerFee = ZeroEx.toBaseUnitAmount(new BigNumber(0), decimals); - const makerFee = ZeroEx.toBaseUnitAmount(new BigNumber(2), decimals); + const takerFee = Web3Wrapper.toBaseUnitAmount(new BigNumber(0), decimals); + const makerFee = Web3Wrapper.toBaseUnitAmount(new BigNumber(2), decimals); const feeRecipient = taker; signedOrder = await fillScenarios.createFillableSignedOrderWithFeesAsync( makerToken.address, @@ -462,20 +478,20 @@ describe('OrderStateWatcher', () => { feeRecipient, ); - orderStateWatcher.addOrder(signedOrder); + orderWatcher.addOrder(signedOrder); - const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => { + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { const validOrderState = orderState as OrderStateValid; const orderRelevantState = validOrderState.orderRelevantState; expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal( fillableAmount, ); }); - orderStateWatcher.subscribe(callback); - await zeroEx.token.setProxyAllowanceAsync( + orderWatcher.subscribe(callback); + await contractWrappers.token.setProxyAllowanceAsync( makerToken.address, maker, - ZeroEx.toBaseUnitAmount(new BigNumber(100), decimals), + Web3Wrapper.toBaseUnitAmount(new BigNumber(100), decimals), ); })().catch(done); }); @@ -489,18 +505,18 @@ describe('OrderStateWatcher', () => { taker, fillableAmount, ); - const orderHash = ZeroEx.getOrderHashHex(signedOrder); - orderStateWatcher.addOrder(signedOrder); + const orderHash = getOrderHashHex(signedOrder); + orderWatcher.addOrder(signedOrder); - const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => { + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.false(); const invalidOrderState = orderState as OrderStateInvalid; expect(invalidOrderState.orderHash).to.be.equal(orderHash); expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.OrderRemainingFillAmountZero); }); - orderStateWatcher.subscribe(callback); + orderWatcher.subscribe(callback); - await zeroEx.exchange.cancelOrderAsync(signedOrder, fillableAmount); + await contractWrappers.exchange.cancelOrderAsync(signedOrder, fillableAmount); })().catch(done); }); it('should emit orderStateInvalid when within rounding error range', (done: DoneCallback) => { @@ -513,17 +529,17 @@ describe('OrderStateWatcher', () => { taker, fillableAmount, ); - const orderHash = ZeroEx.getOrderHashHex(signedOrder); - orderStateWatcher.addOrder(signedOrder); + const orderHash = getOrderHashHex(signedOrder); + orderWatcher.addOrder(signedOrder); - const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => { + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.false(); const invalidOrderState = orderState as OrderStateInvalid; expect(invalidOrderState.orderHash).to.be.equal(orderHash); expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.OrderFillRoundingError); }); - orderStateWatcher.subscribe(callback); - await zeroEx.exchange.cancelOrderAsync( + orderWatcher.subscribe(callback); + await contractWrappers.exchange.cancelOrderAsync( signedOrder, fillableAmount.minus(remainingFillableAmountInBaseUnits), ); @@ -540,18 +556,18 @@ describe('OrderStateWatcher', () => { ); const cancelAmountInBaseUnits = new BigNumber(2); - const orderHash = ZeroEx.getOrderHashHex(signedOrder); - orderStateWatcher.addOrder(signedOrder); + const orderHash = getOrderHashHex(signedOrder); + orderWatcher.addOrder(signedOrder); - const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => { + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.true(); const validOrderState = orderState as OrderStateValid; expect(validOrderState.orderHash).to.be.equal(orderHash); const orderRelevantState = validOrderState.orderRelevantState; expect(orderRelevantState.cancelledTakerTokenAmount).to.be.bignumber.equal(cancelAmountInBaseUnits); }); - orderStateWatcher.subscribe(callback); - await zeroEx.exchange.cancelOrderAsync(signedOrder, cancelAmountInBaseUnits); + orderWatcher.subscribe(callback); + await contractWrappers.exchange.cancelOrderAsync(signedOrder, cancelAmountInBaseUnits); })().catch(done); }); }); diff --git a/packages/0x.js/test/remaining_fillable_calculator_test.ts b/packages/order-watcher/test/remaining_fillable_calculator_test.ts index d97402ef6..7ec3f1ebc 100644 --- a/packages/0x.js/test/remaining_fillable_calculator_test.ts +++ b/packages/order-watcher/test/remaining_fillable_calculator_test.ts @@ -1,10 +1,10 @@ import { ECSignature, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; import 'mocha'; -import { ZeroEx } from '../src/0x'; -import { RemainingFillableCalculator } from '../src/order_watcher/remaining_fillable_calculator'; +import { RemainingFillableCalculator } from '@0xproject/order-utils'; import { chaiSetup } from './utils/chai_setup'; @@ -29,13 +29,13 @@ describe('RemainingFillableCalculator', () => { const signature: ECSignature = { v: 27, r: '', s: '' }; beforeEach(async () => { [makerAmount, takerAmount, makerFeeAmount] = [ - ZeroEx.toBaseUnitAmount(new BigNumber(50), decimals), - ZeroEx.toBaseUnitAmount(new BigNumber(5), decimals), - ZeroEx.toBaseUnitAmount(new BigNumber(1), decimals), + Web3Wrapper.toBaseUnitAmount(new BigNumber(50), decimals), + Web3Wrapper.toBaseUnitAmount(new BigNumber(5), decimals), + Web3Wrapper.toBaseUnitAmount(new BigNumber(1), decimals), ]; [transferrableMakerTokenAmount, transferrableMakerFeeTokenAmount] = [ - ZeroEx.toBaseUnitAmount(new BigNumber(50), decimals), - ZeroEx.toBaseUnitAmount(new BigNumber(5), decimals), + Web3Wrapper.toBaseUnitAmount(new BigNumber(50), decimals), + Web3Wrapper.toBaseUnitAmount(new BigNumber(5), decimals), ]; }); function buildSignedOrder(): SignedOrder { @@ -73,7 +73,7 @@ describe('RemainingFillableCalculator', () => { }); it('calculates the correct amount when partially filled and funds available', () => { signedOrder = buildSignedOrder(); - remainingMakerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(1), decimals); + remainingMakerTokenAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(1), decimals); calculator = new RemainingFillableCalculator( signedOrder, isMakerTokenZRX, @@ -98,7 +98,7 @@ describe('RemainingFillableCalculator', () => { }); it('calculates the correct amount when balance is less than remaining fillable', () => { signedOrder = buildSignedOrder(); - const partiallyFilledAmount = ZeroEx.toBaseUnitAmount(new BigNumber(2), decimals); + const partiallyFilledAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(2), decimals); remainingMakerTokenAmount = signedOrder.makerTokenAmount.minus(partiallyFilledAmount); transferrableMakerTokenAmount = remainingMakerTokenAmount.minus(partiallyFilledAmount); calculator = new RemainingFillableCalculator( @@ -113,15 +113,15 @@ describe('RemainingFillableCalculator', () => { describe('Order to Fee Ratio is < 1', () => { beforeEach(async () => { [makerAmount, takerAmount, makerFeeAmount] = [ - ZeroEx.toBaseUnitAmount(new BigNumber(3), decimals), - ZeroEx.toBaseUnitAmount(new BigNumber(6), decimals), - ZeroEx.toBaseUnitAmount(new BigNumber(6), decimals), + Web3Wrapper.toBaseUnitAmount(new BigNumber(3), decimals), + Web3Wrapper.toBaseUnitAmount(new BigNumber(6), decimals), + Web3Wrapper.toBaseUnitAmount(new BigNumber(6), decimals), ]; }); it('calculates the correct amount when funds unavailable', () => { signedOrder = buildSignedOrder(); remainingMakerTokenAmount = signedOrder.makerTokenAmount; - const transferredAmount = ZeroEx.toBaseUnitAmount(new BigNumber(2), decimals); + const transferredAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(2), decimals); transferrableMakerTokenAmount = remainingMakerTokenAmount.minus(transferredAmount); calculator = new RemainingFillableCalculator( signedOrder, @@ -136,15 +136,15 @@ describe('RemainingFillableCalculator', () => { describe('Ratio is not evenly divisble', () => { beforeEach(async () => { [makerAmount, takerAmount, makerFeeAmount] = [ - ZeroEx.toBaseUnitAmount(new BigNumber(3), decimals), - ZeroEx.toBaseUnitAmount(new BigNumber(7), decimals), - ZeroEx.toBaseUnitAmount(new BigNumber(7), decimals), + Web3Wrapper.toBaseUnitAmount(new BigNumber(3), decimals), + Web3Wrapper.toBaseUnitAmount(new BigNumber(7), decimals), + Web3Wrapper.toBaseUnitAmount(new BigNumber(7), decimals), ]; }); it('calculates the correct amount when funds unavailable', () => { signedOrder = buildSignedOrder(); remainingMakerTokenAmount = signedOrder.makerTokenAmount; - const transferredAmount = ZeroEx.toBaseUnitAmount(new BigNumber(2), decimals); + const transferredAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(2), decimals); transferrableMakerTokenAmount = remainingMakerTokenAmount.minus(transferredAmount); calculator = new RemainingFillableCalculator( signedOrder, @@ -182,7 +182,7 @@ describe('RemainingFillableCalculator', () => { }); it('calculates the correct amount when partially filled and funds available', () => { signedOrder = buildSignedOrder(); - remainingMakerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(1), decimals); + remainingMakerTokenAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(1), decimals); calculator = new RemainingFillableCalculator( signedOrder, isMakerTokenZRX, @@ -208,7 +208,7 @@ describe('RemainingFillableCalculator', () => { }); it('calculates the correct amount when balance is less than remaining fillable', () => { signedOrder = buildSignedOrder(); - const partiallyFilledAmount = ZeroEx.toBaseUnitAmount(new BigNumber(2), decimals); + const partiallyFilledAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(2), decimals); remainingMakerTokenAmount = signedOrder.makerTokenAmount.minus(partiallyFilledAmount); transferrableMakerTokenAmount = remainingMakerTokenAmount.minus(partiallyFilledAmount); transferrableMakerFeeTokenAmount = transferrableMakerTokenAmount; diff --git a/packages/order-watcher/test/utils/chai_setup.ts b/packages/order-watcher/test/utils/chai_setup.ts new file mode 100644 index 000000000..078edd309 --- /dev/null +++ b/packages/order-watcher/test/utils/chai_setup.ts @@ -0,0 +1,13 @@ +import * as chai from 'chai'; +import chaiAsPromised = require('chai-as-promised'); +import ChaiBigNumber = require('chai-bignumber'); +import * as dirtyChai from 'dirty-chai'; + +export const chaiSetup = { + configure() { + chai.config.includeStack = true; + chai.use(ChaiBigNumber()); + chai.use(dirtyChai); + chai.use(chaiAsPromised); + }, +}; diff --git a/packages/order-watcher/test/utils/constants.ts b/packages/order-watcher/test/utils/constants.ts new file mode 100644 index 000000000..78037647c --- /dev/null +++ b/packages/order-watcher/test/utils/constants.ts @@ -0,0 +1,5 @@ +export const constants = { + NULL_ADDRESS: '0x0000000000000000000000000000000000000000', + TESTRPC_NETWORK_ID: 50, + ZRX_DECIMALS: 18, +}; diff --git a/packages/order-watcher/test/utils/deployer.ts b/packages/order-watcher/test/utils/deployer.ts new file mode 100644 index 000000000..b092322e2 --- /dev/null +++ b/packages/order-watcher/test/utils/deployer.ts @@ -0,0 +1,18 @@ +import { Deployer } from '@0xproject/deployer'; +import { devConstants } from '@0xproject/dev-utils'; +import * as path from 'path'; + +import { constants } from './constants'; + +import { provider } from './web3_wrapper'; + +const artifactsDir = path.resolve('test', 'artifacts'); +const deployerOpts = { + artifactsDir, + provider, + networkId: constants.TESTRPC_NETWORK_ID, + defaults: { + gas: devConstants.GAS_ESTIMATE, + }, +}; +export const deployer = new Deployer(deployerOpts); diff --git a/packages/order-watcher/test/utils/token_utils.ts b/packages/order-watcher/test/utils/token_utils.ts new file mode 100644 index 000000000..e1191b5bb --- /dev/null +++ b/packages/order-watcher/test/utils/token_utils.ts @@ -0,0 +1,34 @@ +import { Token } from '@0xproject/types'; +import * as _ from 'lodash'; + +import { InternalOrderWatcherError } from '../../src/types'; + +const PROTOCOL_TOKEN_SYMBOL = 'ZRX'; +const WETH_TOKEN_SYMBOL = 'WETH'; + +export class TokenUtils { + private _tokens: Token[]; + constructor(tokens: Token[]) { + this._tokens = tokens; + } + public getProtocolTokenOrThrow(): Token { + const zrxToken = _.find(this._tokens, { symbol: PROTOCOL_TOKEN_SYMBOL }); + if (_.isUndefined(zrxToken)) { + throw new Error(InternalOrderWatcherError.ZrxNotInTokenRegistry); + } + return zrxToken; + } + public getWethTokenOrThrow(): Token { + const wethToken = _.find(this._tokens, { symbol: WETH_TOKEN_SYMBOL }); + if (_.isUndefined(wethToken)) { + throw new Error(InternalOrderWatcherError.WethNotInTokenRegistry); + } + return wethToken; + } + public getDummyTokens(): Token[] { + const dummyTokens = _.filter(this._tokens, token => { + return !_.includes([PROTOCOL_TOKEN_SYMBOL, WETH_TOKEN_SYMBOL], token.symbol); + }); + return dummyTokens; + } +} diff --git a/packages/order-watcher/test/utils/web3_wrapper.ts b/packages/order-watcher/test/utils/web3_wrapper.ts new file mode 100644 index 000000000..b0ccfa546 --- /dev/null +++ b/packages/order-watcher/test/utils/web3_wrapper.ts @@ -0,0 +1,9 @@ +import { devConstants, web3Factory } from '@0xproject/dev-utils'; +import { Provider } from '@0xproject/types'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; + +const web3 = web3Factory.create({ shouldUseInProcessGanache: true }); +const provider: Provider = web3.currentProvider; +const web3Wrapper = new Web3Wrapper(web3.currentProvider); + +export { provider, web3Wrapper }; diff --git a/packages/order-watcher/tsconfig.json b/packages/order-watcher/tsconfig.json new file mode 100644 index 000000000..e35816553 --- /dev/null +++ b/packages/order-watcher/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig", + "compilerOptions": { + "outDir": "lib" + }, + "include": ["./src/**/*", "./test/**/*"] +} diff --git a/packages/order-watcher/tslint.json b/packages/order-watcher/tslint.json new file mode 100644 index 000000000..ffaefe83a --- /dev/null +++ b/packages/order-watcher/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": ["@0xproject/tslint-config"] +} diff --git a/packages/subproviders/test/integration/ledger_subprovider_test.ts b/packages/subproviders/test/integration/ledger_subprovider_test.ts index 0d6e67bd1..f1c634a77 100644 --- a/packages/subproviders/test/integration/ledger_subprovider_test.ts +++ b/packages/subproviders/test/integration/ledger_subprovider_test.ts @@ -1,4 +1,4 @@ -import { JSONRPCResponsePayload } from '@0xproject/types'; +import { DoneCallback, JSONRPCResponsePayload } from '@0xproject/types'; import { promisify } from '@0xproject/utils'; import Eth from '@ledgerhq/hw-app-eth'; // HACK: This dependency is optional and tslint skips optional dependencies @@ -12,7 +12,7 @@ import Web3ProviderEngine = require('web3-provider-engine'); import RpcSubprovider = require('web3-provider-engine/subproviders/rpc'); import { LedgerSubprovider } from '../../src'; -import { DoneCallback, LedgerEthereumClient } from '../../src/types'; +import { LedgerEthereumClient } from '../../src/types'; import { chaiSetup } from '../chai_setup'; import { fixtureData } from '../utils/fixture_data'; import { reportCallbackErrors } from '../utils/report_callback_errors'; diff --git a/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts b/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts index e25cb7eb7..9115186f4 100644 --- a/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts +++ b/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts @@ -1,4 +1,4 @@ -import { JSONRPCResponsePayload } from '@0xproject/types'; +import { DoneCallback, JSONRPCResponsePayload } from '@0xproject/types'; import * as chai from 'chai'; import * as _ from 'lodash'; import Web3 = require('web3'); @@ -7,7 +7,6 @@ import RpcSubprovider = require('web3-provider-engine/subproviders/rpc'); import { RedundantSubprovider } from '../../src'; import { Subprovider } from '../../src/subproviders/subprovider'; -import { DoneCallback } from '../../src/types'; import { chaiSetup } from '../chai_setup'; import { ganacheSubprovider } from '../utils/ganache_subprovider'; import { reportCallbackErrors } from '../utils/report_callback_errors'; diff --git a/packages/subproviders/test/utils/report_callback_errors.ts b/packages/subproviders/test/utils/report_callback_errors.ts index 8a8f4d966..eaefea7c3 100644 --- a/packages/subproviders/test/utils/report_callback_errors.ts +++ b/packages/subproviders/test/utils/report_callback_errors.ts @@ -1,4 +1,4 @@ -import { DoneCallback } from '../../src/types'; +import { DoneCallback } from '@0xproject/types'; export const reportCallbackErrors = (done: DoneCallback) => { return (f: (...args: any[]) => void) => { diff --git a/packages/types/CHANGELOG.json b/packages/types/CHANGELOG.json index 241acbf9c..b1fd03914 100644 --- a/packages/types/CHANGELOG.json +++ b/packages/types/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "version": "0.7.0", + "changes": [ + { + "note": + "Moved ExchangeContractErrs, DoneCallback, Token, OrderRelevantState, OrderStateValid, OrderStateInvalid, OrderState, OrderAddresses and OrderValues types from 0x.js" + } + ] + }, + { "timestamp": 1525477860, "version": "0.6.3", "changes": [ diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index 044aae3c8..a85d48cf7 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -292,3 +292,81 @@ export interface ECSignature { r: string; s: string; } + +/** + * Errors originating from the 0x exchange contract + */ +export enum ExchangeContractErrs { + OrderFillExpired = 'ORDER_FILL_EXPIRED', + OrderCancelExpired = 'ORDER_CANCEL_EXPIRED', + OrderCancelAmountZero = 'ORDER_CANCEL_AMOUNT_ZERO', + OrderAlreadyCancelledOrFilled = 'ORDER_ALREADY_CANCELLED_OR_FILLED', + OrderFillAmountZero = 'ORDER_FILL_AMOUNT_ZERO', + OrderRemainingFillAmountZero = 'ORDER_REMAINING_FILL_AMOUNT_ZERO', + OrderFillRoundingError = 'ORDER_FILL_ROUNDING_ERROR', + FillBalanceAllowanceError = 'FILL_BALANCE_ALLOWANCE_ERROR', + InsufficientTakerBalance = 'INSUFFICIENT_TAKER_BALANCE', + InsufficientTakerAllowance = 'INSUFFICIENT_TAKER_ALLOWANCE', + InsufficientMakerBalance = 'INSUFFICIENT_MAKER_BALANCE', + InsufficientMakerAllowance = 'INSUFFICIENT_MAKER_ALLOWANCE', + InsufficientTakerFeeBalance = 'INSUFFICIENT_TAKER_FEE_BALANCE', + InsufficientTakerFeeAllowance = 'INSUFFICIENT_TAKER_FEE_ALLOWANCE', + InsufficientMakerFeeBalance = 'INSUFFICIENT_MAKER_FEE_BALANCE', + InsufficientMakerFeeAllowance = 'INSUFFICIENT_MAKER_FEE_ALLOWANCE', + TransactionSenderIsNotFillOrderTaker = 'TRANSACTION_SENDER_IS_NOT_FILL_ORDER_TAKER', + MultipleMakersInSingleCancelBatchDisallowed = 'MULTIPLE_MAKERS_IN_SINGLE_CANCEL_BATCH_DISALLOWED', + InsufficientRemainingFillAmount = 'INSUFFICIENT_REMAINING_FILL_AMOUNT', + MultipleTakerTokensInFillUpToDisallowed = 'MULTIPLE_TAKER_TOKENS_IN_FILL_UP_TO_DISALLOWED', + BatchOrdersMustHaveSameExchangeAddress = 'BATCH_ORDERS_MUST_HAVE_SAME_EXCHANGE_ADDRESS', + BatchOrdersMustHaveAtLeastOneItem = 'BATCH_ORDERS_MUST_HAVE_AT_LEAST_ONE_ITEM', +} + +export type ArtifactContractName = 'ZRX' | 'TokenTransferProxy' | 'TokenRegistry' | 'Token' | 'Exchange' | 'EtherToken'; + +export interface Artifact { + contract_name: ArtifactContractName; + abi: ContractAbi; + networks: { + [networkId: number]: { + address: string; + }; + }; +} + +export type OrderAddresses = [string, string, string, string, string]; + +export type OrderValues = [BigNumber, BigNumber, BigNumber, BigNumber, BigNumber, BigNumber]; + +export type DoneCallback = (err?: Error) => void; + +export interface OrderRelevantState { + makerBalance: BigNumber; + makerProxyAllowance: BigNumber; + makerFeeBalance: BigNumber; + makerFeeProxyAllowance: BigNumber; + filledTakerTokenAmount: BigNumber; + cancelledTakerTokenAmount: BigNumber; + remainingFillableMakerTokenAmount: BigNumber; + remainingFillableTakerTokenAmount: BigNumber; +} + +export interface OrderStateValid { + isValid: true; + orderHash: string; + orderRelevantState: OrderRelevantState; +} + +export interface OrderStateInvalid { + isValid: false; + orderHash: string; + error: ExchangeContractErrs; +} + +export type OrderState = OrderStateValid | OrderStateInvalid; + +export interface Token { + name: string; + address: string; + symbol: string; + decimals: number; +} diff --git a/packages/web3-wrapper/src/web3_wrapper.ts b/packages/web3-wrapper/src/web3_wrapper.ts index 5e6ff3239..49fddb27b 100644 --- a/packages/web3-wrapper/src/web3_wrapper.ts +++ b/packages/web3-wrapper/src/web3_wrapper.ts @@ -324,6 +324,13 @@ export class Web3Wrapper { const txHash = await promisify<string>(this._web3.eth.sendTransaction)(txData); return txHash; } + /** + * Waits for a transaction to be mined and returns the transaction receipt. + * @param txHash Transaction hash + * @param pollingIntervalMs How often (in ms) should we check if the transaction is mined. + * @param timeoutMs How long (in ms) to poll for transaction mined until aborting. + * @return Transaction receipt with decoded log args. + */ public async awaitTransactionMinedAsync( txHash: string, pollingIntervalMs = 1000, |