diff options
Diffstat (limited to 'packages')
32 files changed, 2277 insertions, 650 deletions
diff --git a/packages/contracts/src/abstract/abstract_asset_wrapper.ts b/packages/contracts/src/abstract/abstract_asset_wrapper.ts new file mode 100644 index 000000000..521335f18 --- /dev/null +++ b/packages/contracts/src/abstract/abstract_asset_wrapper.ts @@ -0,0 +1,5 @@ +import { BigNumber } from '@0xproject/utils'; + +export abstract class AbstractAssetWrapper { + public abstract getProxyId(): number; +} diff --git a/packages/contracts/src/contracts/current/test/DummyERC721Token/DummyERC721Token.sol b/packages/contracts/src/contracts/current/test/DummyERC721Token/DummyERC721Token.sol index 5503eb2f2..78ea96447 100644 --- a/packages/contracts/src/contracts/current/test/DummyERC721Token/DummyERC721Token.sol +++ b/packages/contracts/src/contracts/current/test/DummyERC721Token/DummyERC721Token.sol @@ -56,4 +56,20 @@ contract DummyERC721Token is ); _mint(to, tokenId); } + + /** + * @dev Function to burn a token + * @dev Reverts if the given token ID doesn't exist + * @param tokenId uint256 ID of the token to be minted by the msg.sender + */ + function burn(address owner, uint256 tokenId) + public + onlyOwner + { + require( + exists(tokenId), + "Token with tokenId does not exist." + ); + _burn(owner, tokenId); + } } diff --git a/packages/contracts/src/utils/asset_wrapper.ts b/packages/contracts/src/utils/asset_wrapper.ts new file mode 100644 index 000000000..9c683054d --- /dev/null +++ b/packages/contracts/src/utils/asset_wrapper.ts @@ -0,0 +1,218 @@ +import { assetProxyUtils } from '@0xproject/order-utils'; +import { BigNumber, errorUtils } from '@0xproject/utils'; +import * as _ from 'lodash'; + +import { AbstractAssetWrapper } from '../abstract/abstract_asset_wrapper'; + +import { constants } from './constants'; +import { ERC20Wrapper } from './erc20_wrapper'; +import { ERC721Wrapper } from './erc721_wrapper'; + +interface ProxyIdToAssetWrappers { + [proxyId: number]: AbstractAssetWrapper; +} + +/** + * This class abstracts away the differences between ERC20 and ERC721 tokens so that + * the logic that uses it does not need to care what standard a token belongs to. + */ +export class AssetWrapper { + private _proxyIdToAssetWrappers: ProxyIdToAssetWrappers; + constructor(assetWrappers: AbstractAssetWrapper[]) { + this._proxyIdToAssetWrappers = {}; + _.each(assetWrappers, assetWrapper => { + const proxyId = assetWrapper.getProxyId(); + this._proxyIdToAssetWrappers[proxyId] = assetWrapper; + }); + } + public async getBalanceAsync(userAddress: string, assetData: string): Promise<BigNumber> { + const proxyId = assetProxyUtils.decodeAssetDataId(assetData); + switch (proxyId) { + case constants.ERC20_PROXY_ID: { + const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper; + const balance = await erc20Wrapper.getBalanceAsync(userAddress, assetData); + return balance; + } + case constants.ERC721_PROXY_ID: { + const assetWrapper = this._proxyIdToAssetWrappers[proxyId] as ERC721Wrapper; + const assetProxyData = assetProxyUtils.decodeERC721AssetData(assetData); + const isOwner = await assetWrapper.isOwnerAsync( + userAddress, + assetProxyData.tokenAddress, + assetProxyData.tokenId, + ); + const balance = isOwner ? new BigNumber(1) : new BigNumber(0); + return balance; + } + default: + throw errorUtils.spawnSwitchErr('proxyId', proxyId); + } + } + public async setBalanceAsync(userAddress: string, assetData: string, desiredBalance: BigNumber): Promise<void> { + const proxyId = assetProxyUtils.decodeAssetDataId(assetData); + switch (proxyId) { + case constants.ERC20_PROXY_ID: { + const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper; + await erc20Wrapper.setBalanceAsync(userAddress, assetData, desiredBalance); + return; + } + case constants.ERC721_PROXY_ID: { + if (!desiredBalance.eq(0) && !desiredBalance.eq(1)) { + throw new Error(`Balance for ERC721 token can only be set to 0 or 1. Got: ${desiredBalance}`); + } + const erc721Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC721Wrapper; + const assetProxyData = assetProxyUtils.decodeERC721AssetData(assetData); + const doesTokenExist = erc721Wrapper.doesTokenExistAsync( + assetProxyData.tokenAddress, + assetProxyData.tokenId, + ); + if (!doesTokenExist && desiredBalance.eq(1)) { + await erc721Wrapper.mintAsync(assetProxyData.tokenAddress, assetProxyData.tokenId, userAddress); + return; + } else if (!doesTokenExist && desiredBalance.eq(0)) { + return; // noop + } + const tokenOwner = await erc721Wrapper.ownerOfAsync( + assetProxyData.tokenAddress, + assetProxyData.tokenId, + ); + if (userAddress !== tokenOwner && desiredBalance.eq(1)) { + await erc721Wrapper.transferFromAsync( + assetProxyData.tokenAddress, + assetProxyData.tokenId, + tokenOwner, + userAddress, + ); + } else if (tokenOwner === userAddress && desiredBalance.eq(0)) { + // Burn token + await erc721Wrapper.burnAsync(assetProxyData.tokenAddress, assetProxyData.tokenId, userAddress); + return; + } else if ( + (userAddress !== tokenOwner && desiredBalance.eq(0)) || + (tokenOwner === userAddress && desiredBalance.eq(1)) + ) { + return; // noop + } + break; + } + default: + throw errorUtils.spawnSwitchErr('proxyId', proxyId); + } + } + public async getProxyAllowanceAsync(userAddress: string, assetData: string): Promise<BigNumber> { + const proxyId = assetProxyUtils.decodeAssetDataId(assetData); + switch (proxyId) { + case constants.ERC20_PROXY_ID: { + const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper; + const allowance = await erc20Wrapper.getProxyAllowanceAsync(userAddress, assetData); + return allowance; + } + case constants.ERC721_PROXY_ID: { + const assetWrapper = this._proxyIdToAssetWrappers[proxyId] as ERC721Wrapper; + const erc721ProxyData = assetProxyUtils.decodeERC721AssetData(assetData); + const isProxyApprovedForAll = await assetWrapper.isProxyApprovedForAllAsync( + userAddress, + erc721ProxyData.tokenAddress, + erc721ProxyData.tokenId, + ); + if (isProxyApprovedForAll) { + return constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS; + } + + const isProxyApproved = await assetWrapper.isProxyApprovedAsync( + erc721ProxyData.tokenAddress, + erc721ProxyData.tokenId, + ); + const allowance = isProxyApproved ? new BigNumber(1) : new BigNumber(0); + return allowance; + } + default: + throw errorUtils.spawnSwitchErr('proxyId', proxyId); + } + } + public async setProxyAllowanceAsync( + userAddress: string, + assetData: string, + desiredAllowance: BigNumber, + ): Promise<void> { + const proxyId = assetProxyUtils.decodeAssetDataId(assetData); + switch (proxyId) { + case constants.ERC20_PROXY_ID: { + const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper; + await erc20Wrapper.setAllowanceAsync(userAddress, assetData, desiredAllowance); + return; + } + case constants.ERC721_PROXY_ID: { + if ( + !desiredAllowance.eq(0) && + !desiredAllowance.eq(1) && + !desiredAllowance.eq(constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS) + ) { + throw new Error( + `Allowance for ERC721 token can only be set to 0, 1 or 2^256-1. Got: ${desiredAllowance}`, + ); + } + const erc721Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC721Wrapper; + const assetProxyData = assetProxyUtils.decodeERC721AssetData(assetData); + + const doesTokenExist = await erc721Wrapper.doesTokenExistAsync( + assetProxyData.tokenAddress, + assetProxyData.tokenId, + ); + if (!doesTokenExist) { + throw new Error( + `Cannot setProxyAllowance on non-existent token: ${assetProxyData.tokenAddress} ${ + assetProxyData.tokenId + }`, + ); + } + const isProxyApprovedForAll = await erc721Wrapper.isProxyApprovedForAllAsync( + userAddress, + assetProxyData.tokenAddress, + assetProxyData.tokenId, + ); + if (!isProxyApprovedForAll && desiredAllowance.eq(constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS)) { + const isApproved = true; + await erc721Wrapper.approveProxyForAllAsync( + assetProxyData.tokenAddress, + assetProxyData.tokenId, + isApproved, + ); + } else if (isProxyApprovedForAll && desiredAllowance.eq(0)) { + const isApproved = false; + await erc721Wrapper.approveProxyForAllAsync( + assetProxyData.tokenAddress, + assetProxyData.tokenId, + isApproved, + ); + } else if (isProxyApprovedForAll && desiredAllowance.eq(constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS)) { + return; // Noop + } + + const isProxyApproved = await erc721Wrapper.isProxyApprovedAsync( + assetProxyData.tokenAddress, + assetProxyData.tokenId, + ); + if (!isProxyApproved && desiredAllowance.eq(1)) { + await erc721Wrapper.approveProxyAsync(assetProxyData.tokenAddress, assetProxyData.tokenId); + } else if (isProxyApproved && desiredAllowance.eq(0)) { + // Remove approval + await erc721Wrapper.approveAsync( + constants.NULL_ADDRESS, + assetProxyData.tokenAddress, + assetProxyData.tokenId, + ); + } else if ( + (!isProxyApproved && desiredAllowance.eq(0)) || + (isProxyApproved && desiredAllowance.eq(1)) + ) { + return; // noop + } + + break; + } + default: + throw errorUtils.spawnSwitchErr('proxyId', proxyId); + } + } +} diff --git a/packages/contracts/src/utils/constants.ts b/packages/contracts/src/utils/constants.ts index 2b2bd2425..1e7b731dc 100644 --- a/packages/contracts/src/utils/constants.ts +++ b/packages/contracts/src/utils/constants.ts @@ -19,6 +19,8 @@ const TESTRPC_PRIVATE_KEYS_STRINGS = [ export const constants = { INVALID_OPCODE: 'invalid opcode', REVERT: 'revert', + ERC20_PROXY_ID: 1, + ERC721_PROXY_ID: 2, TESTRPC_NETWORK_ID: 50, // Note(albrow): In practice V8 and most other engines limit the minimum // interval for setInterval to 10ms. We still set it to 0 here in order to diff --git a/packages/contracts/src/utils/core_combinatorial_utils.ts b/packages/contracts/src/utils/core_combinatorial_utils.ts new file mode 100644 index 000000000..7e9d18e46 --- /dev/null +++ b/packages/contracts/src/utils/core_combinatorial_utils.ts @@ -0,0 +1,809 @@ +import { + assetProxyUtils, + BalanceAndProxyAllowanceLazyStore, + ExchangeTransferSimulator, + orderHashUtils, + OrderStateUtils, + OrderValidationUtils, +} from '@0xproject/order-utils'; +import { AssetProxyId, Order, SignatureType, SignedOrder } from '@0xproject/types'; +import { BigNumber, errorUtils, logUtils } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import * as chai from 'chai'; +import { BlockParamLiteral, LogWithDecodedArgs, Provider, TxData } from 'ethereum-types'; +import * as _ from 'lodash'; +import 'make-promises-safe'; + +import { ExchangeContract, FillContractEventArgs } from '../generated_contract_wrappers/exchange'; +import { artifacts } from '../utils/artifacts'; +import { expectRevertOrAlwaysFailingTransactionAsync } from '../utils/assertions'; +import { AssetWrapper } from '../utils/asset_wrapper'; +import { chaiSetup } from '../utils/chai_setup'; +import { constants } from '../utils/constants'; +import { ERC20Wrapper } from '../utils/erc20_wrapper'; +import { ERC721Wrapper } from '../utils/erc721_wrapper'; +import { ExchangeWrapper } from '../utils/exchange_wrapper'; +import { OrderFactoryFromScenario } from '../utils/order_factory_from_scenario'; +import { orderUtils } from '../utils/order_utils'; +import { signingUtils } from '../utils/signing_utils'; +import { SimpleAssetBalanceAndProxyAllowanceFetcher } from '../utils/simple_asset_balance_and_proxy_allowance_fetcher'; +import { SimpleOrderFilledCancelledFetcher } from '../utils/simple_order_filled_cancelled_fetcher'; +import { + AllowanceAmountScenario, + AssetDataScenario, + BalanceAmountScenario, + ExpirationTimeSecondsScenario, + FeeRecipientAddressScenario, + FillScenario, + OrderAssetAmountScenario, + OrderScenario, + TakerAssetFillAmountScenario, + TakerScenario, + TraderStateScenario, +} from '../utils/types'; + +chaiSetup.configure(); +const expect = chai.expect; + +/** + * Instantiates a new instance of CoreCombinatorialUtils. Since this method has some + * required async setup, a factory method is required. + * @param web3Wrapper Web3Wrapper instance + * @param txDefaults Default Ethereum tx options + * @return CoreCombinatorialUtils instance + */ +export async function coreCombinatorialUtilsFactoryAsync( + web3Wrapper: Web3Wrapper, + txDefaults: Partial<TxData>, +): Promise<CoreCombinatorialUtils> { + const userAddresses = await web3Wrapper.getAvailableAddressesAsync(); + const [ownerAddress, makerAddress, takerAddress] = userAddresses; + const makerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[userAddresses.indexOf(makerAddress)]; + + const provider = web3Wrapper.getProvider(); + const erc20Wrapper = new ERC20Wrapper(provider, userAddresses, ownerAddress); + const erc721Wrapper = new ERC721Wrapper(provider, userAddresses, ownerAddress); + + const erc20EighteenDecimalTokenCount = 3; + const eighteenDecimals = new BigNumber(18); + const [ + erc20EighteenDecimalTokenA, + erc20EighteenDecimalTokenB, + zrxToken, + ] = await erc20Wrapper.deployDummyTokensAsync(erc20EighteenDecimalTokenCount, eighteenDecimals); + const zrxAssetData = assetProxyUtils.encodeERC20AssetData(zrxToken.address); + + const erc20FiveDecimalTokenCount = 2; + const fiveDecimals = new BigNumber(18); + const [erc20FiveDecimalTokenA, erc20FiveDecimalTokenB] = await erc20Wrapper.deployDummyTokensAsync( + erc20FiveDecimalTokenCount, + fiveDecimals, + ); + const erc20Proxy = await erc20Wrapper.deployProxyAsync(); + await erc20Wrapper.setBalancesAndAllowancesAsync(); + + const [erc721Token] = await erc721Wrapper.deployDummyTokensAsync(); + const erc721Proxy = await erc721Wrapper.deployProxyAsync(); + await erc721Wrapper.setBalancesAndAllowancesAsync(); + const erc721Balances = await erc721Wrapper.getBalancesAsync(); + + const assetWrapper = new AssetWrapper([erc20Wrapper, erc721Wrapper]); + + const exchangeContract = await ExchangeContract.deployFrom0xArtifactAsync( + artifacts.Exchange, + provider, + txDefaults, + zrxAssetData, + ); + const exchangeWrapper = new ExchangeWrapper(exchangeContract, provider); + await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, ownerAddress); + await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC721, erc721Proxy.address, ownerAddress); + + await web3Wrapper.awaitTransactionSuccessAsync( + await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeContract.address, { + from: ownerAddress, + }), + constants.AWAIT_TRANSACTION_MINED_MS, + ); + await web3Wrapper.awaitTransactionSuccessAsync( + await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeContract.address, { + from: ownerAddress, + }), + constants.AWAIT_TRANSACTION_MINED_MS, + ); + + const orderFactory = new OrderFactoryFromScenario( + userAddresses, + zrxToken.address, + [erc20EighteenDecimalTokenA.address, erc20EighteenDecimalTokenB.address], + [erc20FiveDecimalTokenA.address, erc20FiveDecimalTokenB.address], + erc721Token, + erc721Balances, + exchangeContract.address, + ); + + const coreCombinatorialUtils = new CoreCombinatorialUtils( + orderFactory, + ownerAddress, + makerAddress, + makerPrivateKey, + takerAddress, + zrxAssetData, + exchangeWrapper, + assetWrapper, + ); + return coreCombinatorialUtils; +} + +export class CoreCombinatorialUtils { + public orderFactory: OrderFactoryFromScenario; + public ownerAddress: string; + public makerAddress: string; + public makerPrivateKey: Buffer; + public takerAddress: string; + public zrxAssetData: string; + public exchangeWrapper: ExchangeWrapper; + public assetWrapper: AssetWrapper; + public static generateFillOrderCombinations(): FillScenario[] { + const takerScenarios = [TakerScenario.Unspecified]; + const feeRecipientScenarios = [FeeRecipientAddressScenario.EthUserAddress]; + const makerAssetAmountScenario = [OrderAssetAmountScenario.Large]; + const takerAssetAmountScenario = [OrderAssetAmountScenario.Large]; + const makerFeeScenario = [OrderAssetAmountScenario.Large]; + const takerFeeScenario = [OrderAssetAmountScenario.Large]; + const expirationTimeSecondsScenario = [ExpirationTimeSecondsScenario.InFuture]; + const makerAssetDataScenario = [ + AssetDataScenario.ERC20FiveDecimals, + AssetDataScenario.ERC20NonZRXEighteenDecimals, + AssetDataScenario.ERC721, + AssetDataScenario.ZRXFeeToken, + ]; + const takerAssetDataScenario = [ + AssetDataScenario.ERC20FiveDecimals, + AssetDataScenario.ERC20NonZRXEighteenDecimals, + AssetDataScenario.ERC721, + AssetDataScenario.ZRXFeeToken, + ]; + const takerAssetFillAmountScenario = [TakerAssetFillAmountScenario.ExactlyRemainingFillableTakerAssetAmount]; + const fillScenarioArrays = CoreCombinatorialUtils._getAllCombinations([ + takerScenarios, + feeRecipientScenarios, + makerAssetAmountScenario, + takerAssetAmountScenario, + makerFeeScenario, + takerFeeScenario, + expirationTimeSecondsScenario, + makerAssetDataScenario, + takerAssetDataScenario, + takerAssetFillAmountScenario, + ]); + + const fillScenarios = _.map(fillScenarioArrays, fillScenarioArray => { + const fillScenario: FillScenario = { + orderScenario: { + takerScenario: fillScenarioArray[0] as TakerScenario, + feeRecipientScenario: fillScenarioArray[1] as FeeRecipientAddressScenario, + makerAssetAmountScenario: fillScenarioArray[2] as OrderAssetAmountScenario, + takerAssetAmountScenario: fillScenarioArray[3] as OrderAssetAmountScenario, + makerFeeScenario: fillScenarioArray[4] as OrderAssetAmountScenario, + takerFeeScenario: fillScenarioArray[5] as OrderAssetAmountScenario, + expirationTimeSecondsScenario: fillScenarioArray[6] as ExpirationTimeSecondsScenario, + makerAssetDataScenario: fillScenarioArray[7] as AssetDataScenario, + takerAssetDataScenario: fillScenarioArray[8] as AssetDataScenario, + }, + takerAssetFillAmountScenario: fillScenarioArray[9] as TakerAssetFillAmountScenario, + makerStateScenario: { + traderAssetBalance: BalanceAmountScenario.Higher, + traderAssetAllowance: AllowanceAmountScenario.Higher, + zrxFeeBalance: BalanceAmountScenario.Higher, + zrxFeeAllowance: AllowanceAmountScenario.Higher, + }, + takerStateScenario: { + traderAssetBalance: BalanceAmountScenario.Higher, + traderAssetAllowance: AllowanceAmountScenario.Higher, + zrxFeeBalance: BalanceAmountScenario.Higher, + zrxFeeAllowance: AllowanceAmountScenario.Higher, + }, + }; + return fillScenario; + }); + + return fillScenarios; + } + /** + * Recursive implementation of generating all combinations of the supplied + * string-containing arrays. + */ + private static _getAllCombinations(arrays: string[][]): string[][] { + // Base case + if (arrays.length === 1) { + const remainingValues = _.map(arrays[0], val => { + return [val]; + }); + return remainingValues; + } else { + const result = []; + const restOfArrays = arrays.slice(1); + const allCombinationsOfRemaining = CoreCombinatorialUtils._getAllCombinations(restOfArrays); // recur with the rest of array + // tslint:disable:prefer-for-of + for (let i = 0; i < allCombinationsOfRemaining.length; i++) { + for (let j = 0; j < arrays[0].length; j++) { + result.push([arrays[0][j], ...allCombinationsOfRemaining[i]]); + } + } + // tslint:enable:prefer-for-of + return result; + } + } + constructor( + orderFactory: OrderFactoryFromScenario, + ownerAddress: string, + makerAddress: string, + makerPrivateKey: Buffer, + takerAddress: string, + zrxAssetData: string, + exchangeWrapper: ExchangeWrapper, + assetWrapper: AssetWrapper, + ) { + this.orderFactory = orderFactory; + this.ownerAddress = ownerAddress; + this.makerAddress = makerAddress; + this.makerPrivateKey = makerPrivateKey; + this.takerAddress = takerAddress; + this.zrxAssetData = zrxAssetData; + this.exchangeWrapper = exchangeWrapper; + this.assetWrapper = assetWrapper; + } + public async testFillOrderScenarioAsync( + provider: Provider, + fillScenario: FillScenario, + isVerbose: boolean = false, + ): Promise<void> { + // 1. Generate order + const order = this.orderFactory.generateOrder(fillScenario.orderScenario); + + // 2. Sign order + const orderHashBuff = orderHashUtils.getOrderHashBuffer(order); + const signature = signingUtils.signMessage(orderHashBuff, this.makerPrivateKey, SignatureType.EthSign); + const signedOrder = { + ...order, + signature: `0x${signature.toString('hex')}`, + }; + + const balanceAndProxyAllowanceFetcher = new SimpleAssetBalanceAndProxyAllowanceFetcher(this.assetWrapper); + const orderFilledCancelledFetcher = new SimpleOrderFilledCancelledFetcher( + this.exchangeWrapper, + this.zrxAssetData, + ); + + // 3. Figure out fill amount + const takerAssetFillAmount = await this._getTakerAssetFillAmountAsync( + signedOrder, + fillScenario.takerAssetFillAmountScenario, + balanceAndProxyAllowanceFetcher, + orderFilledCancelledFetcher, + ); + + // 4. Permutate the maker and taker balance/allowance scenarios + await this._modifyTraderStateAsync( + fillScenario.makerStateScenario, + fillScenario.takerStateScenario, + signedOrder, + takerAssetFillAmount, + balanceAndProxyAllowanceFetcher, + ); + + // 5. If I fill it by X, what are the resulting balances/allowances/filled amounts expected? + const orderValidationUtils = new OrderValidationUtils(orderFilledCancelledFetcher); + const lazyStore = new BalanceAndProxyAllowanceLazyStore(balanceAndProxyAllowanceFetcher); + const exchangeTransferSimulator = new ExchangeTransferSimulator(lazyStore); + + let isFillFailureExpected = false; + try { + await orderValidationUtils.validateFillOrderThrowIfInvalidAsync( + exchangeTransferSimulator, + provider, + signedOrder, + takerAssetFillAmount, + this.takerAddress, + this.zrxAssetData, + ); + if (isVerbose) { + logUtils.log(`Expecting fillOrder to succeed.`); + } + } catch (err) { + isFillFailureExpected = true; + if (isVerbose) { + logUtils.log(`Expecting fillOrder to fail with:`); + logUtils.log(err); + } + } + + // 6. Fill the order + await this._fillOrderAndAssertOutcomeAsync( + signedOrder, + takerAssetFillAmount, + lazyStore, + isFillFailureExpected, + provider, + ); + } + private async _fillOrderAndAssertOutcomeAsync( + signedOrder: SignedOrder, + takerAssetFillAmount: BigNumber, + lazyStore: BalanceAndProxyAllowanceLazyStore, + isFillFailureExpected: boolean, + provider: Provider, + ): Promise<void> { + if (isFillFailureExpected) { + return expectRevertOrAlwaysFailingTransactionAsync( + this.exchangeWrapper.fillOrderAsync(signedOrder, this.takerAddress, { takerAssetFillAmount }), + ); + } + + const makerAddress = signedOrder.makerAddress; + const makerAssetData = signedOrder.makerAssetData; + const takerAssetData = signedOrder.takerAssetData; + const feeRecipient = signedOrder.feeRecipientAddress; + + const expMakerAssetBalanceOfMaker = await lazyStore.getBalanceAsync(makerAssetData, makerAddress); + const expMakerAssetAllowanceOfMaker = await lazyStore.getProxyAllowanceAsync(makerAssetData, makerAddress); + const expTakerAssetBalanceOfMaker = await lazyStore.getBalanceAsync(takerAssetData, makerAddress); + const expZRXAssetBalanceOfMaker = await lazyStore.getBalanceAsync(this.zrxAssetData, makerAddress); + const expZRXAssetAllowanceOfMaker = await lazyStore.getProxyAllowanceAsync(this.zrxAssetData, makerAddress); + const expTakerAssetBalanceOfTaker = await lazyStore.getBalanceAsync(takerAssetData, this.takerAddress); + const expTakerAssetAllowanceOfTaker = await lazyStore.getProxyAllowanceAsync(takerAssetData, this.takerAddress); + const expMakerAssetBalanceOfTaker = await lazyStore.getBalanceAsync(makerAssetData, this.takerAddress); + const expZRXAssetBalanceOfTaker = await lazyStore.getBalanceAsync(this.zrxAssetData, this.takerAddress); + const expZRXAssetAllowanceOfTaker = await lazyStore.getProxyAllowanceAsync( + this.zrxAssetData, + this.takerAddress, + ); + const expZRXAssetBalanceOfFeeRecipient = await lazyStore.getBalanceAsync(this.zrxAssetData, feeRecipient); + + const orderHash = orderHashUtils.getOrderHashHex(signedOrder); + const alreadyFilledTakerAmount = await this.exchangeWrapper.getTakerAssetFilledAmountAsync(orderHash); + const remainingTakerAmountToFill = signedOrder.takerAssetAmount.minus(alreadyFilledTakerAmount); + const expFilledTakerAmount = takerAssetFillAmount.gt(remainingTakerAmountToFill) + ? remainingTakerAmountToFill + : alreadyFilledTakerAmount.add(takerAssetFillAmount); + + const expFilledMakerAmount = orderUtils.getPartialAmount( + expFilledTakerAmount, + signedOrder.takerAssetAmount, + signedOrder.makerAssetAmount, + ); + + const beforeMakerAssetAllowanceOfMaker = await this.assetWrapper.getProxyAllowanceAsync( + makerAddress, + makerAssetData, + ); + + // - Let's fill the order! + const txReceipt = await this.exchangeWrapper.fillOrderAsync(signedOrder, this.takerAddress, { + takerAssetFillAmount, + }); + + const actFilledTakerAmount = await this.exchangeWrapper.getTakerAssetFilledAmountAsync(orderHash); + expect(actFilledTakerAmount).to.be.bignumber.equal(expFilledTakerAmount, 'filledTakerAmount'); + + expect(txReceipt.logs.length).to.be.equal(1, 'logs length'); + // tslint:disable-next-line:no-unnecessary-type-assertion + const log = txReceipt.logs[0] as LogWithDecodedArgs<FillContractEventArgs>; + expect(log.args.makerAddress).to.be.equal(makerAddress, 'log.args.makerAddress'); + expect(log.args.takerAddress).to.be.equal(this.takerAddress, 'log.args.this.takerAddress'); + expect(log.args.feeRecipientAddress).to.be.equal(feeRecipient, 'log.args.feeRecipientAddress'); + expect(log.args.makerAssetFilledAmount).to.be.bignumber.equal( + expFilledMakerAmount, + 'log.args.makerAssetFilledAmount', + ); + expect(log.args.takerAssetFilledAmount).to.be.bignumber.equal( + expFilledTakerAmount, + 'log.args.takerAssetFilledAmount', + ); + const expMakerFeePaid = orderUtils.getPartialAmount( + expFilledTakerAmount, + signedOrder.takerAssetAmount, + signedOrder.makerFee, + ); + expect(log.args.makerFeePaid).to.be.bignumber.equal(expMakerFeePaid, 'log.args.makerFeePaid'); + const expTakerFeePaid = orderUtils.getPartialAmount( + expFilledTakerAmount, + signedOrder.takerAssetAmount, + signedOrder.takerFee, + ); + expect(log.args.takerFeePaid).to.be.bignumber.equal(expTakerFeePaid, 'logs.args.takerFeePaid'); + expect(log.args.orderHash).to.be.equal(orderHash, 'log.args.orderHash'); + expect(log.args.makerAssetData).to.be.equal(makerAssetData, 'log.args.makerAssetData'); + expect(log.args.takerAssetData).to.be.equal(takerAssetData, 'log.args.takerAssetData'); + + const actMakerAssetBalanceOfMaker = await this.assetWrapper.getBalanceAsync(makerAddress, makerAssetData); + expect(actMakerAssetBalanceOfMaker).to.be.bignumber.equal( + expMakerAssetBalanceOfMaker, + 'makerAssetBalanceOfMaker', + ); + + const actMakerAssetAllowanceOfMaker = await this.assetWrapper.getProxyAllowanceAsync( + makerAddress, + makerAssetData, + ); + expect(actMakerAssetAllowanceOfMaker).to.be.bignumber.equal( + expMakerAssetAllowanceOfMaker, + 'makerAssetAllowanceOfMaker', + ); + + const actTakerAssetBalanceOfMaker = await this.assetWrapper.getBalanceAsync(makerAddress, takerAssetData); + expect(actTakerAssetBalanceOfMaker).to.be.bignumber.equal( + expTakerAssetBalanceOfMaker, + 'takerAssetBalanceOfMaker', + ); + + const actZRXAssetBalanceOfMaker = await this.assetWrapper.getBalanceAsync(makerAddress, this.zrxAssetData); + expect(actZRXAssetBalanceOfMaker).to.be.bignumber.equal(expZRXAssetBalanceOfMaker, 'ZRXAssetBalanceOfMaker'); + + const actZRXAssetAllowanceOfMaker = await this.assetWrapper.getProxyAllowanceAsync( + makerAddress, + this.zrxAssetData, + ); + expect(actZRXAssetAllowanceOfMaker).to.be.bignumber.equal( + expZRXAssetAllowanceOfMaker, + 'ZRXAssetAllowanceOfMaker', + ); + + const actTakerAssetBalanceOfTaker = await this.assetWrapper.getBalanceAsync(this.takerAddress, takerAssetData); + expect(actTakerAssetBalanceOfTaker).to.be.bignumber.equal( + expTakerAssetBalanceOfTaker, + 'TakerAssetBalanceOfTaker', + ); + + const actTakerAssetAllowanceOfTaker = await this.assetWrapper.getProxyAllowanceAsync( + this.takerAddress, + takerAssetData, + ); + + expect(actTakerAssetAllowanceOfTaker).to.be.bignumber.equal( + expTakerAssetAllowanceOfTaker, + 'TakerAssetAllowanceOfTaker', + ); + + const actMakerAssetBalanceOfTaker = await this.assetWrapper.getBalanceAsync(this.takerAddress, makerAssetData); + expect(actMakerAssetBalanceOfTaker).to.be.bignumber.equal( + expMakerAssetBalanceOfTaker, + 'MakerAssetBalanceOfTaker', + ); + + const actZRXAssetBalanceOfTaker = await this.assetWrapper.getBalanceAsync(this.takerAddress, this.zrxAssetData); + expect(actZRXAssetBalanceOfTaker).to.be.bignumber.equal(expZRXAssetBalanceOfTaker, 'ZRXAssetBalanceOfTaker'); + + const actZRXAssetAllowanceOfTaker = await this.assetWrapper.getProxyAllowanceAsync( + this.takerAddress, + this.zrxAssetData, + ); + expect(actZRXAssetAllowanceOfTaker).to.be.bignumber.equal( + expZRXAssetAllowanceOfTaker, + 'ZRXAssetAllowanceOfTaker', + ); + + const actZRXAssetBalanceOfFeeRecipient = await this.assetWrapper.getBalanceAsync( + feeRecipient, + this.zrxAssetData, + ); + expect(actZRXAssetBalanceOfFeeRecipient).to.be.bignumber.equal( + expZRXAssetBalanceOfFeeRecipient, + 'ZRXAssetBalanceOfFeeRecipient', + ); + } + private async _getTakerAssetFillAmountAsync( + signedOrder: SignedOrder, + takerAssetFillAmountScenario: TakerAssetFillAmountScenario, + balanceAndProxyAllowanceFetcher: SimpleAssetBalanceAndProxyAllowanceFetcher, + orderFilledCancelledFetcher: SimpleOrderFilledCancelledFetcher, + ): Promise<BigNumber> { + const orderStateUtils = new OrderStateUtils(balanceAndProxyAllowanceFetcher, orderFilledCancelledFetcher); + const fillableTakerAssetAmount = await orderStateUtils.getMaxFillableTakerAssetAmountAsync( + signedOrder, + this.takerAddress, + ); + + let takerAssetFillAmount; + switch (takerAssetFillAmountScenario) { + case TakerAssetFillAmountScenario.Zero: + takerAssetFillAmount = new BigNumber(0); + break; + + case TakerAssetFillAmountScenario.ExactlyRemainingFillableTakerAssetAmount: + takerAssetFillAmount = fillableTakerAssetAmount; + break; + + case TakerAssetFillAmountScenario.GreaterThanRemainingFillableTakerAssetAmount: + takerAssetFillAmount = fillableTakerAssetAmount.add(1); + break; + + case TakerAssetFillAmountScenario.LessThanRemainingFillableTakerAssetAmount: + const takerAssetProxyId = assetProxyUtils.decodeAssetDataId(signedOrder.takerAssetData); + const makerAssetProxyId = assetProxyUtils.decodeAssetDataId(signedOrder.makerAssetData); + const isEitherAssetERC721 = + takerAssetProxyId === constants.ERC721_PROXY_ID || makerAssetProxyId === constants.ERC721_PROXY_ID; + if (isEitherAssetERC721) { + throw new Error( + 'Cannot test `TakerAssetFillAmountScenario.LessThanRemainingFillableTakerAssetAmount` together with ERC721 assets since orders involving ERC721 must always be filled exactly.', + ); + } + takerAssetFillAmount = fillableTakerAssetAmount.div(2).floor(); + break; + + default: + throw errorUtils.spawnSwitchErr('TakerAssetFillAmountScenario', takerAssetFillAmountScenario); + } + + return takerAssetFillAmount; + } + private async _modifyTraderStateAsync( + makerStateScenario: TraderStateScenario, + takerStateScenario: TraderStateScenario, + signedOrder: SignedOrder, + takerAssetFillAmount: BigNumber, + balanceAndProxyAllowanceFetcher: SimpleAssetBalanceAndProxyAllowanceFetcher, + ): Promise<void> { + const makerAssetFillAmount = orderUtils.getPartialAmount( + takerAssetFillAmount, + signedOrder.takerAssetAmount, + signedOrder.makerAssetAmount, + ); + switch (makerStateScenario.traderAssetBalance) { + case BalanceAmountScenario.Higher: + break; // Noop since this is already the default + + case BalanceAmountScenario.TooLow: + if (makerAssetFillAmount.eq(0)) { + throw new Error(`Cannot set makerAssetBalanceOfMaker TooLow if makerAssetFillAmount is 0`); + } + const tooLowBalance = makerAssetFillAmount.minus(1); + await this.assetWrapper.setBalanceAsync( + signedOrder.makerAddress, + signedOrder.makerAssetData, + tooLowBalance, + ); + break; + + case BalanceAmountScenario.Exact: + const exactBalance = makerAssetFillAmount; + await this.assetWrapper.setBalanceAsync( + signedOrder.makerAddress, + signedOrder.makerAssetData, + exactBalance, + ); + break; + + default: + throw errorUtils.spawnSwitchErr( + 'makerStateScenario.traderAssetBalance', + makerStateScenario.traderAssetBalance, + ); + } + + const makerFee = orderUtils.getPartialAmount( + takerAssetFillAmount, + signedOrder.takerAssetAmount, + signedOrder.makerFee, + ); + switch (makerStateScenario.zrxFeeBalance) { + case BalanceAmountScenario.Higher: + break; // Noop since this is already the default + + case BalanceAmountScenario.TooLow: + if (makerFee.eq(0)) { + throw new Error(`Cannot set zrxAsserBalanceOfMaker TooLow if makerFee is 0`); + } + const tooLowBalance = makerFee.minus(1); + await this.assetWrapper.setBalanceAsync(signedOrder.makerAddress, this.zrxAssetData, tooLowBalance); + break; + + case BalanceAmountScenario.Exact: + const exactBalance = makerFee; + await this.assetWrapper.setBalanceAsync(signedOrder.makerAddress, this.zrxAssetData, exactBalance); + break; + + default: + throw errorUtils.spawnSwitchErr('makerStateScenario.zrxFeeBalance', makerStateScenario.zrxFeeBalance); + } + + switch (makerStateScenario.traderAssetAllowance) { + case AllowanceAmountScenario.Higher: + break; // Noop since this is already the default + + case AllowanceAmountScenario.TooLow: + const tooLowAllowance = makerAssetFillAmount.minus(1); + await this.assetWrapper.setProxyAllowanceAsync( + signedOrder.makerAddress, + signedOrder.makerAssetData, + tooLowAllowance, + ); + break; + + case AllowanceAmountScenario.Exact: + const exactAllowance = makerAssetFillAmount; + await this.assetWrapper.setProxyAllowanceAsync( + signedOrder.makerAddress, + signedOrder.makerAssetData, + exactAllowance, + ); + break; + + case AllowanceAmountScenario.Unlimited: + await this.assetWrapper.setProxyAllowanceAsync( + signedOrder.makerAddress, + signedOrder.makerAssetData, + constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS, + ); + break; + + default: + throw errorUtils.spawnSwitchErr( + 'makerStateScenario.traderAssetAllowance', + makerStateScenario.traderAssetAllowance, + ); + } + + switch (makerStateScenario.zrxFeeAllowance) { + case AllowanceAmountScenario.Higher: + break; // Noop since this is already the default + + case AllowanceAmountScenario.TooLow: + const tooLowAllowance = makerFee.minus(1); + await this.assetWrapper.setProxyAllowanceAsync( + signedOrder.makerAddress, + this.zrxAssetData, + tooLowAllowance, + ); + break; + + case AllowanceAmountScenario.Exact: + const exactAllowance = makerFee; + await this.assetWrapper.setProxyAllowanceAsync( + signedOrder.makerAddress, + this.zrxAssetData, + exactAllowance, + ); + break; + + case AllowanceAmountScenario.Unlimited: + await this.assetWrapper.setProxyAllowanceAsync( + signedOrder.makerAddress, + this.zrxAssetData, + constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS, + ); + break; + + default: + throw errorUtils.spawnSwitchErr( + 'makerStateScenario.zrxFeeAllowance', + makerStateScenario.zrxFeeAllowance, + ); + } + + switch (takerStateScenario.traderAssetBalance) { + case BalanceAmountScenario.Higher: + break; // Noop since this is already the default + + case BalanceAmountScenario.TooLow: + if (takerAssetFillAmount.eq(0)) { + throw new Error(`Cannot set takerAssetBalanceOfTaker TooLow if takerAssetFillAmount is 0`); + } + const tooLowBalance = takerAssetFillAmount.minus(1); + await this.assetWrapper.setBalanceAsync(this.takerAddress, signedOrder.takerAssetData, tooLowBalance); + break; + + case BalanceAmountScenario.Exact: + const exactBalance = takerAssetFillAmount; + await this.assetWrapper.setBalanceAsync(this.takerAddress, signedOrder.takerAssetData, exactBalance); + break; + + default: + throw errorUtils.spawnSwitchErr( + 'takerStateScenario.traderAssetBalance', + takerStateScenario.traderAssetBalance, + ); + } + + const takerFee = orderUtils.getPartialAmount( + takerAssetFillAmount, + signedOrder.takerAssetAmount, + signedOrder.takerFee, + ); + switch (takerStateScenario.zrxFeeBalance) { + case BalanceAmountScenario.Higher: + break; // Noop since this is already the default + + case BalanceAmountScenario.TooLow: + if (takerFee.eq(0)) { + throw new Error(`Cannot set zrxAssetBalanceOfTaker TooLow if takerFee is 0`); + } + const tooLowBalance = takerFee.minus(1); + await this.assetWrapper.setBalanceAsync(this.takerAddress, this.zrxAssetData, tooLowBalance); + break; + + case BalanceAmountScenario.Exact: + const exactBalance = takerFee; + await this.assetWrapper.setBalanceAsync(this.takerAddress, this.zrxAssetData, exactBalance); + break; + + default: + throw errorUtils.spawnSwitchErr('takerStateScenario.zrxFeeBalance', takerStateScenario.zrxFeeBalance); + } + + switch (takerStateScenario.traderAssetAllowance) { + case AllowanceAmountScenario.Higher: + break; // Noop since this is already the default + + case AllowanceAmountScenario.TooLow: + const tooLowAllowance = takerAssetFillAmount.minus(1); + await this.assetWrapper.setProxyAllowanceAsync( + this.takerAddress, + signedOrder.takerAssetData, + tooLowAllowance, + ); + break; + + case AllowanceAmountScenario.Exact: + const exactAllowance = takerAssetFillAmount; + await this.assetWrapper.setProxyAllowanceAsync( + this.takerAddress, + signedOrder.takerAssetData, + exactAllowance, + ); + break; + + case AllowanceAmountScenario.Unlimited: + await this.assetWrapper.setProxyAllowanceAsync( + this.takerAddress, + signedOrder.takerAssetData, + constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS, + ); + break; + + default: + throw errorUtils.spawnSwitchErr( + 'takerStateScenario.traderAssetAllowance', + takerStateScenario.traderAssetAllowance, + ); + } + + switch (takerStateScenario.zrxFeeAllowance) { + case AllowanceAmountScenario.Higher: + break; // Noop since this is already the default + + case AllowanceAmountScenario.TooLow: + const tooLowAllowance = takerFee.minus(1); + await this.assetWrapper.setProxyAllowanceAsync( + signedOrder.takerAddress, + this.zrxAssetData, + tooLowAllowance, + ); + break; + + case AllowanceAmountScenario.Exact: + const exactAllowance = takerFee; + await this.assetWrapper.setProxyAllowanceAsync( + signedOrder.takerAddress, + this.zrxAssetData, + exactAllowance, + ); + break; + + case AllowanceAmountScenario.Unlimited: + await this.assetWrapper.setProxyAllowanceAsync( + signedOrder.takerAddress, + this.zrxAssetData, + constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS, + ); + break; + + default: + throw errorUtils.spawnSwitchErr( + 'takerStateScenario.zrxFeeAllowance', + takerStateScenario.zrxFeeAllowance, + ); + } + } +} // tslint:disable:max-file-line-count diff --git a/packages/contracts/src/utils/erc20_wrapper.ts b/packages/contracts/src/utils/erc20_wrapper.ts index 91c9d50b7..6dd717f4a 100644 --- a/packages/contracts/src/utils/erc20_wrapper.ts +++ b/packages/contracts/src/utils/erc20_wrapper.ts @@ -1,3 +1,4 @@ +import { assetProxyUtils } from '@0xproject/order-utils'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { Provider } from 'ethereum-types'; @@ -18,6 +19,7 @@ export class ERC20Wrapper { private _provider: Provider; private _dummyTokenContracts: DummyERC20TokenContract[]; private _proxyContract?: ERC20ProxyContract; + private _proxyIdIfExists?: number; constructor(provider: Provider, tokenOwnerAddresses: string[], contractOwnerAddress: string) { this._dummyTokenContracts = []; this._web3Wrapper = new Web3Wrapper(provider); @@ -25,8 +27,11 @@ export class ERC20Wrapper { this._tokenOwnerAddresses = tokenOwnerAddresses; this._contractOwnerAddress = contractOwnerAddress; } - public async deployDummyTokensAsync(): Promise<DummyERC20TokenContract[]> { - for (let i = 0; i < constants.NUM_DUMMY_ERC20_TO_DEPLOY; i++) { + public async deployDummyTokensAsync( + numberToDeploy: number, + decimals: BigNumber, + ): Promise<DummyERC20TokenContract[]> { + for (let i = 0; i < numberToDeploy; i++) { this._dummyTokenContracts.push( await DummyERC20TokenContract.deployFrom0xArtifactAsync( artifacts.DummyERC20Token, @@ -34,7 +39,7 @@ export class ERC20Wrapper { txDefaults, constants.DUMMY_TOKEN_NAME, constants.DUMMY_TOKEN_SYMBOL, - constants.DUMMY_TOKEN_DECIMALS, + decimals, constants.DUMMY_TOKEN_TOTAL_SUPPLY, ), ); @@ -47,8 +52,13 @@ export class ERC20Wrapper { this._provider, txDefaults, ); + this._proxyIdIfExists = await this._proxyContract.getProxyId.callAsync(); return this._proxyContract; } + public getProxyId(): number { + this._validateProxyContractExistsOrThrow(); + return this._proxyIdIfExists as number; + } public async setBalancesAndAllowancesAsync(): Promise<void> { this._validateDummyTokenContractsExistOrThrow(); this._validateProxyContractExistsOrThrow(); @@ -73,6 +83,30 @@ export class ERC20Wrapper { } } } + public async getBalanceAsync(userAddress: string, assetData: string): Promise<BigNumber> { + const tokenContract = this._getTokenContractFromAssetData(assetData); + const balance = new BigNumber(await tokenContract.balanceOf.callAsync(userAddress)); + return balance; + } + public async setBalanceAsync(userAddress: string, assetData: string, amount: BigNumber): Promise<void> { + const tokenContract = this._getTokenContractFromAssetData(assetData); + await tokenContract.setBalance.sendTransactionAsync(userAddress, amount, { + from: this._contractOwnerAddress, + }); + } + public async getProxyAllowanceAsync(userAddress: string, assetData: string): Promise<BigNumber> { + const tokenContract = this._getTokenContractFromAssetData(assetData); + const proxyAddress = (this._proxyContract as ERC20ProxyContract).address; + const allowance = new BigNumber(await tokenContract.allowance.callAsync(userAddress, proxyAddress)); + return allowance; + } + public async setAllowanceAsync(userAddress: string, assetData: string, amount: BigNumber): Promise<void> { + const tokenContract = this._getTokenContractFromAssetData(assetData); + const proxyAddress = (this._proxyContract as ERC20ProxyContract).address; + await tokenContract.approve.sendTransactionAsync(proxyAddress, amount, { + from: userAddress, + }); + } public async getBalancesAsync(): Promise<ERC20BalancesByOwner> { this._validateDummyTokenContractsExistOrThrow(); const balancesByOwner: ERC20BalancesByOwner = {}; @@ -105,6 +139,15 @@ export class ERC20Wrapper { const tokenAddresses = _.map(this._dummyTokenContracts, dummyTokenContract => dummyTokenContract.address); return tokenAddresses; } + private _getTokenContractFromAssetData(assetData: string): DummyERC20TokenContract { + const erc20ProxyData = assetProxyUtils.decodeERC20AssetData(assetData); + const tokenAddress = erc20ProxyData.tokenAddress; + const tokenContractIfExists = _.find(this._dummyTokenContracts, c => c.address === tokenAddress); + if (_.isUndefined(tokenContractIfExists)) { + throw new Error(`Token: ${tokenAddress} was not deployed through ERC20Wrapper`); + } + return tokenContractIfExists; + } private _validateDummyTokenContractsExistOrThrow(): void { if (_.isUndefined(this._dummyTokenContracts)) { throw new Error('Dummy ERC20 tokens not yet deployed, please call "deployDummyTokensAsync"'); diff --git a/packages/contracts/src/utils/erc721_wrapper.ts b/packages/contracts/src/utils/erc721_wrapper.ts index b20d9acd2..6df9fa12e 100644 --- a/packages/contracts/src/utils/erc721_wrapper.ts +++ b/packages/contracts/src/utils/erc721_wrapper.ts @@ -1,4 +1,4 @@ -import { generatePseudoRandomSalt } from '@0xproject/order-utils'; +import { assetProxyUtils, generatePseudoRandomSalt } from '@0xproject/order-utils'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { Provider } from 'ethereum-types'; @@ -19,6 +19,7 @@ export class ERC721Wrapper { private _provider: Provider; private _dummyTokenContracts: DummyERC721TokenContract[]; private _proxyContract?: ERC721ProxyContract; + private _proxyIdIfExists?: number; private _initialTokenIdsByOwner: ERC721TokenIdsByOwner = {}; constructor(provider: Provider, tokenOwnerAddresses: string[], contractOwnerAddress: string) { this._web3Wrapper = new Web3Wrapper(provider); @@ -47,8 +48,13 @@ export class ERC721Wrapper { this._provider, txDefaults, ); + this._proxyIdIfExists = await this._proxyContract.getProxyId.callAsync(); return this._proxyContract; } + public getProxyId(): number { + this._validateProxyContractExistsOrThrow(); + return this._proxyIdIfExists as number; + } public async setBalancesAndAllowancesAsync(): Promise<void> { this._validateDummyTokenContractsExistOrThrow(); this._validateProxyContractExistsOrThrow(); @@ -57,12 +63,7 @@ export class ERC721Wrapper { for (const tokenOwnerAddress of this._tokenOwnerAddresses) { for (let i = 0; i < constants.NUM_ERC721_TOKENS_TO_MINT; i++) { const tokenId = generatePseudoRandomSalt(); - await this._web3Wrapper.awaitTransactionSuccessAsync( - await dummyTokenContract.mint.sendTransactionAsync(tokenOwnerAddress, tokenId, { - from: this._contractOwnerAddress, - }), - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await this.mintAsync(dummyTokenContract.address, tokenId, tokenOwnerAddress); if (_.isUndefined(this._initialTokenIdsByOwner[tokenOwnerAddress])) { this._initialTokenIdsByOwner[tokenOwnerAddress] = { [dummyTokenContract.address]: [], @@ -72,19 +73,104 @@ export class ERC721Wrapper { this._initialTokenIdsByOwner[tokenOwnerAddress][dummyTokenContract.address] = []; } this._initialTokenIdsByOwner[tokenOwnerAddress][dummyTokenContract.address].push(tokenId); + + await this.approveProxyAsync(dummyTokenContract.address, tokenId); } - const shouldApprove = true; - await this._web3Wrapper.awaitTransactionSuccessAsync( - await dummyTokenContract.setApprovalForAll.sendTransactionAsync( - (this._proxyContract as ERC721ProxyContract).address, - shouldApprove, - { from: tokenOwnerAddress }, - ), - constants.AWAIT_TRANSACTION_MINED_MS, - ); } } } + public async doesTokenExistAsync(tokenAddress: string, tokenId: BigNumber): Promise<boolean> { + const tokenContract = this._getTokenContractFromAssetData(tokenAddress); + const doesExist = await tokenContract.exists.callAsync(tokenId); + return doesExist; + } + public async approveProxyAsync(tokenAddress: string, tokenId: BigNumber): Promise<void> { + const proxyAddress = (this._proxyContract as ERC721ProxyContract).address; + await this.approveAsync(proxyAddress, tokenAddress, tokenId); + } + public async approveProxyForAllAsync(tokenAddress: string, tokenId: BigNumber, isApproved: boolean): Promise<void> { + const tokenContract = this._getTokenContractFromAssetData(tokenAddress); + const tokenOwner = await this.ownerOfAsync(tokenAddress, tokenId); + const proxyAddress = (this._proxyContract as ERC721ProxyContract).address; + await this._web3Wrapper.awaitTransactionSuccessAsync( + await tokenContract.setApprovalForAll.sendTransactionAsync(proxyAddress, isApproved, { + from: tokenOwner, + }), + constants.AWAIT_TRANSACTION_MINED_MS, + ); + } + public async approveAsync(to: string, tokenAddress: string, tokenId: BigNumber): Promise<void> { + const tokenContract = this._getTokenContractFromAssetData(tokenAddress); + const tokenOwner = await this.ownerOfAsync(tokenAddress, tokenId); + await this._web3Wrapper.awaitTransactionSuccessAsync( + await tokenContract.approve.sendTransactionAsync(to, tokenId, { + from: tokenOwner, + }), + constants.AWAIT_TRANSACTION_MINED_MS, + ); + } + public async transferFromAsync( + tokenAddress: string, + tokenId: BigNumber, + currentOwner: string, + userAddress: string, + ): Promise<void> { + const tokenContract = this._getTokenContractFromAssetData(tokenAddress); + await this._web3Wrapper.awaitTransactionSuccessAsync( + await tokenContract.transferFrom.sendTransactionAsync(currentOwner, userAddress, tokenId, { + from: currentOwner, + }), + constants.AWAIT_TRANSACTION_MINED_MS, + ); + } + public async mintAsync(tokenAddress: string, tokenId: BigNumber, userAddress: string): Promise<void> { + const tokenContract = this._getTokenContractFromAssetData(tokenAddress); + await this._web3Wrapper.awaitTransactionSuccessAsync( + await tokenContract.mint.sendTransactionAsync(userAddress, tokenId, { + from: this._contractOwnerAddress, + }), + constants.AWAIT_TRANSACTION_MINED_MS, + ); + } + public async burnAsync(tokenAddress: string, tokenId: BigNumber, owner: string): Promise<void> { + const tokenContract = this._getTokenContractFromAssetData(tokenAddress); + await this._web3Wrapper.awaitTransactionSuccessAsync( + await tokenContract.burn.sendTransactionAsync(owner, tokenId, { + from: this._contractOwnerAddress, + }), + constants.AWAIT_TRANSACTION_MINED_MS, + ); + } + public async ownerOfAsync(tokenAddress: string, tokenId: BigNumber): Promise<string> { + const tokenContract = this._getTokenContractFromAssetData(tokenAddress); + const owner = await tokenContract.ownerOf.callAsync(tokenId); + return owner; + } + public async isOwnerAsync(userAddress: string, tokenAddress: string, tokenId: BigNumber): Promise<boolean> { + const tokenContract = this._getTokenContractFromAssetData(tokenAddress); + const tokenOwner = await tokenContract.ownerOf.callAsync(tokenId); + const isOwner = tokenOwner === userAddress; + return isOwner; + } + public async isProxyApprovedForAllAsync( + userAddress: string, + tokenAddress: string, + tokenId: BigNumber, + ): Promise<boolean> { + this._validateProxyContractExistsOrThrow(); + const tokenContract = this._getTokenContractFromAssetData(tokenAddress); + const operator = (this._proxyContract as ERC721ProxyContract).address; + const didApproveAll = await tokenContract.isApprovedForAll.callAsync(userAddress, operator); + return didApproveAll; + } + public async isProxyApprovedAsync(tokenAddress: string, tokenId: BigNumber): Promise<boolean> { + this._validateProxyContractExistsOrThrow(); + const tokenContract = this._getTokenContractFromAssetData(tokenAddress); + const approvedAddress = await tokenContract.getApproved.callAsync(tokenId); + const proxyAddress = (this._proxyContract as ERC721ProxyContract).address; + const isProxyAnApprovedOperator = approvedAddress === proxyAddress; + return isProxyAnApprovedOperator; + } public async getBalancesAsync(): Promise<ERC721TokenIdsByOwner> { this._validateDummyTokenContractsExistOrThrow(); this._validateBalancesAndAllowancesSetOrThrow(); @@ -127,6 +213,13 @@ export class ERC721Wrapper { const tokenAddresses = _.map(this._dummyTokenContracts, dummyTokenContract => dummyTokenContract.address); return tokenAddresses; } + private _getTokenContractFromAssetData(tokenAddress: string): DummyERC721TokenContract { + const tokenContractIfExists = _.find(this._dummyTokenContracts, c => c.address === tokenAddress); + if (_.isUndefined(tokenContractIfExists)) { + throw new Error(`Token: ${tokenAddress} was not deployed through ERC20Wrapper`); + } + return tokenContractIfExists; + } private _validateDummyTokenContractsExistOrThrow(): void { if (_.isUndefined(this._dummyTokenContracts)) { throw new Error('Dummy ERC721 tokens not yet deployed, please call "deployDummyTokensAsync"'); diff --git a/packages/contracts/src/utils/exchange_wrapper.ts b/packages/contracts/src/utils/exchange_wrapper.ts index 06eb70644..ad68c8ff4 100644 --- a/packages/contracts/src/utils/exchange_wrapper.ts +++ b/packages/contracts/src/utils/exchange_wrapper.ts @@ -33,8 +33,8 @@ export class ExchangeWrapper { params.signature, { from }, ); - const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); - return tx; + const txReceipt = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); + return txReceipt; } public async cancelOrderAsync(signedOrder: SignedOrder, from: string): Promise<TransactionReceiptWithDecodedLogs> { const params = orderUtils.createCancel(signedOrder); @@ -227,6 +227,10 @@ export class ExchangeWrapper { const filledAmount = new BigNumber(await this._exchange.filled.callAsync(orderHashHex)); return filledAmount; } + public async isCancelledAsync(orderHashHex: string): Promise<boolean> { + const isCancelled = await this._exchange.cancelled.callAsync(orderHashHex); + return isCancelled; + } public async getOrderInfoAsync(signedOrder: SignedOrder): Promise<OrderInfo> { const orderInfo = (await this._exchange.getOrderInfo.callAsync(signedOrder)) as OrderInfo; return orderInfo; diff --git a/packages/contracts/src/utils/order_factory_from_scenario.ts b/packages/contracts/src/utils/order_factory_from_scenario.ts new file mode 100644 index 000000000..b150e59f6 --- /dev/null +++ b/packages/contracts/src/utils/order_factory_from_scenario.ts @@ -0,0 +1,277 @@ +import { assetProxyUtils, generatePseudoRandomSalt } from '@0xproject/order-utils'; +import { Order } from '@0xproject/types'; +import { BigNumber, errorUtils } from '@0xproject/utils'; + +import { DummyERC721TokenContract } from '../generated_contract_wrappers/dummy_e_r_c721_token'; + +import { constants } from './constants'; +import { + AssetDataScenario, + ERC721TokenIdsByOwner, + ExpirationTimeSecondsScenario, + FeeRecipientAddressScenario, + OrderAssetAmountScenario, + OrderScenario, + TakerScenario, +} from './types'; + +const TEN_UNITS_EIGHTEEN_DECIMALS = new BigNumber(10_000_000_000_000_000_000); +const FIVE_UNITS_EIGHTEEN_DECIMALS = new BigNumber(5_000_000_000_000_000_000); +const POINT_ONE_UNITS_EIGHTEEN_DECIMALS = new BigNumber(100_000_000_000_000_000); +const POINT_ZERO_FIVE_UNITS_EIGHTEEN_DECIMALS = new BigNumber(50_000_000_000_000_000); +const TEN_UNITS_FIVE_DECIMALS = new BigNumber(1_000_000); +const FIVE_UNITS_FIVE_DECIMALS = new BigNumber(500_000); +const ONE_NFT_UNIT = new BigNumber(1); + +export class OrderFactoryFromScenario { + private _userAddresses: string[]; + private _zrxAddress: string; + private _nonZrxERC20EighteenDecimalTokenAddresses: string[]; + private _erc20FiveDecimalTokenAddresses: string[]; + private _erc721Token: DummyERC721TokenContract; + private _erc721Balances: ERC721TokenIdsByOwner; + private _exchangeAddress: string; + constructor( + userAddresses: string[], + zrxAddress: string, + nonZrxERC20EighteenDecimalTokenAddresses: string[], + erc20FiveDecimalTokenAddresses: string[], + erc721Token: DummyERC721TokenContract, + erc721Balances: ERC721TokenIdsByOwner, + exchangeAddress: string, + ) { + this._userAddresses = userAddresses; + this._zrxAddress = zrxAddress; + this._nonZrxERC20EighteenDecimalTokenAddresses = nonZrxERC20EighteenDecimalTokenAddresses; + this._erc20FiveDecimalTokenAddresses = erc20FiveDecimalTokenAddresses; + this._erc721Token = erc721Token; + this._erc721Balances = erc721Balances; + this._exchangeAddress = exchangeAddress; + } + public generateOrder(orderScenario: OrderScenario): Order { + const makerAddress = this._userAddresses[1]; + let takerAddress = this._userAddresses[2]; + const erc721MakerAssetIds = this._erc721Balances[makerAddress][this._erc721Token.address]; + const erc721TakerAssetIds = this._erc721Balances[takerAddress][this._erc721Token.address]; + let feeRecipientAddress; + let makerAssetAmount; + let takerAssetAmount; + let makerFee; + let takerFee; + let expirationTimeSeconds; + let makerAssetData; + let takerAssetData; + + switch (orderScenario.feeRecipientScenario) { + case FeeRecipientAddressScenario.BurnAddress: + feeRecipientAddress = constants.NULL_ADDRESS; + break; + case FeeRecipientAddressScenario.EthUserAddress: + feeRecipientAddress = this._userAddresses[4]; + break; + default: + throw errorUtils.spawnSwitchErr('FeeRecipientAddressScenario', orderScenario.feeRecipientScenario); + } + + switch (orderScenario.makerAssetDataScenario) { + case AssetDataScenario.ZRXFeeToken: + makerAssetData = assetProxyUtils.encodeERC20AssetData(this._zrxAddress); + break; + case AssetDataScenario.ERC20NonZRXEighteenDecimals: + makerAssetData = assetProxyUtils.encodeERC20AssetData( + this._nonZrxERC20EighteenDecimalTokenAddresses[0], + ); + break; + case AssetDataScenario.ERC20FiveDecimals: + makerAssetData = assetProxyUtils.encodeERC20AssetData(this._erc20FiveDecimalTokenAddresses[0]); + break; + case AssetDataScenario.ERC721: + makerAssetData = assetProxyUtils.encodeERC721AssetData( + this._erc721Token.address, + erc721MakerAssetIds[0], + ); + break; + default: + throw errorUtils.spawnSwitchErr('AssetDataScenario', orderScenario.makerAssetDataScenario); + } + + switch (orderScenario.takerAssetDataScenario) { + case AssetDataScenario.ZRXFeeToken: + takerAssetData = assetProxyUtils.encodeERC20AssetData(this._zrxAddress); + break; + case AssetDataScenario.ERC20NonZRXEighteenDecimals: + takerAssetData = assetProxyUtils.encodeERC20AssetData( + this._nonZrxERC20EighteenDecimalTokenAddresses[1], + ); + break; + case AssetDataScenario.ERC20FiveDecimals: + takerAssetData = assetProxyUtils.encodeERC20AssetData(this._erc20FiveDecimalTokenAddresses[1]); + break; + case AssetDataScenario.ERC721: + takerAssetData = assetProxyUtils.encodeERC721AssetData( + this._erc721Token.address, + erc721TakerAssetIds[0], + ); + break; + default: + throw errorUtils.spawnSwitchErr('AssetDataScenario', orderScenario.takerAssetDataScenario); + } + + switch (orderScenario.makerAssetAmountScenario) { + case OrderAssetAmountScenario.Large: + switch (orderScenario.makerAssetDataScenario) { + case AssetDataScenario.ZRXFeeToken: + case AssetDataScenario.ERC20NonZRXEighteenDecimals: + makerAssetAmount = TEN_UNITS_EIGHTEEN_DECIMALS; + break; + case AssetDataScenario.ERC20FiveDecimals: + makerAssetAmount = TEN_UNITS_FIVE_DECIMALS; + break; + case AssetDataScenario.ERC721: + makerAssetAmount = ONE_NFT_UNIT; + break; + default: + throw errorUtils.spawnSwitchErr('AssetDataScenario', orderScenario.makerAssetDataScenario); + } + break; + case OrderAssetAmountScenario.Small: + switch (orderScenario.makerAssetDataScenario) { + case AssetDataScenario.ZRXFeeToken: + case AssetDataScenario.ERC20NonZRXEighteenDecimals: + makerAssetAmount = FIVE_UNITS_EIGHTEEN_DECIMALS; + break; + case AssetDataScenario.ERC20FiveDecimals: + makerAssetAmount = FIVE_UNITS_FIVE_DECIMALS; + break; + case AssetDataScenario.ERC721: + makerAssetAmount = ONE_NFT_UNIT; + break; + default: + throw errorUtils.spawnSwitchErr('AssetDataScenario', orderScenario.makerAssetDataScenario); + } + break; + case OrderAssetAmountScenario.Zero: + makerAssetAmount = new BigNumber(0); + break; + default: + throw errorUtils.spawnSwitchErr('OrderAssetAmountScenario', orderScenario.makerAssetAmountScenario); + } + + switch (orderScenario.takerAssetAmountScenario) { + case OrderAssetAmountScenario.Large: + switch (orderScenario.takerAssetDataScenario) { + case AssetDataScenario.ERC20NonZRXEighteenDecimals: + case AssetDataScenario.ZRXFeeToken: + takerAssetAmount = TEN_UNITS_EIGHTEEN_DECIMALS; + break; + case AssetDataScenario.ERC20FiveDecimals: + takerAssetAmount = TEN_UNITS_FIVE_DECIMALS; + break; + case AssetDataScenario.ERC721: + takerAssetAmount = ONE_NFT_UNIT; + break; + default: + throw errorUtils.spawnSwitchErr('AssetDataScenario', orderScenario.takerAssetDataScenario); + } + break; + case OrderAssetAmountScenario.Small: + switch (orderScenario.takerAssetDataScenario) { + case AssetDataScenario.ERC20NonZRXEighteenDecimals: + case AssetDataScenario.ZRXFeeToken: + takerAssetAmount = FIVE_UNITS_EIGHTEEN_DECIMALS; + break; + case AssetDataScenario.ERC20FiveDecimals: + takerAssetAmount = FIVE_UNITS_FIVE_DECIMALS; + break; + case AssetDataScenario.ERC721: + takerAssetAmount = ONE_NFT_UNIT; + break; + default: + throw errorUtils.spawnSwitchErr('AssetDataScenario', orderScenario.takerAssetDataScenario); + } + break; + case OrderAssetAmountScenario.Zero: + takerAssetAmount = new BigNumber(0); + break; + default: + throw errorUtils.spawnSwitchErr('OrderAssetAmountScenario', orderScenario.takerAssetAmountScenario); + } + + switch (orderScenario.makerFeeScenario) { + case OrderAssetAmountScenario.Large: + makerFee = POINT_ONE_UNITS_EIGHTEEN_DECIMALS; + break; + case OrderAssetAmountScenario.Small: + makerFee = POINT_ZERO_FIVE_UNITS_EIGHTEEN_DECIMALS; + break; + case OrderAssetAmountScenario.Zero: + makerFee = new BigNumber(0); + break; + default: + throw errorUtils.spawnSwitchErr('OrderAssetAmountScenario', orderScenario.makerFeeScenario); + } + + switch (orderScenario.takerFeeScenario) { + case OrderAssetAmountScenario.Large: + takerFee = POINT_ONE_UNITS_EIGHTEEN_DECIMALS; + break; + case OrderAssetAmountScenario.Small: + takerFee = POINT_ZERO_FIVE_UNITS_EIGHTEEN_DECIMALS; + break; + case OrderAssetAmountScenario.Zero: + takerFee = new BigNumber(0); + break; + default: + throw errorUtils.spawnSwitchErr('OrderAssetAmountScenario', orderScenario.takerFeeScenario); + } + + switch (orderScenario.expirationTimeSecondsScenario) { + case ExpirationTimeSecondsScenario.InFuture: + expirationTimeSeconds = new BigNumber(2524604400); // Close to infinite + break; + case ExpirationTimeSecondsScenario.InPast: + expirationTimeSeconds = new BigNumber(0); // Jan 1, 1970 + break; + default: + throw errorUtils.spawnSwitchErr( + 'ExpirationTimeSecondsScenario', + orderScenario.expirationTimeSecondsScenario, + ); + } + + switch (orderScenario.takerScenario) { + case TakerScenario.CorrectlySpecified: + break; // noop since takerAddress is already specified + + case TakerScenario.IncorrectlySpecified: + const notTaker = this._userAddresses[3]; + takerAddress = notTaker; + break; + + case TakerScenario.Unspecified: + takerAddress = constants.NULL_ADDRESS; + break; + + default: + throw errorUtils.spawnSwitchErr('TakerScenario', orderScenario.takerScenario); + } + + const order = { + senderAddress: constants.NULL_ADDRESS, + makerAddress, + takerAddress, + makerFee, + takerFee, + makerAssetAmount, + takerAssetAmount, + makerAssetData, + takerAssetData, + salt: generatePseudoRandomSalt(), + exchangeAddress: this._exchangeAddress, + feeRecipientAddress, + expirationTimeSeconds, + }; + + return order; + } +} diff --git a/packages/contracts/src/utils/order_utils.ts b/packages/contracts/src/utils/order_utils.ts index a9f994d80..019f6e74b 100644 --- a/packages/contracts/src/utils/order_utils.ts +++ b/packages/contracts/src/utils/order_utils.ts @@ -5,6 +5,13 @@ import { constants } from './constants'; import { CancelOrder, MatchOrder } from './types'; export const orderUtils = { + getPartialAmount(numerator: BigNumber, denominator: BigNumber, target: BigNumber): BigNumber { + const partialAmount = numerator + .mul(target) + .div(denominator) + .floor(); + return partialAmount; + }, createFill: (signedOrder: SignedOrder, takerAssetFillAmount?: BigNumber) => { const fill = { order: orderUtils.getOrderWithoutExchangeAddress(signedOrder), diff --git a/packages/contracts/src/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts b/packages/contracts/src/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts new file mode 100644 index 000000000..a295a40c4 --- /dev/null +++ b/packages/contracts/src/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts @@ -0,0 +1,19 @@ +import { AbstractBalanceAndProxyAllowanceFetcher } from '@0xproject/order-utils'; +import { BigNumber } from '@0xproject/utils'; + +import { AssetWrapper } from './asset_wrapper'; + +export class SimpleAssetBalanceAndProxyAllowanceFetcher implements AbstractBalanceAndProxyAllowanceFetcher { + private _assetWrapper: AssetWrapper; + constructor(assetWrapper: AssetWrapper) { + this._assetWrapper = assetWrapper; + } + public async getBalanceAsync(assetData: string, userAddress: string): Promise<BigNumber> { + const balance = await this._assetWrapper.getBalanceAsync(userAddress, assetData); + return balance; + } + public async getProxyAllowanceAsync(assetData: string, userAddress: string): Promise<BigNumber> { + const proxyAllowance = await this._assetWrapper.getProxyAllowanceAsync(userAddress, assetData); + return proxyAllowance; + } +} diff --git a/packages/contracts/src/utils/simple_order_filled_cancelled_fetcher.ts b/packages/contracts/src/utils/simple_order_filled_cancelled_fetcher.ts new file mode 100644 index 000000000..24afe36b7 --- /dev/null +++ b/packages/contracts/src/utils/simple_order_filled_cancelled_fetcher.ts @@ -0,0 +1,24 @@ +import { AbstractOrderFilledCancelledFetcher } from '@0xproject/order-utils'; +import { BigNumber } from '@0xproject/utils'; + +import { ExchangeWrapper } from './exchange_wrapper'; + +export class SimpleOrderFilledCancelledFetcher implements AbstractOrderFilledCancelledFetcher { + private _exchangeWrapper: ExchangeWrapper; + private _zrxAssetData: string; + constructor(exchange: ExchangeWrapper, zrxAssetData: string) { + this._exchangeWrapper = exchange; + this._zrxAssetData = zrxAssetData; + } + public async getFilledTakerAmountAsync(orderHash: string): Promise<BigNumber> { + const filledTakerAmount = new BigNumber(await this._exchangeWrapper.getTakerAssetFilledAmountAsync(orderHash)); + return filledTakerAmount; + } + public async isOrderCancelledAsync(orderHash: string): Promise<boolean> { + const isCancelled = await this._exchangeWrapper.isCancelledAsync(orderHash); + return isCancelled; + } + public getZRXAssetData(): string { + return this._zrxAssetData; + } +} diff --git a/packages/contracts/src/utils/types.ts b/packages/contracts/src/utils/types.ts index 5dfac64fc..b792bb90a 100644 --- a/packages/contracts/src/utils/types.ts +++ b/packages/contracts/src/utils/types.ts @@ -150,3 +150,80 @@ export interface MatchOrder { leftSignature: string; rightSignature: string; } + +// Combinatorial testing types + +export enum FeeRecipientAddressScenario { + BurnAddress = 'BURN_ADDRESS', + EthUserAddress = 'ETH_USER_ADDRESS', +} + +export enum OrderAssetAmountScenario { + Zero = 'ZERO', + Large = 'LARGE', + Small = 'SMALL', +} + +export enum TakerScenario { + CorrectlySpecified = 'CORRECTLY_SPECIFIED', + IncorrectlySpecified = 'INCORRECTLY_SPECIFIED', + Unspecified = 'UNSPECIFIED', +} + +export enum ExpirationTimeSecondsScenario { + InPast = 'IN_PAST', + InFuture = 'IN_FUTURE', +} + +export enum AssetDataScenario { + ERC721 = 'ERC721', + ZRXFeeToken = 'ZRX_FEE_TOKEN', + ERC20FiveDecimals = 'ERC20_FIVE_DECIMALS', + ERC20NonZRXEighteenDecimals = 'ERC20_NON_ZRX_EIGHTEEN_DECIMALS', +} + +export enum TakerAssetFillAmountScenario { + Zero = 'ZERO', + GreaterThanRemainingFillableTakerAssetAmount = 'GREATER_THAN_REMAINING_FILLABLE_TAKER_ASSET_AMOUNT', + LessThanRemainingFillableTakerAssetAmount = 'LESS_THAN_REMAINING_FILLABLE_TAKER_ASSET_AMOUNT', + ExactlyRemainingFillableTakerAssetAmount = 'EXACTLY_REMAINING_FILLABLE_TAKER_ASSET_AMOUNT', +} + +export interface OrderScenario { + takerScenario: TakerScenario; + feeRecipientScenario: FeeRecipientAddressScenario; + makerAssetAmountScenario: OrderAssetAmountScenario; + takerAssetAmountScenario: OrderAssetAmountScenario; + makerFeeScenario: OrderAssetAmountScenario; + takerFeeScenario: OrderAssetAmountScenario; + expirationTimeSecondsScenario: ExpirationTimeSecondsScenario; + makerAssetDataScenario: AssetDataScenario; + takerAssetDataScenario: AssetDataScenario; +} + +export enum BalanceAmountScenario { + Exact = 'EXACT', + TooLow = 'TOO_LOW', + Higher = 'HIGHER', +} + +export enum AllowanceAmountScenario { + Exact = 'EXACT', + TooLow = 'TOO_LOW', + Higher = 'HIGHER', + Unlimited = 'UNLIMITED', +} + +export interface TraderStateScenario { + traderAssetBalance: BalanceAmountScenario; + traderAssetAllowance: AllowanceAmountScenario; + zrxFeeBalance: BalanceAmountScenario; + zrxFeeAllowance: AllowanceAmountScenario; +} + +export interface FillScenario { + orderScenario: OrderScenario; + takerAssetFillAmountScenario: TakerAssetFillAmountScenario; + makerStateScenario: TraderStateScenario; + takerStateScenario: TraderStateScenario; +} diff --git a/packages/contracts/test/asset_proxy/proxies.ts b/packages/contracts/test/asset_proxy/proxies.ts index d07d82235..f99f03875 100644 --- a/packages/contracts/test/asset_proxy/proxies.ts +++ b/packages/contracts/test/asset_proxy/proxies.ts @@ -62,7 +62,10 @@ describe('Asset Transfer Proxies', () => { erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner); erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner); - [zrxToken] = await erc20Wrapper.deployDummyTokensAsync(); + [zrxToken] = await erc20Wrapper.deployDummyTokensAsync( + constants.NUM_DUMMY_ERC20_TO_DEPLOY, + constants.DUMMY_TOKEN_DECIMALS, + ); erc20Proxy = await erc20Wrapper.deployProxyAsync(); await erc20Wrapper.setBalancesAndAllowancesAsync(); await web3Wrapper.awaitTransactionSuccessAsync( @@ -488,7 +491,8 @@ describe('Asset Transfer Proxies', () => { txHash, constants.AWAIT_TRANSACTION_MINED_MS, ); - expect(res.logs.length).to.equal(numTransfers); + const numApproveEvents = 2; + expect(res.logs.length).to.equal(numTransfers + numApproveEvents); const newOwnerMakerAssetA = await erc721Token.ownerOf.callAsync(makerTokenIdA); const newOwnerMakerAssetB = await erc721Token.ownerOf.callAsync(makerTokenIdB); diff --git a/packages/contracts/test/exchange/combinatorial_tests.ts b/packages/contracts/test/exchange/combinatorial_tests.ts new file mode 100644 index 000000000..754af9b08 --- /dev/null +++ b/packages/contracts/test/exchange/combinatorial_tests.ts @@ -0,0 +1,48 @@ +import { BlockchainLifecycle } from '@0xproject/dev-utils'; +import * as _ from 'lodash'; + +import { chaiSetup } from '../../src/utils/chai_setup'; +import { CoreCombinatorialUtils, coreCombinatorialUtilsFactoryAsync } from '../../src/utils/core_combinatorial_utils'; +import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; + +import { FillScenario, OrderScenario, TakerAssetFillAmountScenario } from '../../src/utils/types'; + +chaiSetup.configure(); +const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); + +describe('Combinatorial tests', () => { + let coreCombinatorialUtils: CoreCombinatorialUtils; + + before(async () => { + await blockchainLifecycle.startAsync(); + coreCombinatorialUtils = await coreCombinatorialUtilsFactoryAsync(web3Wrapper, txDefaults); + }); + after(async () => { + await blockchainLifecycle.revertAsync(); + }); + beforeEach(async () => { + await blockchainLifecycle.startAsync(); + }); + afterEach(async () => { + await blockchainLifecycle.revertAsync(); + }); + const test = (fillScenarios: FillScenario[]) => { + _.forEach(fillScenarios, fillScenario => { + const orderScenario = fillScenario.orderScenario; + const description = `Combinatorial OrderFill: ${orderScenario.feeRecipientScenario} ${ + orderScenario.makerAssetAmountScenario + } ${orderScenario.takerAssetAmountScenario} ${orderScenario.makerFeeScenario} ${ + orderScenario.takerFeeScenario + } ${orderScenario.expirationTimeSecondsScenario} ${orderScenario.makerAssetDataScenario} ${ + orderScenario.takerAssetDataScenario + }`; + it(description, async () => { + await coreCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario); + }); + }); + }; + + const allFillScenarios = CoreCombinatorialUtils.generateFillOrderCombinations(); + + describe('Fills orders', () => test(allFillScenarios)); +}); diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index 3b8a369b4..449bc5601 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -74,7 +74,10 @@ describe('Exchange core', () => { erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner); erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner); - [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(); + [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync( + constants.NUM_DUMMY_ERC20_TO_DEPLOY, + constants.DUMMY_TOKEN_DECIMALS, + ); erc20Proxy = await erc20Wrapper.deployProxyAsync(); await erc20Wrapper.setBalancesAndAllowancesAsync(); @@ -133,296 +136,6 @@ describe('Exchange core', () => { erc20Balances = await erc20Wrapper.getBalancesAsync(); signedOrder = orderFactory.newSignedOrder(); }); - it('should transfer the correct amounts when makerAssetAmount === takerAssetAmount', async () => { - signedOrder = orderFactory.newSignedOrder({ - makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18), - takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18), - }); - - const takerAssetFilledAmountBefore = await exchangeWrapper.getTakerAssetFilledAmountAsync( - orderHashUtils.getOrderHashHex(signedOrder), - ); - expect(takerAssetFilledAmountBefore).to.be.bignumber.equal(0); - - const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2); - await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }); - - const makerAmountBoughtAfter = await exchangeWrapper.getTakerAssetFilledAmountAsync( - orderHashUtils.getOrderHashHex(signedOrder), - ); - expect(makerAmountBoughtAfter).to.be.bignumber.equal(takerAssetFillAmount); - - const newBalances = await erc20Wrapper.getBalancesAsync(); - - const makerAssetFilledAmount = takerAssetFillAmount - .times(signedOrder.makerAssetAmount) - .dividedToIntegerBy(signedOrder.takerAssetAmount); - const makerFeePaid = signedOrder.makerFee - .times(makerAssetFilledAmount) - .dividedToIntegerBy(signedOrder.makerAssetAmount); - const takerFeePaid = signedOrder.takerFee - .times(makerAssetFilledAmount) - .dividedToIntegerBy(signedOrder.makerAssetAmount); - expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal( - erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount), - ); - expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal( - erc20Balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount), - ); - expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal( - erc20Balances[makerAddress][zrxToken.address].minus(makerFeePaid), - ); - expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal( - erc20Balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount), - ); - expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal( - erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount), - ); - expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal( - erc20Balances[takerAddress][zrxToken.address].minus(takerFeePaid), - ); - expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal( - erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.add(takerFeePaid)), - ); - }); - - it('should transfer the correct amounts when makerAssetAmount > takerAssetAmount', async () => { - signedOrder = orderFactory.newSignedOrder({ - makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18), - takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18), - }); - - const takerAssetFilledAmountBefore = await exchangeWrapper.getTakerAssetFilledAmountAsync( - orderHashUtils.getOrderHashHex(signedOrder), - ); - expect(takerAssetFilledAmountBefore).to.be.bignumber.equal(0); - - const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2); - await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }); - - const makerAmountBoughtAfter = await exchangeWrapper.getTakerAssetFilledAmountAsync( - orderHashUtils.getOrderHashHex(signedOrder), - ); - expect(makerAmountBoughtAfter).to.be.bignumber.equal(takerAssetFillAmount); - - const newBalances = await erc20Wrapper.getBalancesAsync(); - - const makerAssetFilledAmount = takerAssetFillAmount - .times(signedOrder.makerAssetAmount) - .dividedToIntegerBy(signedOrder.takerAssetAmount); - const makerFeePaid = signedOrder.makerFee - .times(makerAssetFilledAmount) - .dividedToIntegerBy(signedOrder.makerAssetAmount); - const takerFeePaid = signedOrder.takerFee - .times(makerAssetFilledAmount) - .dividedToIntegerBy(signedOrder.makerAssetAmount); - expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal( - erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount), - ); - expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal( - erc20Balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount), - ); - expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal( - erc20Balances[makerAddress][zrxToken.address].minus(makerFeePaid), - ); - expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal( - erc20Balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount), - ); - expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal( - erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount), - ); - expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal( - erc20Balances[takerAddress][zrxToken.address].minus(takerFeePaid), - ); - expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal( - erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.add(takerFeePaid)), - ); - }); - - it('should transfer the correct amounts when makerAssetAmount < takerAssetAmount', async () => { - signedOrder = orderFactory.newSignedOrder({ - makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18), - takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18), - }); - - const takerAssetFilledAmountBefore = await exchangeWrapper.getTakerAssetFilledAmountAsync( - orderHashUtils.getOrderHashHex(signedOrder), - ); - expect(takerAssetFilledAmountBefore).to.be.bignumber.equal(0); - - const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2); - await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }); - - const makerAmountBoughtAfter = await exchangeWrapper.getTakerAssetFilledAmountAsync( - orderHashUtils.getOrderHashHex(signedOrder), - ); - expect(makerAmountBoughtAfter).to.be.bignumber.equal(takerAssetFillAmount); - - const newBalances = await erc20Wrapper.getBalancesAsync(); - - const makerAssetFilledAmount = takerAssetFillAmount - .times(signedOrder.makerAssetAmount) - .dividedToIntegerBy(signedOrder.takerAssetAmount); - const makerFeePaid = signedOrder.makerFee - .times(makerAssetFilledAmount) - .dividedToIntegerBy(signedOrder.makerAssetAmount); - const takerFeePaid = signedOrder.takerFee - .times(makerAssetFilledAmount) - .dividedToIntegerBy(signedOrder.makerAssetAmount); - expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal( - erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount), - ); - expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal( - erc20Balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount), - ); - expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal( - erc20Balances[makerAddress][zrxToken.address].minus(makerFeePaid), - ); - expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal( - erc20Balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount), - ); - expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal( - erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount), - ); - expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal( - erc20Balances[takerAddress][zrxToken.address].minus(takerFeePaid), - ); - expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal( - erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.add(takerFeePaid)), - ); - }); - - it('should transfer the correct amounts when taker is specified and order is claimed by taker', async () => { - signedOrder = orderFactory.newSignedOrder({ - takerAddress, - makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18), - takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18), - }); - - const takerAssetFilledAmountBefore = await exchangeWrapper.getTakerAssetFilledAmountAsync( - orderHashUtils.getOrderHashHex(signedOrder), - ); - expect(takerAssetFilledAmountBefore).to.be.bignumber.equal(0); - - const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2); - await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }); - - const makerAmountBoughtAfter = await exchangeWrapper.getTakerAssetFilledAmountAsync( - orderHashUtils.getOrderHashHex(signedOrder), - ); - const expectedMakerAmountBoughtAfter = takerAssetFillAmount.add(takerAssetFilledAmountBefore); - expect(makerAmountBoughtAfter).to.be.bignumber.equal(expectedMakerAmountBoughtAfter); - - const newBalances = await erc20Wrapper.getBalancesAsync(); - - const makerAssetFilledAmount = takerAssetFillAmount - .times(signedOrder.makerAssetAmount) - .dividedToIntegerBy(signedOrder.takerAssetAmount); - const makerFeePaid = signedOrder.makerFee - .times(makerAssetFilledAmount) - .dividedToIntegerBy(signedOrder.makerAssetAmount); - const takerFeePaid = signedOrder.takerFee - .times(makerAssetFilledAmount) - .dividedToIntegerBy(signedOrder.makerAssetAmount); - expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal( - erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount), - ); - expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal( - erc20Balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount), - ); - expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal( - erc20Balances[makerAddress][zrxToken.address].minus(makerFeePaid), - ); - expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal( - erc20Balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount), - ); - expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal( - erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount), - ); - expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal( - erc20Balances[takerAddress][zrxToken.address].minus(takerFeePaid), - ); - expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal( - erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.add(takerFeePaid)), - ); - }); - - it('should fill remaining value if takerAssetFillAmount > remaining takerAssetAmount', async () => { - const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2); - await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }); - - const res = await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { - takerAssetFillAmount: signedOrder.takerAssetAmount, - }); - const log = res.logs[0] as LogWithDecodedArgs<FillContractEventArgs>; - expect(log.args.takerAssetFilledAmount).to.be.bignumber.equal( - signedOrder.takerAssetAmount.minus(takerAssetFillAmount), - ); - const newBalances = await erc20Wrapper.getBalancesAsync(); - - expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal( - erc20Balances[makerAddress][defaultMakerAssetAddress].minus(signedOrder.makerAssetAmount), - ); - expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal( - erc20Balances[makerAddress][defaultTakerAssetAddress].add(signedOrder.takerAssetAmount), - ); - expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal( - erc20Balances[makerAddress][zrxToken.address].minus(signedOrder.makerFee), - ); - expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal( - erc20Balances[takerAddress][defaultTakerAssetAddress].minus(signedOrder.takerAssetAmount), - ); - expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal( - erc20Balances[takerAddress][defaultMakerAssetAddress].add(signedOrder.makerAssetAmount), - ); - expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal( - erc20Balances[takerAddress][zrxToken.address].minus(signedOrder.takerFee), - ); - expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal( - erc20Balances[feeRecipientAddress][zrxToken.address].add( - signedOrder.makerFee.add(signedOrder.takerFee), - ), - ); - }); - - it('should log 1 event with the correct arguments when order has a feeRecipient', async () => { - const divisor = 2; - const res = await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { - takerAssetFillAmount: signedOrder.takerAssetAmount.div(divisor), - }); - expect(res.logs).to.have.length(1); - - const log = res.logs[0] as LogWithDecodedArgs<FillContractEventArgs>; - const logArgs = log.args; - const expectedFilledMakerAssetAmount = signedOrder.makerAssetAmount.div(divisor); - const expectedFilledTakerAssetAmount = signedOrder.takerAssetAmount.div(divisor); - const expectedFeeMPaid = signedOrder.makerFee.div(divisor); - const expectedFeeTPaid = signedOrder.takerFee.div(divisor); - - expect(signedOrder.makerAddress).to.be.equal(logArgs.makerAddress); - expect(takerAddress).to.be.equal(logArgs.takerAddress); - expect(takerAddress).to.be.equal(logArgs.senderAddress); - expect(signedOrder.feeRecipientAddress).to.be.equal(logArgs.feeRecipientAddress); - expect(signedOrder.makerAssetData).to.be.equal(logArgs.makerAssetData); - expect(signedOrder.takerAssetData).to.be.equal(logArgs.takerAssetData); - expect(expectedFilledMakerAssetAmount).to.be.bignumber.equal(logArgs.makerAssetFilledAmount); - expect(expectedFilledTakerAssetAmount).to.be.bignumber.equal(logArgs.takerAssetFilledAmount); - expect(expectedFeeMPaid).to.be.bignumber.equal(logArgs.makerFeePaid); - expect(expectedFeeTPaid).to.be.bignumber.equal(logArgs.takerFeePaid); - expect(orderHashUtils.getOrderHashHex(signedOrder)).to.be.equal(logArgs.orderHash); - }); - - it('should throw when taker is specified and order is claimed by other', async () => { - signedOrder = orderFactory.newSignedOrder({ - takerAddress: feeRecipientAddress, - makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18), - takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18), - }); - return expectRevertReasonOrAlwaysFailingTransactionAsync( - exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - RevertReasons.InvalidTaker, - ); - }); it('should throw if signature is invalid', async () => { signedOrder = orderFactory.newSignedOrder({ @@ -442,96 +155,6 @@ describe('Exchange core', () => { ); }); - it('should throw if makerAssetAmount is 0', async () => { - signedOrder = orderFactory.newSignedOrder({ - makerAssetAmount: new BigNumber(0), - }); - - return expectRevertReasonOrAlwaysFailingTransactionAsync( - exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - RevertReasons.OrderUnfillable, - ); - }); - - it('should throw if takerAssetAmount is 0', async () => { - signedOrder = orderFactory.newSignedOrder({ - takerAssetAmount: new BigNumber(0), - }); - - return expectRevertReasonOrAlwaysFailingTransactionAsync( - exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - RevertReasons.OrderUnfillable, - ); - }); - - it('should throw if takerAssetFillAmount is 0', async () => { - signedOrder = orderFactory.newSignedOrder(); - - return expectRevertReasonOrAlwaysFailingTransactionAsync( - exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { - takerAssetFillAmount: new BigNumber(0), - }), - RevertReasons.InvalidTakerAmount, - ); - }); - - it('should throw if maker erc20Balances are too low to fill order', async () => { - signedOrder = orderFactory.newSignedOrder({ - makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18), - }); - - return expectRevertReasonOrAlwaysFailingTransactionAsync( - exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - RevertReasons.TransferFailed, - ); - }); - - it('should throw if taker erc20Balances are too low to fill order', async () => { - signedOrder = orderFactory.newSignedOrder({ - takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18), - }); - return expectRevertReasonOrAlwaysFailingTransactionAsync( - exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - RevertReasons.TransferFailed, - ); - }); - - it('should throw if maker allowances are too low to fill order', async () => { - await web3Wrapper.awaitTransactionSuccessAsync( - await erc20TokenA.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), { - from: makerAddress, - }), - constants.AWAIT_TRANSACTION_MINED_MS, - ); - return expectRevertReasonOrAlwaysFailingTransactionAsync( - exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - RevertReasons.TransferFailed, - ); - }); - - it('should throw if taker allowances are too low to fill order', async () => { - await web3Wrapper.awaitTransactionSuccessAsync( - await erc20TokenB.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), { - from: takerAddress, - }), - constants.AWAIT_TRANSACTION_MINED_MS, - ); - return expectRevertReasonOrAlwaysFailingTransactionAsync( - exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - RevertReasons.TransferFailed, - ); - }); - - it('should throw if an order is expired', async () => { - signedOrder = orderFactory.newSignedOrder({ - expirationTimeSeconds: new BigNumber(Math.floor((Date.now() - 10000) / 1000)), - }); - return expectRevertReasonOrAlwaysFailingTransactionAsync( - exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - RevertReasons.OrderUnfillable, - ); - }); - it('should throw if no value is filled', async () => { signedOrder = orderFactory.newSignedOrder(); await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress); @@ -728,32 +351,6 @@ describe('Exchange core', () => { }); describe('Testing Exchange of ERC721 Tokens', () => { - it('should successfully exchange a single token between the maker and taker (via fillOrder)', async () => { - // Construct Exchange parameters - const makerAssetId = erc721MakerAssetIds[0]; - const takerAssetId = erc721TakerAssetIds[1]; - signedOrder = orderFactory.newSignedOrder({ - makerAssetAmount: new BigNumber(1), - takerAssetAmount: new BigNumber(1), - makerAssetData: assetProxyUtils.encodeERC721AssetData(erc721Token.address, makerAssetId), - takerAssetData: assetProxyUtils.encodeERC721AssetData(erc721Token.address, takerAssetId), - }); - // Verify pre-conditions - const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId); - expect(initialOwnerMakerAsset).to.be.bignumber.equal(makerAddress); - const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId); - expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress); - // Call Exchange - const takerAssetFillAmount = signedOrder.takerAssetAmount; - // tslint:disable-next-line:no-unused-variable - const res = await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }); - // Verify post-conditions - const newOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId); - expect(newOwnerMakerAsset).to.be.bignumber.equal(takerAddress); - const newOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId); - expect(newOwnerTakerAsset).to.be.bignumber.equal(makerAddress); - }); - it('should throw when maker does not own the token with id makerAssetId', async () => { // Construct Exchange parameters const makerAssetId = erc721TakerAssetIds[0]; @@ -860,86 +457,6 @@ describe('Exchange core', () => { RevertReasons.RoundingError, ); }); - - it('should successfully fill order when makerAsset is ERC721 and takerAsset is ERC20', async () => { - // Construct Exchange parameters - const makerAssetId = erc721MakerAssetIds[0]; - signedOrder = orderFactory.newSignedOrder({ - makerAssetAmount: new BigNumber(1), - takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18), - makerAssetData: assetProxyUtils.encodeERC721AssetData(erc721Token.address, makerAssetId), - takerAssetData: assetProxyUtils.encodeERC20AssetData(defaultTakerAssetAddress), - }); - // Verify pre-conditions - const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId); - expect(initialOwnerMakerAsset).to.be.bignumber.equal(makerAddress); - // Call Exchange - erc20Balances = await erc20Wrapper.getBalancesAsync(); - const takerAssetFillAmount = signedOrder.takerAssetAmount; - await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }); - // Verify ERC721 token was transferred from Maker to Taker - const newOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId); - expect(newOwnerMakerAsset).to.be.bignumber.equal(takerAddress); - // Verify ERC20 tokens were transferred from Taker to Maker & fees were paid correctly - const newBalances = await erc20Wrapper.getBalancesAsync(); - expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal( - erc20Balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount), - ); - expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal( - erc20Balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount), - ); - expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal( - erc20Balances[makerAddress][zrxToken.address].minus(signedOrder.makerFee), - ); - expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal( - erc20Balances[takerAddress][zrxToken.address].minus(signedOrder.takerFee), - ); - expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal( - erc20Balances[feeRecipientAddress][zrxToken.address].add( - signedOrder.makerFee.add(signedOrder.takerFee), - ), - ); - }); - - it('should successfully fill order when makerAsset is ERC20 and takerAsset is ERC721', async () => { - // Construct Exchange parameters - const takerAssetId = erc721TakerAssetIds[0]; - signedOrder = orderFactory.newSignedOrder({ - takerAssetAmount: new BigNumber(1), - makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18), - takerAssetData: assetProxyUtils.encodeERC721AssetData(erc721Token.address, takerAssetId), - makerAssetData: assetProxyUtils.encodeERC20AssetData(defaultMakerAssetAddress), - }); - // Verify pre-conditions - const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId); - expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress); - // Call Exchange - erc20Balances = await erc20Wrapper.getBalancesAsync(); - const takerAssetFillAmount = signedOrder.takerAssetAmount; - await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }); - // Verify ERC721 token was transferred from Taker to Maker - const newOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId); - expect(newOwnerTakerAsset).to.be.bignumber.equal(makerAddress); - // Verify ERC20 tokens were transferred from Maker to Taker & fees were paid correctly - const newBalances = await erc20Wrapper.getBalancesAsync(); - expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal( - erc20Balances[takerAddress][defaultMakerAssetAddress].add(signedOrder.makerAssetAmount), - ); - expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal( - erc20Balances[makerAddress][defaultMakerAssetAddress].minus(signedOrder.makerAssetAmount), - ); - expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal( - erc20Balances[makerAddress][zrxToken.address].minus(signedOrder.makerFee), - ); - expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal( - erc20Balances[takerAddress][zrxToken.address].minus(signedOrder.takerFee), - ); - expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal( - erc20Balances[feeRecipientAddress][zrxToken.address].add( - signedOrder.makerFee.add(signedOrder.takerFee), - ), - ); - }); }); }); // tslint:disable:max-file-line-count diff --git a/packages/contracts/test/exchange/dispatcher.ts b/packages/contracts/test/exchange/dispatcher.ts index cf73d274b..59d80c6d6 100644 --- a/packages/contracts/test/exchange/dispatcher.ts +++ b/packages/contracts/test/exchange/dispatcher.ts @@ -48,7 +48,10 @@ describe('AssetProxyDispatcher', () => { erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner); erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner); - [zrxToken] = await erc20Wrapper.deployDummyTokensAsync(); + [zrxToken] = await erc20Wrapper.deployDummyTokensAsync( + constants.NUM_DUMMY_ERC20_TO_DEPLOY, + constants.DUMMY_TOKEN_DECIMALS, + ); erc20Proxy = await erc20Wrapper.deployProxyAsync(); await erc20Wrapper.setBalancesAndAllowancesAsync(); diff --git a/packages/contracts/test/exchange/fill_order.ts b/packages/contracts/test/exchange/fill_order.ts new file mode 100644 index 000000000..56d7510f4 --- /dev/null +++ b/packages/contracts/test/exchange/fill_order.ts @@ -0,0 +1,285 @@ +import { BlockchainLifecycle } from '@0xproject/dev-utils'; +import * as _ from 'lodash'; + +import { chaiSetup } from '../../src/utils/chai_setup'; +import { CoreCombinatorialUtils, coreCombinatorialUtilsFactoryAsync } from '../../src/utils/core_combinatorial_utils'; +import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; + +import { + AllowanceAmountScenario, + AssetDataScenario, + BalanceAmountScenario, + ExpirationTimeSecondsScenario, + FeeRecipientAddressScenario, + OrderAssetAmountScenario, + OrderScenario, + TakerAssetFillAmountScenario, + TakerScenario, +} from '../../src/utils/types'; + +chaiSetup.configure(); +const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); + +const defaultFillScenario = { + orderScenario: { + takerScenario: TakerScenario.Unspecified, + feeRecipientScenario: FeeRecipientAddressScenario.EthUserAddress, + makerAssetAmountScenario: OrderAssetAmountScenario.Large, + takerAssetAmountScenario: OrderAssetAmountScenario.Large, + makerFeeScenario: OrderAssetAmountScenario.Large, + takerFeeScenario: OrderAssetAmountScenario.Large, + expirationTimeSecondsScenario: ExpirationTimeSecondsScenario.InFuture, + makerAssetDataScenario: AssetDataScenario.ERC20NonZRXEighteenDecimals, + takerAssetDataScenario: AssetDataScenario.ERC20NonZRXEighteenDecimals, + }, + takerAssetFillAmountScenario: TakerAssetFillAmountScenario.LessThanRemainingFillableTakerAssetAmount, + makerStateScenario: { + traderAssetBalance: BalanceAmountScenario.Higher, + traderAssetAllowance: AllowanceAmountScenario.Higher, + zrxFeeBalance: BalanceAmountScenario.Higher, + zrxFeeAllowance: AllowanceAmountScenario.Higher, + }, + takerStateScenario: { + traderAssetBalance: BalanceAmountScenario.Higher, + traderAssetAllowance: AllowanceAmountScenario.Higher, + zrxFeeBalance: BalanceAmountScenario.Higher, + zrxFeeAllowance: AllowanceAmountScenario.Higher, + }, +}; + +describe('FillOrder Tests', () => { + let coreCombinatorialUtils: CoreCombinatorialUtils; + + before(async () => { + await blockchainLifecycle.startAsync(); + coreCombinatorialUtils = await coreCombinatorialUtilsFactoryAsync(web3Wrapper, txDefaults); + }); + after(async () => { + await blockchainLifecycle.revertAsync(); + }); + beforeEach(async () => { + await blockchainLifecycle.startAsync(); + }); + afterEach(async () => { + await blockchainLifecycle.revertAsync(); + }); + describe('fillOrder', () => { + it('should transfer the correct amounts when makerAssetAmount === takerAssetAmount', async () => { + const fillScenario = { + ...defaultFillScenario, + }; + await coreCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario); + }); + it('should transfer the correct amounts when makerAssetAmount > takerAssetAmount', async () => { + const fillScenario = { + ...defaultFillScenario, + orderScenario: { + ...defaultFillScenario.orderScenario, + takerAssetAmountScenario: OrderAssetAmountScenario.Small, + }, + }; + await coreCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario); + }); + it('should transfer the correct amounts when makerAssetAmount < takerAssetAmount', async () => { + const fillScenario = { + ...defaultFillScenario, + orderScenario: { + ...defaultFillScenario.orderScenario, + makerAssetAmountScenario: OrderAssetAmountScenario.Small, + }, + }; + await coreCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario); + }); + it('should transfer the correct amounts when taker is specified and order is claimed by taker', async () => { + const fillScenario = { + ...defaultFillScenario, + orderScenario: { + ...defaultFillScenario.orderScenario, + takerScenario: TakerScenario.CorrectlySpecified, + }, + }; + await coreCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario); + }); + it('should fill remaining value if takerAssetFillAmount > remaining takerAssetAmount', async () => { + const fillScenario = { + ...defaultFillScenario, + takerAssetFillAmountScenario: TakerAssetFillAmountScenario.GreaterThanRemainingFillableTakerAssetAmount, + }; + await coreCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario); + }); + it('should throw when taker is specified and order is claimed by other', async () => { + const fillScenario = { + ...defaultFillScenario, + orderScenario: { + ...defaultFillScenario.orderScenario, + takerScenario: TakerScenario.IncorrectlySpecified, + }, + }; + await coreCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario); + }); + + it('should throw if makerAssetAmount is 0', async () => { + const fillScenario = { + ...defaultFillScenario, + orderScenario: { + ...defaultFillScenario.orderScenario, + makerAssetAmountScenario: OrderAssetAmountScenario.Zero, + }, + }; + await coreCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario); + }); + + it('should throw if takerAssetAmount is 0', async () => { + const fillScenario = { + ...defaultFillScenario, + orderScenario: { + ...defaultFillScenario.orderScenario, + takerAssetAmountScenario: OrderAssetAmountScenario.Zero, + }, + }; + await coreCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario); + }); + + it('should throw if takerAssetFillAmount is 0', async () => { + const fillScenario = { + ...defaultFillScenario, + takerAssetFillAmountScenario: TakerAssetFillAmountScenario.Zero, + }; + await coreCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario); + }); + + it('should throw if an order is expired', async () => { + const fillScenario = { + ...defaultFillScenario, + orderScenario: { + ...defaultFillScenario.orderScenario, + expirationTimeSecondsScenario: ExpirationTimeSecondsScenario.InPast, + }, + }; + await coreCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario); + }); + + it('should throw if maker erc20Balances are too low to fill order', async () => { + const fillScenario = { + ...defaultFillScenario, + makerStateScenario: { + ...defaultFillScenario.makerStateScenario, + traderAssetBalance: BalanceAmountScenario.TooLow, + }, + }; + await coreCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario); + }); + + it('should throw if taker erc20Balances are too low to fill order', async () => { + const fillScenario = { + ...defaultFillScenario, + takerStateScenario: { + ...defaultFillScenario.makerStateScenario, + traderAssetBalance: BalanceAmountScenario.TooLow, + }, + }; + await coreCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario); + }); + + it('should throw if maker allowances are too low to fill order', async () => { + const fillScenario = { + ...defaultFillScenario, + makerStateScenario: { + ...defaultFillScenario.makerStateScenario, + traderAssetAllowance: AllowanceAmountScenario.TooLow, + }, + }; + await coreCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario); + }); + + it('should throw if taker allowances are too low to fill order', async () => { + const fillScenario = { + ...defaultFillScenario, + takerStateScenario: { + ...defaultFillScenario.makerStateScenario, + traderAssetAllowance: AllowanceAmountScenario.TooLow, + }, + }; + await coreCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario); + }); + }); + + describe('Testing Exchange of ERC721 Tokens', () => { + it('should successfully exchange a single token between the maker and taker (via fillOrder)', async () => { + const fillScenario = { + ...defaultFillScenario, + orderScenario: { + ...defaultFillScenario.orderScenario, + makerAssetDataScenario: AssetDataScenario.ERC721, + takerAssetDataScenario: AssetDataScenario.ERC721, + }, + takerAssetFillAmountScenario: TakerAssetFillAmountScenario.ExactlyRemainingFillableTakerAssetAmount, + }; + await coreCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario); + }); + + it('should successfully fill order when makerAsset is ERC721 and takerAsset is ERC20', async () => { + const fillScenario = { + ...defaultFillScenario, + orderScenario: { + ...defaultFillScenario.orderScenario, + makerAssetDataScenario: AssetDataScenario.ERC721, + takerAssetDataScenario: AssetDataScenario.ERC20NonZRXEighteenDecimals, + }, + takerAssetFillAmountScenario: TakerAssetFillAmountScenario.ExactlyRemainingFillableTakerAssetAmount, + }; + await coreCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario, true); + }); + + it('should successfully fill order when makerAsset is ERC20 and takerAsset is ERC721', async () => { + const fillScenario = { + ...defaultFillScenario, + orderScenario: { + ...defaultFillScenario.orderScenario, + makerAssetDataScenario: AssetDataScenario.ERC20NonZRXEighteenDecimals, + takerAssetDataScenario: AssetDataScenario.ERC721, + }, + takerAssetFillAmountScenario: TakerAssetFillAmountScenario.ExactlyRemainingFillableTakerAssetAmount, + }; + await coreCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario); + }); + + it('should successfully fill order when makerAsset is ERC721 and approveAll is set for it', async () => { + const fillScenario = { + ...defaultFillScenario, + orderScenario: { + ...defaultFillScenario.orderScenario, + makerAssetDataScenario: AssetDataScenario.ERC721, + takerAssetDataScenario: AssetDataScenario.ERC20NonZRXEighteenDecimals, + }, + takerAssetFillAmountScenario: TakerAssetFillAmountScenario.ExactlyRemainingFillableTakerAssetAmount, + makerStateScenario: { + ...defaultFillScenario.makerStateScenario, + traderAssetAllowance: AllowanceAmountScenario.Unlimited, + }, + }; + await coreCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario); + }); + + it('should successfully fill order when makerAsset and takerAsset are ERC721 and approveAll is set for them', async () => { + const fillScenario = { + ...defaultFillScenario, + orderScenario: { + ...defaultFillScenario.orderScenario, + makerAssetDataScenario: AssetDataScenario.ERC721, + takerAssetDataScenario: AssetDataScenario.ERC721, + }, + takerAssetFillAmountScenario: TakerAssetFillAmountScenario.ExactlyRemainingFillableTakerAssetAmount, + makerStateScenario: { + ...defaultFillScenario.makerStateScenario, + traderAssetAllowance: AllowanceAmountScenario.Unlimited, + }, + takerStateScenario: { + ...defaultFillScenario.takerStateScenario, + traderAssetAllowance: AllowanceAmountScenario.Unlimited, + }, + }; + await coreCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario); + }); + }); +}); diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts index 324cf319f..044108bfb 100644 --- a/packages/contracts/test/exchange/match_orders.ts +++ b/packages/contracts/test/exchange/match_orders.ts @@ -81,7 +81,10 @@ describe('matchOrders', () => { erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner); erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner); // Deploy ERC20 token & ERC20 proxy - [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(); + [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync( + constants.NUM_DUMMY_ERC20_TO_DEPLOY, + constants.DUMMY_TOKEN_DECIMALS, + ); erc20Proxy = await erc20Wrapper.deployProxyAsync(); await erc20Wrapper.setBalancesAndAllowancesAsync(); // Deploy ERC721 token and proxy diff --git a/packages/contracts/test/exchange/transactions.ts b/packages/contracts/test/exchange/transactions.ts index 8d4799109..6f820e673 100644 --- a/packages/contracts/test/exchange/transactions.ts +++ b/packages/contracts/test/exchange/transactions.ts @@ -71,7 +71,10 @@ describe('Exchange transactions', () => { erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner); - [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(); + [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync( + constants.NUM_DUMMY_ERC20_TO_DEPLOY, + constants.DUMMY_TOKEN_DECIMALS, + ); erc20Proxy = await erc20Wrapper.deployProxyAsync(); await erc20Wrapper.setBalancesAndAllowancesAsync(); diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts index 3ea197395..504b78f5c 100644 --- a/packages/contracts/test/exchange/wrapper.ts +++ b/packages/contracts/test/exchange/wrapper.ts @@ -65,7 +65,10 @@ describe('Exchange wrappers', () => { erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner); erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner); - [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(); + [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync( + constants.NUM_DUMMY_ERC20_TO_DEPLOY, + constants.DUMMY_TOKEN_DECIMALS, + ); erc20Proxy = await erc20Wrapper.deployProxyAsync(); await erc20Wrapper.setBalancesAndAllowancesAsync(); @@ -370,7 +373,7 @@ describe('Exchange wrappers', () => { // HACK(albrow): We need to hardcode the gas estimate here because // the Geth gas estimator doesn't work with the way we use // delegatecall and swallow errors. - gas: 270000, + gas: 280000, }); // Verify post-conditions const newOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId); diff --git a/packages/migrations/artifacts/2.0.0/DummyERC721Token.json b/packages/migrations/artifacts/2.0.0/DummyERC721Token.json index 9bdf7787a..84bc92299 100644 --- a/packages/migrations/artifacts/2.0.0/DummyERC721Token.json +++ b/packages/migrations/artifacts/2.0.0/DummyERC721Token.json @@ -205,6 +205,24 @@ "constant": false, "inputs": [ { + "name": "owner", + "type": "address" + }, + { + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "_to", "type": "address" }, @@ -367,15 +385,15 @@ "evm": { "bytecode": { "linkReferences": {}, - "object": "0x60806040523480156200001157600080fd5b506040516200137638038062001376833981018060405262000037919081019062000184565b60008054600160a060020a031916331790558151829082906200006290600190602085019062000083565b5080516200007890600290602084019062000083565b505050505062000274565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620000c657805160ff1916838001178555620000f6565b82800160010185558215620000f6579182015b82811115620000f6578251825591602001919060010190620000d9565b506200010492915062000108565b5090565b6200012591905b808211156200010457600081556001016200010f565b90565b6000601f820183136200013a57600080fd5b8151620001516200014b8262000219565b620001f2565b915080825260208301602083018583830111156200016e57600080fd5b6200017b83828462000241565b50505092915050565b600080604083850312156200019857600080fd5b82516001604060020a03811115620001af57600080fd5b620001bd8582860162000128565b92505060208301516001604060020a03811115620001da57600080fd5b620001e88582860162000128565b9150509250929050565b6040518181016001604060020a03811182821017156200021157600080fd5b604052919050565b60006001604060020a038211156200023057600080fd5b506020601f91909101601f19160190565b60005b838110156200025e57818101518382015260200162000244565b838111156200026e576000848401525b50505050565b6110f280620002846000396000f3006080604052600436106100da5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100df578063081812fc1461010a578063095ea7b31461013757806323b872dd1461015957806340c10f191461017957806342842e0e146101995780634f558e79146101b95780636352211e146101e657806370a08231146102065780638da5cb5b1461023357806395d89b4114610248578063a22cb4651461025d578063b88d4fde1461027d578063e985e9c51461029d578063f2fde38b146102bd575b600080fd5b3480156100eb57600080fd5b506100f46102dd565b6040516101019190610fae565b60405180910390f35b34801561011657600080fd5b5061012a610125366004610e3c565b610372565b6040516101019190610f5c565b34801561014357600080fd5b50610157610152366004610dee565b61038d565b005b34801561016557600080fd5b50610157610174366004610cf8565b610483565b34801561018557600080fd5b50610157610194366004610dee565b610532565b3480156101a557600080fd5b506101576101b4366004610cf8565b6105cd565b3480156101c557600080fd5b506101d96101d4366004610e3c565b610605565b6040516101019190610fa0565b3480156101f257600080fd5b5061012a610201366004610e3c565b610622565b34801561021257600080fd5b50610226610221366004610ca0565b61064c565b6040516101019190610fdf565b34801561023f57600080fd5b5061012a61067f565b34801561025457600080fd5b506100f461068e565b34801561026957600080fd5b50610157610278366004610dbe565b6106ec565b34801561028957600080fd5b50610157610298366004610d45565b610771565b3480156102a957600080fd5b506101d96102b8366004610cbe565b6107b0565b3480156102c957600080fd5b506101576102d8366004610ca0565b6107de565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156103685780601f1061033d57610100808354040283529160200191610368565b820191906000526020600020905b81548152906001019060200180831161034b57829003601f168201915b5050505050905090565b600090815260046020526040902054600160a060020a031690565b600061039882610622565b9050600160a060020a0383811690821614156103b357600080fd5b33600160a060020a03821614806103cf57506103cf81336107b0565b15156103da57600080fd5b60006103e583610372565b600160a060020a03161415806104035750600160a060020a03831615155b1561047e5760008281526004602052604090819020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038681169182179092559151908316907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610475908690610fdf565b60405180910390a35b505050565b8061048e338261085d565b151561049957600080fd5b600160a060020a03841615156104ae57600080fd5b600160a060020a03831615156104c357600080fd5b6104cd84836108bc565b6104d78483610962565b6104e183836109f2565b82600160a060020a031684600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516105249190610fdf565b60405180910390a350505050565b600054600160a060020a0316331461057f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161057690610fcf565b60405180910390fd5b61058881610605565b156105bf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161057690610fbf565b6105c98282610a83565b5050565b806105d8338261085d565b15156105e357600080fd5b6105ff8484846020604051908101604052806000815250610771565b50505050565b600090815260036020526040902054600160a060020a0316151590565b600081815260036020526040812054600160a060020a031680151561064657600080fd5b92915050565b6000600160a060020a038216151561066357600080fd5b50600160a060020a031660009081526005602052604090205490565b600054600160a060020a031681565b60028054604080516020601f60001961010060018716150201909416859004938401819004810282018101909252828152606093909290918301828280156103685780601f1061033d57610100808354040283529160200191610368565b600160a060020a03821633141561070257600080fd5b336000818152600660209081526040808320600160a060020a038716808552925291829020805460ff191685151517905590519091907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3190610765908590610fa0565b60405180910390a35050565b8161077c338261085d565b151561078757600080fd5b610792858585610483565b61079e85858585610ae6565b15156107a957600080fd5b5050505050565b600160a060020a03918216600090815260066020908152604080832093909416825291909152205460ff1690565b600054600160a060020a03163314610822576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161057690610fcf565b600160a060020a0381161561085a576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b60008061086983610622565b905080600160a060020a031684600160a060020a031614806108a4575083600160a060020a031661089984610372565b600160a060020a0316145b806108b457506108b481856107b0565b949350505050565b81600160a060020a03166108cf82610622565b600160a060020a0316146108e257600080fd5b600081815260046020526040902054600160a060020a0316156105c957600081815260046020526040808220805473ffffffffffffffffffffffffffffffffffffffff1916905551600160a060020a038416907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610765908590610fdf565b81600160a060020a031661097582610622565b600160a060020a03161461098857600080fd5b600160a060020a0382166000908152600560205260409020546109ac906001610bec565b600160a060020a03909216600090815260056020908152604080832094909455918152600390915220805473ffffffffffffffffffffffffffffffffffffffff19169055565b600081815260036020526040902054600160a060020a031615610a1457600080fd5b6000818152600360209081526040808320805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03871690811790915583526005909152902054610a63906001610bfe565b600160a060020a0390921660009081526005602052604090209190915550565b600160a060020a0382161515610a9857600080fd5b610aa282826109f2565b81600160a060020a03166000600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516107659190610fdf565b600080610af285610c14565b1515610b015760019150610be3565b6040517ff0b9e5ba000000000000000000000000000000000000000000000000000000008152600160a060020a0386169063f0b9e5ba90610b4a90899088908890600401610f6a565b602060405180830381600087803b158015610b6457600080fd5b505af1158015610b78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610b9c9190810190610e1e565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1981167ff0b9e5ba0000000000000000000000000000000000000000000000000000000014925090505b50949350505050565b600082821115610bf857fe5b50900390565b600082820183811015610c0d57fe5b9392505050565b6000903b1190565b6000610c0d8235611040565b6000610c0d823561104c565b6000610c0d8251611054565b6000601f82018313610c5157600080fd5b8135610c64610c5f82611014565b610fed565b91508082526020830160208301858383011115610c8057600080fd5b610c8b838284611076565b50505092915050565b6000610c0d8235611051565b600060208284031215610cb257600080fd5b60006108b48484610c1c565b60008060408385031215610cd157600080fd5b6000610cdd8585610c1c565b9250506020610cee85828601610c1c565b9150509250929050565b600080600060608486031215610d0d57600080fd5b6000610d198686610c1c565b9350506020610d2a86828701610c1c565b9250506040610d3b86828701610c94565b9150509250925092565b60008060008060808587031215610d5b57600080fd5b6000610d678787610c1c565b9450506020610d7887828801610c1c565b9350506040610d8987828801610c94565b925050606085013567ffffffffffffffff811115610da657600080fd5b610db287828801610c40565b91505092959194509250565b60008060408385031215610dd157600080fd5b6000610ddd8585610c1c565b9250506020610cee85828601610c28565b60008060408385031215610e0157600080fd5b6000610e0d8585610c1c565b9250506020610cee85828601610c94565b600060208284031215610e3057600080fd5b60006108b48484610c34565b600060208284031215610e4e57600080fd5b60006108b48484610c94565b610e6381611040565b82525050565b610e638161104c565b6000610e7d8261103c565b808452610e91816020860160208601611082565b610e9a816110ae565b9093016020019392505050565b602281527f546f6b656e207769746820746f6b656e496420616c726561647920657869737460208201527f732e000000000000000000000000000000000000000000000000000000000000604082015260600190565b603381527f4f6e6c7920636f6e7472616374206f776e657220697320616c6c6f776564207460208201527f6f2063616c6c2074686973206d6574686f642e00000000000000000000000000604082015260600190565b610e6381611051565b602081016106468284610e5a565b60608101610f788286610e5a565b610f856020830185610f53565b8181036040830152610f978184610e72565b95945050505050565b602081016106468284610e69565b60208082528101610c0d8184610e72565b6020808252810161064681610ea7565b6020808252810161064681610efd565b602081016106468284610f53565b60405181810167ffffffffffffffff8111828210171561100c57600080fd5b604052919050565b600067ffffffffffffffff82111561102b57600080fd5b506020601f91909101601f19160190565b5190565b600160a060020a031690565b151590565b90565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690565b82818337506000910152565b60005b8381101561109d578181015183820152602001611085565b838111156105ff5750506000910152565b601f01601f1916905600a265627a7a72305820dca99ed080138e68d1f26208ce796f211cfc01d8c3da8021f8ee95e54f4b4d2d6c6578706572696d656e74616cf50037", - "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH3 0x11 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH3 0x1376 CODESIZE SUB DUP1 PUSH3 0x1376 DUP4 CODECOPY DUP2 ADD DUP1 PUSH1 0x40 MSTORE PUSH3 0x37 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH3 0x184 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT AND CALLER OR SWAP1 SSTORE DUP2 MLOAD DUP3 SWAP1 DUP3 SWAP1 PUSH3 0x62 SWAP1 PUSH1 0x1 SWAP1 PUSH1 0x20 DUP6 ADD SWAP1 PUSH3 0x83 JUMP JUMPDEST POP DUP1 MLOAD PUSH3 0x78 SWAP1 PUSH1 0x2 SWAP1 PUSH1 0x20 DUP5 ADD SWAP1 PUSH3 0x83 JUMP JUMPDEST POP POP POP POP POP PUSH3 0x274 JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH3 0xC6 JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH3 0xF6 JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH3 0xF6 JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH3 0xF6 JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH3 0xD9 JUMP JUMPDEST POP PUSH3 0x104 SWAP3 SWAP2 POP PUSH3 0x108 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH3 0x125 SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH3 0x104 JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH3 0x10F JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH3 0x13A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MLOAD PUSH3 0x151 PUSH3 0x14B DUP3 PUSH3 0x219 JUMP JUMPDEST PUSH3 0x1F2 JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH3 0x16E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH3 0x17B DUP4 DUP3 DUP5 PUSH3 0x241 JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH3 0x198 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 MLOAD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT ISZERO PUSH3 0x1AF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH3 0x1BD DUP6 DUP3 DUP7 ADD PUSH3 0x128 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 DUP4 ADD MLOAD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT ISZERO PUSH3 0x1DA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH3 0x1E8 DUP6 DUP3 DUP7 ADD PUSH3 0x128 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH3 0x211 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP3 GT ISZERO PUSH3 0x230 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH1 0x1F NOT AND ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH3 0x25E JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH3 0x244 JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH3 0x26E JUMPI PUSH1 0x0 DUP5 DUP5 ADD MSTORE JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH2 0x10F2 DUP1 PUSH3 0x284 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0xDA JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x6FDDE03 DUP2 EQ PUSH2 0xDF JUMPI DUP1 PUSH4 0x81812FC EQ PUSH2 0x10A JUMPI DUP1 PUSH4 0x95EA7B3 EQ PUSH2 0x137 JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0x159 JUMPI DUP1 PUSH4 0x40C10F19 EQ PUSH2 0x179 JUMPI DUP1 PUSH4 0x42842E0E EQ PUSH2 0x199 JUMPI DUP1 PUSH4 0x4F558E79 EQ PUSH2 0x1B9 JUMPI DUP1 PUSH4 0x6352211E EQ PUSH2 0x1E6 JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0x206 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x233 JUMPI DUP1 PUSH4 0x95D89B41 EQ PUSH2 0x248 JUMPI DUP1 PUSH4 0xA22CB465 EQ PUSH2 0x25D JUMPI DUP1 PUSH4 0xB88D4FDE EQ PUSH2 0x27D JUMPI DUP1 PUSH4 0xE985E9C5 EQ PUSH2 0x29D JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x2BD JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xEB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xF4 PUSH2 0x2DD JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x101 SWAP2 SWAP1 PUSH2 0xFAE JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x116 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x12A PUSH2 0x125 CALLDATASIZE PUSH1 0x4 PUSH2 0xE3C JUMP JUMPDEST PUSH2 0x372 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x101 SWAP2 SWAP1 PUSH2 0xF5C JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x143 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x157 PUSH2 0x152 CALLDATASIZE PUSH1 0x4 PUSH2 0xDEE JUMP JUMPDEST PUSH2 0x38D JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x165 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x157 PUSH2 0x174 CALLDATASIZE PUSH1 0x4 PUSH2 0xCF8 JUMP JUMPDEST PUSH2 0x483 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x185 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x157 PUSH2 0x194 CALLDATASIZE PUSH1 0x4 PUSH2 0xDEE JUMP JUMPDEST PUSH2 0x532 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1A5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x157 PUSH2 0x1B4 CALLDATASIZE PUSH1 0x4 PUSH2 0xCF8 JUMP JUMPDEST PUSH2 0x5CD JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1C5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1D9 PUSH2 0x1D4 CALLDATASIZE PUSH1 0x4 PUSH2 0xE3C JUMP JUMPDEST PUSH2 0x605 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x101 SWAP2 SWAP1 PUSH2 0xFA0 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1F2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x12A PUSH2 0x201 CALLDATASIZE PUSH1 0x4 PUSH2 0xE3C JUMP JUMPDEST PUSH2 0x622 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x212 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x226 PUSH2 0x221 CALLDATASIZE PUSH1 0x4 PUSH2 0xCA0 JUMP JUMPDEST PUSH2 0x64C JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x101 SWAP2 SWAP1 PUSH2 0xFDF JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x23F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x12A PUSH2 0x67F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x254 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xF4 PUSH2 0x68E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x269 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x157 PUSH2 0x278 CALLDATASIZE PUSH1 0x4 PUSH2 0xDBE JUMP JUMPDEST PUSH2 0x6EC JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x289 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x157 PUSH2 0x298 CALLDATASIZE PUSH1 0x4 PUSH2 0xD45 JUMP JUMPDEST PUSH2 0x771 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2A9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1D9 PUSH2 0x2B8 CALLDATASIZE PUSH1 0x4 PUSH2 0xCBE JUMP JUMPDEST PUSH2 0x7B0 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2C9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x157 PUSH2 0x2D8 CALLDATASIZE PUSH1 0x4 PUSH2 0xCA0 JUMP JUMPDEST PUSH2 0x7DE JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH1 0x0 NOT PUSH2 0x100 DUP8 DUP10 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH1 0x60 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x368 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x33D JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x368 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x34B JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x398 DUP3 PUSH2 0x622 JUMP JUMPDEST SWAP1 POP PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP4 DUP2 AND SWAP1 DUP3 AND EQ ISZERO PUSH2 0x3B3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST CALLER PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP3 AND EQ DUP1 PUSH2 0x3CF JUMPI POP PUSH2 0x3CF DUP2 CALLER PUSH2 0x7B0 JUMP JUMPDEST ISZERO ISZERO PUSH2 0x3DA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x3E5 DUP4 PUSH2 0x372 JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND EQ ISZERO DUP1 PUSH2 0x403 JUMPI POP PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP4 AND ISZERO ISZERO JUMPDEST ISZERO PUSH2 0x47E JUMPI PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP7 DUP2 AND SWAP2 DUP3 OR SWAP1 SWAP3 SSTORE SWAP2 MLOAD SWAP1 DUP4 AND SWAP1 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP1 PUSH2 0x475 SWAP1 DUP7 SWAP1 PUSH2 0xFDF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 JUMPDEST POP POP POP JUMP JUMPDEST DUP1 PUSH2 0x48E CALLER DUP3 PUSH2 0x85D JUMP JUMPDEST ISZERO ISZERO PUSH2 0x499 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP5 AND ISZERO ISZERO PUSH2 0x4AE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP4 AND ISZERO ISZERO PUSH2 0x4C3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4CD DUP5 DUP4 PUSH2 0x8BC JUMP JUMPDEST PUSH2 0x4D7 DUP5 DUP4 PUSH2 0x962 JUMP JUMPDEST PUSH2 0x4E1 DUP4 DUP4 PUSH2 0x9F2 JUMP JUMPDEST DUP3 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP5 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF DUP5 PUSH1 0x40 MLOAD PUSH2 0x524 SWAP2 SWAP1 PUSH2 0xFDF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND CALLER EQ PUSH2 0x57F JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x576 SWAP1 PUSH2 0xFCF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x588 DUP2 PUSH2 0x605 JUMP JUMPDEST ISZERO PUSH2 0x5BF JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x576 SWAP1 PUSH2 0xFBF JUMP JUMPDEST PUSH2 0x5C9 DUP3 DUP3 PUSH2 0xA83 JUMP JUMPDEST POP POP JUMP JUMPDEST DUP1 PUSH2 0x5D8 CALLER DUP3 PUSH2 0x85D JUMP JUMPDEST ISZERO ISZERO PUSH2 0x5E3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x5FF DUP5 DUP5 DUP5 PUSH1 0x20 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x0 DUP2 MSTORE POP PUSH2 0x771 JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND ISZERO ISZERO SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP1 ISZERO ISZERO PUSH2 0x646 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP3 AND ISZERO ISZERO PUSH2 0x663 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x5 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP2 JUMP JUMPDEST PUSH1 0x2 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x0 NOT PUSH2 0x100 PUSH1 0x1 DUP8 AND ISZERO MUL ADD SWAP1 SWAP5 AND DUP6 SWAP1 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH1 0x60 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x368 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x33D JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x368 JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP3 AND CALLER EQ ISZERO PUSH2 0x702 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x6 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP8 AND DUP1 DUP6 MSTORE SWAP3 MSTORE SWAP2 DUP3 SWAP1 KECCAK256 DUP1 SLOAD PUSH1 0xFF NOT AND DUP6 ISZERO ISZERO OR SWAP1 SSTORE SWAP1 MLOAD SWAP1 SWAP2 SWAP1 PUSH32 0x17307EAB39AB6107E8899845AD3D59BD9653F200F220920489CA2B5937696C31 SWAP1 PUSH2 0x765 SWAP1 DUP6 SWAP1 PUSH2 0xFA0 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP JUMP JUMPDEST DUP2 PUSH2 0x77C CALLER DUP3 PUSH2 0x85D JUMP JUMPDEST ISZERO ISZERO PUSH2 0x787 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x792 DUP6 DUP6 DUP6 PUSH2 0x483 JUMP JUMPDEST PUSH2 0x79E DUP6 DUP6 DUP6 DUP6 PUSH2 0xAE6 JUMP JUMPDEST ISZERO ISZERO PUSH2 0x7A9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP2 DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x6 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 SWAP1 SWAP5 AND DUP3 MSTORE SWAP2 SWAP1 SWAP2 MSTORE KECCAK256 SLOAD PUSH1 0xFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND CALLER EQ PUSH2 0x822 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x576 SWAP1 PUSH2 0xFCF JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP2 AND ISZERO PUSH2 0x85A JUMPI PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP4 AND OR SWAP1 SSTORE JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x869 DUP4 PUSH2 0x622 JUMP JUMPDEST SWAP1 POP DUP1 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP5 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND EQ DUP1 PUSH2 0x8A4 JUMPI POP DUP4 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH2 0x899 DUP5 PUSH2 0x372 JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND EQ JUMPDEST DUP1 PUSH2 0x8B4 JUMPI POP PUSH2 0x8B4 DUP2 DUP6 PUSH2 0x7B0 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST DUP2 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH2 0x8CF DUP3 PUSH2 0x622 JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND EQ PUSH2 0x8E2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND ISZERO PUSH2 0x5C9 JUMPI PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND SWAP1 SSTORE MLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP5 AND SWAP1 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP1 PUSH2 0x765 SWAP1 DUP6 SWAP1 PUSH2 0xFDF JUMP JUMPDEST DUP2 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH2 0x975 DUP3 PUSH2 0x622 JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND EQ PUSH2 0x988 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x5 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH2 0x9AC SWAP1 PUSH1 0x1 PUSH2 0xBEC JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP1 SWAP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x5 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP5 SWAP1 SWAP5 SSTORE SWAP2 DUP2 MSTORE PUSH1 0x3 SWAP1 SWAP2 MSTORE KECCAK256 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND SWAP1 SSTORE JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND ISZERO PUSH2 0xA14 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP8 AND SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP4 MSTORE PUSH1 0x5 SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH2 0xA63 SWAP1 PUSH1 0x1 PUSH2 0xBFE JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP1 SWAP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x5 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SWAP2 SWAP1 SWAP2 SSTORE POP JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP3 AND ISZERO ISZERO PUSH2 0xA98 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xAA2 DUP3 DUP3 PUSH2 0x9F2 JUMP JUMPDEST DUP2 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH1 0x0 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF DUP4 PUSH1 0x40 MLOAD PUSH2 0x765 SWAP2 SWAP1 PUSH2 0xFDF JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0xAF2 DUP6 PUSH2 0xC14 JUMP JUMPDEST ISZERO ISZERO PUSH2 0xB01 JUMPI PUSH1 0x1 SWAP2 POP PUSH2 0xBE3 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0xF0B9E5BA00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP7 AND SWAP1 PUSH4 0xF0B9E5BA SWAP1 PUSH2 0xB4A SWAP1 DUP10 SWAP1 DUP9 SWAP1 DUP9 SWAP1 PUSH1 0x4 ADD PUSH2 0xF6A JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xB64 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0xB78 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0xB9C SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0xE1E JUMP JUMPDEST PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT DUP2 AND PUSH32 0xF0B9E5BA00000000000000000000000000000000000000000000000000000000 EQ SWAP3 POP SWAP1 POP JUMPDEST POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0xBF8 JUMPI INVALID JUMPDEST POP SWAP1 SUB SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0xC0D JUMPI INVALID JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 SWAP1 EXTCODESIZE GT SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC0D DUP3 CALLDATALOAD PUSH2 0x1040 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC0D DUP3 CALLDATALOAD PUSH2 0x104C JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC0D DUP3 MLOAD PUSH2 0x1054 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0xC51 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0xC64 PUSH2 0xC5F DUP3 PUSH2 0x1014 JUMP JUMPDEST PUSH2 0xFED JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH2 0xC80 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xC8B DUP4 DUP3 DUP5 PUSH2 0x1076 JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC0D DUP3 CALLDATALOAD PUSH2 0x1051 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xCB2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x8B4 DUP5 DUP5 PUSH2 0xC1C JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0xCD1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xCDD DUP6 DUP6 PUSH2 0xC1C JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0xCEE DUP6 DUP3 DUP7 ADD PUSH2 0xC1C JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0xD0D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xD19 DUP7 DUP7 PUSH2 0xC1C JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0xD2A DUP7 DUP3 DUP8 ADD PUSH2 0xC1C JUMP JUMPDEST SWAP3 POP POP PUSH1 0x40 PUSH2 0xD3B DUP7 DUP3 DUP8 ADD PUSH2 0xC94 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 POP SWAP3 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x80 DUP6 DUP8 SUB SLT ISZERO PUSH2 0xD5B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xD67 DUP8 DUP8 PUSH2 0xC1C JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 PUSH2 0xD78 DUP8 DUP3 DUP9 ADD PUSH2 0xC1C JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 PUSH2 0xD89 DUP8 DUP3 DUP9 ADD PUSH2 0xC94 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x60 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0xDA6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xDB2 DUP8 DUP3 DUP9 ADD PUSH2 0xC40 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 SWAP2 SWAP5 POP SWAP3 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0xDD1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xDDD DUP6 DUP6 PUSH2 0xC1C JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0xCEE DUP6 DUP3 DUP7 ADD PUSH2 0xC28 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0xE01 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xE0D DUP6 DUP6 PUSH2 0xC1C JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0xCEE DUP6 DUP3 DUP7 ADD PUSH2 0xC94 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xE30 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x8B4 DUP5 DUP5 PUSH2 0xC34 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xE4E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x8B4 DUP5 DUP5 PUSH2 0xC94 JUMP JUMPDEST PUSH2 0xE63 DUP2 PUSH2 0x1040 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH2 0xE63 DUP2 PUSH2 0x104C JUMP JUMPDEST PUSH1 0x0 PUSH2 0xE7D DUP3 PUSH2 0x103C JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH2 0xE91 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0x1082 JUMP JUMPDEST PUSH2 0xE9A DUP2 PUSH2 0x10AE JUMP JUMPDEST SWAP1 SWAP4 ADD PUSH1 0x20 ADD SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x22 DUP2 MSTORE PUSH32 0x546F6B656E207769746820746F6B656E496420616C7265616479206578697374 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x732E000000000000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x33 DUP2 MSTORE PUSH32 0x4F6E6C7920636F6E7472616374206F776E657220697320616C6C6F7765642074 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x6F2063616C6C2074686973206D6574686F642E00000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH2 0xE63 DUP2 PUSH2 0x1051 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x646 DUP3 DUP5 PUSH2 0xE5A JUMP JUMPDEST PUSH1 0x60 DUP2 ADD PUSH2 0xF78 DUP3 DUP7 PUSH2 0xE5A JUMP JUMPDEST PUSH2 0xF85 PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0xF53 JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0xF97 DUP2 DUP5 PUSH2 0xE72 JUMP JUMPDEST SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x646 DUP3 DUP5 PUSH2 0xE69 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xC0D DUP2 DUP5 PUSH2 0xE72 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x646 DUP2 PUSH2 0xEA7 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x646 DUP2 PUSH2 0xEFD JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x646 DUP3 DUP5 PUSH2 0xF53 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x100C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x102B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH1 0x1F NOT AND ADD SWAP1 JUMP JUMPDEST MLOAD SWAP1 JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND SWAP1 JUMP JUMPDEST ISZERO ISZERO SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND SWAP1 JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x109D JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x1085 JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0x5FF JUMPI POP POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x1F ADD PUSH1 0x1F NOT AND SWAP1 JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 0xdc 0xa9 SWAP15 0xd0 DUP1 SGT DUP15 PUSH9 0xD1F26208CE796F211C 0xfc ADD 0xd8 0xc3 0xda DUP1 0x21 0xf8 0xee SWAP6 0xe5 0x4f 0x4b 0x4d 0x2d PUSH13 0x6578706572696D656E74616CF5 STOP CALLDATACOPY ", - "sourceMap": "734:822:0:-;;;950:118;8:9:-1;5:2;;;30:1;27;20:12;5:2;950:118:0;;;;;;;;;;;;;;;;;;;;;;;;363:5:5;:18;;-1:-1:-1;;;;;;363:18:5;371:10;363:18;;;2885:13:1;;1048:4:0;;1054:6;;2885:13:1;;363:18:5;;2885:13:1;;;;;:::i;:::-;-1:-1:-1;2908:17:1;;;;:7;;:17;;;;;:::i;:::-;;2788:144;;950:118:0;;734:822;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;734:822:0;;;-1:-1:-1;734:822:0;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;:::o;6:444:-1:-;;112:4;100:17;;96:27;-1:-1;86:2;;137:1;134;127:12;86:2;167:6;161:13;189:65;204:49;246:6;204:49;;;189:65;;;180:74;;274:6;267:5;260:21;310:4;302:6;298:17;343:4;336:5;332:16;378:3;369:6;364:3;360:16;357:25;354:2;;;395:1;392;385:12;354:2;405:39;437:6;432:3;427;405:39;;;79:371;;;;;;;;458:597;;;610:2;598:9;589:7;585:23;581:32;578:2;;;626:1;623;616:12;578:2;661:24;;-1:-1;;;;;694:30;;691:2;;;737:1;734;727:12;691:2;757:74;823:7;814:6;803:9;799:22;757:74;;;747:84;;640:197;889:2;878:9;874:18;868:25;-1:-1;;;;;905:6;902:30;899:2;;;945:1;942;935:12;899:2;965:74;1031:7;1022:6;1011:9;1007:22;965:74;;;955:84;;847:198;572:483;;;;;;1062:256;1124:2;1118:9;1150:17;;;-1:-1;;;;;1210:34;;1246:22;;;1207:62;1204:2;;;1282:1;1279;1272:12;1204:2;1298;1291:22;1102:216;;-1:-1;1102:216;1325:259;;-1:-1;;;;;1461:6;1458:30;1455:2;;;1501:1;1498;1491:12;1455:2;-1:-1;1574:4;1545;1522:17;;;;-1:-1;;1518:33;1564:15;;1392:192;1592:268;1657:1;1664:101;1678:6;1675:1;1672:13;1664:101;;;1745:11;;;1739:18;1726:11;;;1719:39;1700:2;1693:10;1664:101;;;1780:6;1777:1;1774:13;1771:2;;;1845:1;1836:6;1831:3;1827:16;1820:27;1771:2;1641:219;;;;;;734:822:0;;;;;;" + "object": "0x60806040523480156200001157600080fd5b506040516200147b3803806200147b833981018060405262000037919081019062000184565b60008054600160a060020a031916331790558151829082906200006290600190602085019062000083565b5080516200007890600290602084019062000083565b505050505062000274565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620000c657805160ff1916838001178555620000f6565b82800160010185558215620000f6579182015b82811115620000f6578251825591602001919060010190620000d9565b506200010492915062000108565b5090565b6200012591905b808211156200010457600081556001016200010f565b90565b6000601f820183136200013a57600080fd5b8151620001516200014b8262000219565b620001f2565b915080825260208301602083018583830111156200016e57600080fd5b6200017b83828462000241565b50505092915050565b600080604083850312156200019857600080fd5b82516001604060020a03811115620001af57600080fd5b620001bd8582860162000128565b92505060208301516001604060020a03811115620001da57600080fd5b620001e88582860162000128565b9150509250929050565b6040518181016001604060020a03811182821017156200021157600080fd5b604052919050565b60006001604060020a038211156200023057600080fd5b506020601f91909101601f19160190565b60005b838110156200025e57818101518382015260200162000244565b838111156200026e576000848401525b50505050565b6111f780620002846000396000f3006080604052600436106100e55763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100ea578063081812fc14610115578063095ea7b31461014257806323b872dd1461016457806340c10f191461018457806342842e0e146101a45780634f558e79146101c45780636352211e146101f157806370a08231146102115780638da5cb5b1461023e57806395d89b41146102535780639dc29fac14610268578063a22cb46514610288578063b88d4fde146102a8578063e985e9c5146102c8578063f2fde38b146102e8575b600080fd5b3480156100f657600080fd5b506100ff610308565b60405161010c91906110a3565b60405180910390f35b34801561012157600080fd5b50610135610130366004610edb565b61039d565b60405161010c9190611051565b34801561014e57600080fd5b5061016261015d366004610e8d565b6103b8565b005b34801561017057600080fd5b5061016261017f366004610d97565b6104ae565b34801561019057600080fd5b5061016261019f366004610e8d565b61055d565b3480156101b057600080fd5b506101626101bf366004610d97565b6105ca565b3480156101d057600080fd5b506101e46101df366004610edb565b610602565b60405161010c9190611095565b3480156101fd57600080fd5b5061013561020c366004610edb565b61061f565b34801561021d57600080fd5b5061023161022c366004610d3f565b610649565b60405161010c91906110e4565b34801561024a57600080fd5b5061013561067c565b34801561025f57600080fd5b506100ff61068b565b34801561027457600080fd5b50610162610283366004610e8d565b6106e9565b34801561029457600080fd5b506101626102a3366004610e5d565b61074a565b3480156102b457600080fd5b506101626102c3366004610de4565b6107cf565b3480156102d457600080fd5b506101e46102e3366004610d5d565b61080e565b3480156102f457600080fd5b50610162610303366004610d3f565b61083c565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156103935780601f1061036857610100808354040283529160200191610393565b820191906000526020600020905b81548152906001019060200180831161037657829003601f168201915b5050505050905090565b600090815260046020526040902054600160a060020a031690565b60006103c38261061f565b9050600160a060020a0383811690821614156103de57600080fd5b33600160a060020a03821614806103fa57506103fa813361080e565b151561040557600080fd5b60006104108361039d565b600160a060020a031614158061042e5750600160a060020a03831615155b156104a95760008281526004602052604090819020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038681169182179092559151908316907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104a09086906110e4565b60405180910390a35b505050565b806104b933826108a4565b15156104c457600080fd5b600160a060020a03841615156104d957600080fd5b600160a060020a03831615156104ee57600080fd5b6104f88483610903565b61050284836109a9565b61050c8383610a39565b82600160a060020a031684600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161054f91906110e4565b60405180910390a350505050565b600054600160a060020a031633146105935760405160e560020a62461bcd02815260040161058a906110c4565b60405180910390fd5b61059c81610602565b156105bc5760405160e560020a62461bcd02815260040161058a906110b4565b6105c68282610aca565b5050565b806105d533826108a4565b15156105e057600080fd5b6105fc84848460206040519081016040528060008152506107cf565b50505050565b600090815260036020526040902054600160a060020a0316151590565b600081815260036020526040812054600160a060020a031680151561064357600080fd5b92915050565b6000600160a060020a038216151561066057600080fd5b50600160a060020a031660009081526005602052604090205490565b600054600160a060020a031681565b60028054604080516020601f60001961010060018716150201909416859004938401819004810282018101909252828152606093909290918301828280156103935780601f1061036857610100808354040283529160200191610393565b600054600160a060020a031633146107165760405160e560020a62461bcd02815260040161058a906110c4565b61071f81610602565b15156107405760405160e560020a62461bcd02815260040161058a906110d4565b6105c68282610b2d565b600160a060020a03821633141561076057600080fd5b336000818152600660209081526040808320600160a060020a038716808552925291829020805460ff191685151517905590519091907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31906107c3908590611095565b60405180910390a35050565b816107da33826108a4565b15156107e557600080fd5b6107f08585856104ae565b6107fc85858585610b85565b151561080757600080fd5b5050505050565b600160a060020a03918216600090815260066020908152604080832093909416825291909152205460ff1690565b600054600160a060020a031633146108695760405160e560020a62461bcd02815260040161058a906110c4565b600160a060020a038116156108a1576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b6000806108b08361061f565b905080600160a060020a031684600160a060020a031614806108eb575083600160a060020a03166108e08461039d565b600160a060020a0316145b806108fb57506108fb818561080e565b949350505050565b81600160a060020a03166109168261061f565b600160a060020a03161461092957600080fd5b600081815260046020526040902054600160a060020a0316156105c657600081815260046020526040808220805473ffffffffffffffffffffffffffffffffffffffff1916905551600160a060020a038416907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906107c39085906110e4565b81600160a060020a03166109bc8261061f565b600160a060020a0316146109cf57600080fd5b600160a060020a0382166000908152600560205260409020546109f3906001610c8b565b600160a060020a03909216600090815260056020908152604080832094909455918152600390915220805473ffffffffffffffffffffffffffffffffffffffff19169055565b600081815260036020526040902054600160a060020a031615610a5b57600080fd5b6000818152600360209081526040808320805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03871690811790915583526005909152902054610aaa906001610c9d565b600160a060020a0390921660009081526005602052604090209190915550565b600160a060020a0382161515610adf57600080fd5b610ae98282610a39565b81600160a060020a03166000600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516107c391906110e4565b610b378282610903565b610b4182826109a9565b6000600160a060020a031682600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516107c391906110e4565b600080610b9185610cb3565b1515610ba05760019150610c82565b6040517ff0b9e5ba000000000000000000000000000000000000000000000000000000008152600160a060020a0386169063f0b9e5ba90610be99089908890889060040161105f565b602060405180830381600087803b158015610c0357600080fd5b505af1158015610c17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610c3b9190810190610ebd565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1981167ff0b9e5ba0000000000000000000000000000000000000000000000000000000014925090505b50949350505050565b600082821115610c9757fe5b50900390565b600082820183811015610cac57fe5b9392505050565b6000903b1190565b6000610cac8235611145565b6000610cac8235611151565b6000610cac8251611159565b6000601f82018313610cf057600080fd5b8135610d03610cfe82611119565b6110f2565b91508082526020830160208301858383011115610d1f57600080fd5b610d2a83828461117b565b50505092915050565b6000610cac8235611156565b600060208284031215610d5157600080fd5b60006108fb8484610cbb565b60008060408385031215610d7057600080fd5b6000610d7c8585610cbb565b9250506020610d8d85828601610cbb565b9150509250929050565b600080600060608486031215610dac57600080fd5b6000610db88686610cbb565b9350506020610dc986828701610cbb565b9250506040610dda86828701610d33565b9150509250925092565b60008060008060808587031215610dfa57600080fd5b6000610e068787610cbb565b9450506020610e1787828801610cbb565b9350506040610e2887828801610d33565b925050606085013567ffffffffffffffff811115610e4557600080fd5b610e5187828801610cdf565b91505092959194509250565b60008060408385031215610e7057600080fd5b6000610e7c8585610cbb565b9250506020610d8d85828601610cc7565b60008060408385031215610ea057600080fd5b6000610eac8585610cbb565b9250506020610d8d85828601610d33565b600060208284031215610ecf57600080fd5b60006108fb8484610cd3565b600060208284031215610eed57600080fd5b60006108fb8484610d33565b610f0281611145565b82525050565b610f0281611151565b6000610f1c82611141565b808452610f30816020860160208601611187565b610f39816111b3565b9093016020019392505050565b602281527f546f6b656e207769746820746f6b656e496420616c726561647920657869737460208201527f732e000000000000000000000000000000000000000000000000000000000000604082015260600190565b603381527f4f6e6c7920636f6e7472616374206f776e657220697320616c6c6f776564207460208201527f6f2063616c6c2074686973206d6574686f642e00000000000000000000000000604082015260600190565b602281527f546f6b656e207769746820746f6b656e496420646f6573206e6f74206578697360208201527f742e000000000000000000000000000000000000000000000000000000000000604082015260600190565b610f0281611156565b602081016106438284610ef9565b6060810161106d8286610ef9565b61107a6020830185611048565b818103604083015261108c8184610f11565b95945050505050565b602081016106438284610f08565b60208082528101610cac8184610f11565b6020808252810161064381610f46565b6020808252810161064381610f9c565b6020808252810161064381610ff2565b602081016106438284611048565b60405181810167ffffffffffffffff8111828210171561111157600080fd5b604052919050565b600067ffffffffffffffff82111561113057600080fd5b506020601f91909101601f19160190565b5190565b600160a060020a031690565b151590565b90565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690565b82818337506000910152565b60005b838110156111a257818101518382015260200161118a565b838111156105fc5750506000910152565b601f01601f1916905600a265627a7a723058200ffaaad094e9af24e42bef0c99c0305afe66dc20df0f57455ad67e1a0741d7c76c6578706572696d656e74616cf50037", + "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH3 0x11 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH3 0x147B CODESIZE SUB DUP1 PUSH3 0x147B DUP4 CODECOPY DUP2 ADD DUP1 PUSH1 0x40 MSTORE PUSH3 0x37 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH3 0x184 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT AND CALLER OR SWAP1 SSTORE DUP2 MLOAD DUP3 SWAP1 DUP3 SWAP1 PUSH3 0x62 SWAP1 PUSH1 0x1 SWAP1 PUSH1 0x20 DUP6 ADD SWAP1 PUSH3 0x83 JUMP JUMPDEST POP DUP1 MLOAD PUSH3 0x78 SWAP1 PUSH1 0x2 SWAP1 PUSH1 0x20 DUP5 ADD SWAP1 PUSH3 0x83 JUMP JUMPDEST POP POP POP POP POP PUSH3 0x274 JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH3 0xC6 JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH3 0xF6 JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH3 0xF6 JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH3 0xF6 JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH3 0xD9 JUMP JUMPDEST POP PUSH3 0x104 SWAP3 SWAP2 POP PUSH3 0x108 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH3 0x125 SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH3 0x104 JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH3 0x10F JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH3 0x13A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MLOAD PUSH3 0x151 PUSH3 0x14B DUP3 PUSH3 0x219 JUMP JUMPDEST PUSH3 0x1F2 JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH3 0x16E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH3 0x17B DUP4 DUP3 DUP5 PUSH3 0x241 JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH3 0x198 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 MLOAD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT ISZERO PUSH3 0x1AF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH3 0x1BD DUP6 DUP3 DUP7 ADD PUSH3 0x128 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 DUP4 ADD MLOAD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT ISZERO PUSH3 0x1DA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH3 0x1E8 DUP6 DUP3 DUP7 ADD PUSH3 0x128 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH3 0x211 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP3 GT ISZERO PUSH3 0x230 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH1 0x1F NOT AND ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH3 0x25E JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH3 0x244 JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH3 0x26E JUMPI PUSH1 0x0 DUP5 DUP5 ADD MSTORE JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH2 0x11F7 DUP1 PUSH3 0x284 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0xE5 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x6FDDE03 DUP2 EQ PUSH2 0xEA JUMPI DUP1 PUSH4 0x81812FC EQ PUSH2 0x115 JUMPI DUP1 PUSH4 0x95EA7B3 EQ PUSH2 0x142 JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0x164 JUMPI DUP1 PUSH4 0x40C10F19 EQ PUSH2 0x184 JUMPI DUP1 PUSH4 0x42842E0E EQ PUSH2 0x1A4 JUMPI DUP1 PUSH4 0x4F558E79 EQ PUSH2 0x1C4 JUMPI DUP1 PUSH4 0x6352211E EQ PUSH2 0x1F1 JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0x211 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x23E JUMPI DUP1 PUSH4 0x95D89B41 EQ PUSH2 0x253 JUMPI DUP1 PUSH4 0x9DC29FAC EQ PUSH2 0x268 JUMPI DUP1 PUSH4 0xA22CB465 EQ PUSH2 0x288 JUMPI DUP1 PUSH4 0xB88D4FDE EQ PUSH2 0x2A8 JUMPI DUP1 PUSH4 0xE985E9C5 EQ PUSH2 0x2C8 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x2E8 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xF6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xFF PUSH2 0x308 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x10C SWAP2 SWAP1 PUSH2 0x10A3 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x121 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x135 PUSH2 0x130 CALLDATASIZE PUSH1 0x4 PUSH2 0xEDB JUMP JUMPDEST PUSH2 0x39D JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x10C SWAP2 SWAP1 PUSH2 0x1051 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x14E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x162 PUSH2 0x15D CALLDATASIZE PUSH1 0x4 PUSH2 0xE8D JUMP JUMPDEST PUSH2 0x3B8 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x170 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x162 PUSH2 0x17F CALLDATASIZE PUSH1 0x4 PUSH2 0xD97 JUMP JUMPDEST PUSH2 0x4AE JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x190 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x162 PUSH2 0x19F CALLDATASIZE PUSH1 0x4 PUSH2 0xE8D JUMP JUMPDEST PUSH2 0x55D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1B0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x162 PUSH2 0x1BF CALLDATASIZE PUSH1 0x4 PUSH2 0xD97 JUMP JUMPDEST PUSH2 0x5CA JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1D0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1E4 PUSH2 0x1DF CALLDATASIZE PUSH1 0x4 PUSH2 0xEDB JUMP JUMPDEST PUSH2 0x602 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x10C SWAP2 SWAP1 PUSH2 0x1095 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1FD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x135 PUSH2 0x20C CALLDATASIZE PUSH1 0x4 PUSH2 0xEDB JUMP JUMPDEST PUSH2 0x61F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x21D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x231 PUSH2 0x22C CALLDATASIZE PUSH1 0x4 PUSH2 0xD3F JUMP JUMPDEST PUSH2 0x649 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x10C SWAP2 SWAP1 PUSH2 0x10E4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x24A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x135 PUSH2 0x67C JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x25F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xFF PUSH2 0x68B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x274 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x162 PUSH2 0x283 CALLDATASIZE PUSH1 0x4 PUSH2 0xE8D JUMP JUMPDEST PUSH2 0x6E9 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x294 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x162 PUSH2 0x2A3 CALLDATASIZE PUSH1 0x4 PUSH2 0xE5D JUMP JUMPDEST PUSH2 0x74A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2B4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x162 PUSH2 0x2C3 CALLDATASIZE PUSH1 0x4 PUSH2 0xDE4 JUMP JUMPDEST PUSH2 0x7CF JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2D4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1E4 PUSH2 0x2E3 CALLDATASIZE PUSH1 0x4 PUSH2 0xD5D JUMP JUMPDEST PUSH2 0x80E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2F4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x162 PUSH2 0x303 CALLDATASIZE PUSH1 0x4 PUSH2 0xD3F JUMP JUMPDEST PUSH2 0x83C JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH1 0x0 NOT PUSH2 0x100 DUP8 DUP10 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH1 0x60 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x393 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x368 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x393 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x376 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x3C3 DUP3 PUSH2 0x61F JUMP JUMPDEST SWAP1 POP PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP4 DUP2 AND SWAP1 DUP3 AND EQ ISZERO PUSH2 0x3DE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST CALLER PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP3 AND EQ DUP1 PUSH2 0x3FA JUMPI POP PUSH2 0x3FA DUP2 CALLER PUSH2 0x80E JUMP JUMPDEST ISZERO ISZERO PUSH2 0x405 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x410 DUP4 PUSH2 0x39D JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND EQ ISZERO DUP1 PUSH2 0x42E JUMPI POP PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP4 AND ISZERO ISZERO JUMPDEST ISZERO PUSH2 0x4A9 JUMPI PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP7 DUP2 AND SWAP2 DUP3 OR SWAP1 SWAP3 SSTORE SWAP2 MLOAD SWAP1 DUP4 AND SWAP1 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP1 PUSH2 0x4A0 SWAP1 DUP7 SWAP1 PUSH2 0x10E4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 JUMPDEST POP POP POP JUMP JUMPDEST DUP1 PUSH2 0x4B9 CALLER DUP3 PUSH2 0x8A4 JUMP JUMPDEST ISZERO ISZERO PUSH2 0x4C4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP5 AND ISZERO ISZERO PUSH2 0x4D9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP4 AND ISZERO ISZERO PUSH2 0x4EE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4F8 DUP5 DUP4 PUSH2 0x903 JUMP JUMPDEST PUSH2 0x502 DUP5 DUP4 PUSH2 0x9A9 JUMP JUMPDEST PUSH2 0x50C DUP4 DUP4 PUSH2 0xA39 JUMP JUMPDEST DUP3 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP5 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF DUP5 PUSH1 0x40 MLOAD PUSH2 0x54F SWAP2 SWAP1 PUSH2 0x10E4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND CALLER EQ PUSH2 0x593 JUMPI PUSH1 0x40 MLOAD PUSH1 0xE5 PUSH1 0x2 EXP PUSH3 0x461BCD MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x58A SWAP1 PUSH2 0x10C4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x59C DUP2 PUSH2 0x602 JUMP JUMPDEST ISZERO PUSH2 0x5BC JUMPI PUSH1 0x40 MLOAD PUSH1 0xE5 PUSH1 0x2 EXP PUSH3 0x461BCD MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x58A SWAP1 PUSH2 0x10B4 JUMP JUMPDEST PUSH2 0x5C6 DUP3 DUP3 PUSH2 0xACA JUMP JUMPDEST POP POP JUMP JUMPDEST DUP1 PUSH2 0x5D5 CALLER DUP3 PUSH2 0x8A4 JUMP JUMPDEST ISZERO ISZERO PUSH2 0x5E0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x5FC DUP5 DUP5 DUP5 PUSH1 0x20 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x0 DUP2 MSTORE POP PUSH2 0x7CF JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND ISZERO ISZERO SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP1 ISZERO ISZERO PUSH2 0x643 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP3 AND ISZERO ISZERO PUSH2 0x660 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x5 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP2 JUMP JUMPDEST PUSH1 0x2 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x0 NOT PUSH2 0x100 PUSH1 0x1 DUP8 AND ISZERO MUL ADD SWAP1 SWAP5 AND DUP6 SWAP1 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH1 0x60 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x393 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x368 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x393 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND CALLER EQ PUSH2 0x716 JUMPI PUSH1 0x40 MLOAD PUSH1 0xE5 PUSH1 0x2 EXP PUSH3 0x461BCD MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x58A SWAP1 PUSH2 0x10C4 JUMP JUMPDEST PUSH2 0x71F DUP2 PUSH2 0x602 JUMP JUMPDEST ISZERO ISZERO PUSH2 0x740 JUMPI PUSH1 0x40 MLOAD PUSH1 0xE5 PUSH1 0x2 EXP PUSH3 0x461BCD MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x58A SWAP1 PUSH2 0x10D4 JUMP JUMPDEST PUSH2 0x5C6 DUP3 DUP3 PUSH2 0xB2D JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP3 AND CALLER EQ ISZERO PUSH2 0x760 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x6 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP8 AND DUP1 DUP6 MSTORE SWAP3 MSTORE SWAP2 DUP3 SWAP1 KECCAK256 DUP1 SLOAD PUSH1 0xFF NOT AND DUP6 ISZERO ISZERO OR SWAP1 SSTORE SWAP1 MLOAD SWAP1 SWAP2 SWAP1 PUSH32 0x17307EAB39AB6107E8899845AD3D59BD9653F200F220920489CA2B5937696C31 SWAP1 PUSH2 0x7C3 SWAP1 DUP6 SWAP1 PUSH2 0x1095 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP JUMP JUMPDEST DUP2 PUSH2 0x7DA CALLER DUP3 PUSH2 0x8A4 JUMP JUMPDEST ISZERO ISZERO PUSH2 0x7E5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x7F0 DUP6 DUP6 DUP6 PUSH2 0x4AE JUMP JUMPDEST PUSH2 0x7FC DUP6 DUP6 DUP6 DUP6 PUSH2 0xB85 JUMP JUMPDEST ISZERO ISZERO PUSH2 0x807 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP2 DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x6 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 SWAP1 SWAP5 AND DUP3 MSTORE SWAP2 SWAP1 SWAP2 MSTORE KECCAK256 SLOAD PUSH1 0xFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND CALLER EQ PUSH2 0x869 JUMPI PUSH1 0x40 MLOAD PUSH1 0xE5 PUSH1 0x2 EXP PUSH3 0x461BCD MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x58A SWAP1 PUSH2 0x10C4 JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP2 AND ISZERO PUSH2 0x8A1 JUMPI PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP4 AND OR SWAP1 SSTORE JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x8B0 DUP4 PUSH2 0x61F JUMP JUMPDEST SWAP1 POP DUP1 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP5 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND EQ DUP1 PUSH2 0x8EB JUMPI POP DUP4 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH2 0x8E0 DUP5 PUSH2 0x39D JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND EQ JUMPDEST DUP1 PUSH2 0x8FB JUMPI POP PUSH2 0x8FB DUP2 DUP6 PUSH2 0x80E JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST DUP2 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH2 0x916 DUP3 PUSH2 0x61F JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND EQ PUSH2 0x929 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND ISZERO PUSH2 0x5C6 JUMPI PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND SWAP1 SSTORE MLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP5 AND SWAP1 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP1 PUSH2 0x7C3 SWAP1 DUP6 SWAP1 PUSH2 0x10E4 JUMP JUMPDEST DUP2 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH2 0x9BC DUP3 PUSH2 0x61F JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND EQ PUSH2 0x9CF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x5 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH2 0x9F3 SWAP1 PUSH1 0x1 PUSH2 0xC8B JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP1 SWAP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x5 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP5 SWAP1 SWAP5 SSTORE SWAP2 DUP2 MSTORE PUSH1 0x3 SWAP1 SWAP2 MSTORE KECCAK256 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND SWAP1 SSTORE JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND ISZERO PUSH2 0xA5B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP8 AND SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP4 MSTORE PUSH1 0x5 SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH2 0xAAA SWAP1 PUSH1 0x1 PUSH2 0xC9D JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP1 SWAP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x5 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SWAP2 SWAP1 SWAP2 SSTORE POP JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP3 AND ISZERO ISZERO PUSH2 0xADF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xAE9 DUP3 DUP3 PUSH2 0xA39 JUMP JUMPDEST DUP2 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH1 0x0 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF DUP4 PUSH1 0x40 MLOAD PUSH2 0x7C3 SWAP2 SWAP1 PUSH2 0x10E4 JUMP JUMPDEST PUSH2 0xB37 DUP3 DUP3 PUSH2 0x903 JUMP JUMPDEST PUSH2 0xB41 DUP3 DUP3 PUSH2 0x9A9 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP3 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF DUP4 PUSH1 0x40 MLOAD PUSH2 0x7C3 SWAP2 SWAP1 PUSH2 0x10E4 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0xB91 DUP6 PUSH2 0xCB3 JUMP JUMPDEST ISZERO ISZERO PUSH2 0xBA0 JUMPI PUSH1 0x1 SWAP2 POP PUSH2 0xC82 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0xF0B9E5BA00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP7 AND SWAP1 PUSH4 0xF0B9E5BA SWAP1 PUSH2 0xBE9 SWAP1 DUP10 SWAP1 DUP9 SWAP1 DUP9 SWAP1 PUSH1 0x4 ADD PUSH2 0x105F JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xC03 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0xC17 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0xC3B SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0xEBD JUMP JUMPDEST PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT DUP2 AND PUSH32 0xF0B9E5BA00000000000000000000000000000000000000000000000000000000 EQ SWAP3 POP SWAP1 POP JUMPDEST POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0xC97 JUMPI INVALID JUMPDEST POP SWAP1 SUB SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0xCAC JUMPI INVALID JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 SWAP1 EXTCODESIZE GT SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xCAC DUP3 CALLDATALOAD PUSH2 0x1145 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xCAC DUP3 CALLDATALOAD PUSH2 0x1151 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xCAC DUP3 MLOAD PUSH2 0x1159 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0xCF0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0xD03 PUSH2 0xCFE DUP3 PUSH2 0x1119 JUMP JUMPDEST PUSH2 0x10F2 JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH2 0xD1F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xD2A DUP4 DUP3 DUP5 PUSH2 0x117B JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xCAC DUP3 CALLDATALOAD PUSH2 0x1156 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xD51 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x8FB DUP5 DUP5 PUSH2 0xCBB JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0xD70 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xD7C DUP6 DUP6 PUSH2 0xCBB JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0xD8D DUP6 DUP3 DUP7 ADD PUSH2 0xCBB JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0xDAC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xDB8 DUP7 DUP7 PUSH2 0xCBB JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0xDC9 DUP7 DUP3 DUP8 ADD PUSH2 0xCBB JUMP JUMPDEST SWAP3 POP POP PUSH1 0x40 PUSH2 0xDDA DUP7 DUP3 DUP8 ADD PUSH2 0xD33 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 POP SWAP3 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x80 DUP6 DUP8 SUB SLT ISZERO PUSH2 0xDFA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xE06 DUP8 DUP8 PUSH2 0xCBB JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 PUSH2 0xE17 DUP8 DUP3 DUP9 ADD PUSH2 0xCBB JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 PUSH2 0xE28 DUP8 DUP3 DUP9 ADD PUSH2 0xD33 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x60 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0xE45 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xE51 DUP8 DUP3 DUP9 ADD PUSH2 0xCDF JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 SWAP2 SWAP5 POP SWAP3 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0xE70 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xE7C DUP6 DUP6 PUSH2 0xCBB JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0xD8D DUP6 DUP3 DUP7 ADD PUSH2 0xCC7 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0xEA0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xEAC DUP6 DUP6 PUSH2 0xCBB JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0xD8D DUP6 DUP3 DUP7 ADD PUSH2 0xD33 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xECF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x8FB DUP5 DUP5 PUSH2 0xCD3 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xEED JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x8FB DUP5 DUP5 PUSH2 0xD33 JUMP JUMPDEST PUSH2 0xF02 DUP2 PUSH2 0x1145 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH2 0xF02 DUP2 PUSH2 0x1151 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xF1C DUP3 PUSH2 0x1141 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH2 0xF30 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0x1187 JUMP JUMPDEST PUSH2 0xF39 DUP2 PUSH2 0x11B3 JUMP JUMPDEST SWAP1 SWAP4 ADD PUSH1 0x20 ADD SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x22 DUP2 MSTORE PUSH32 0x546F6B656E207769746820746F6B656E496420616C7265616479206578697374 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x732E000000000000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x33 DUP2 MSTORE PUSH32 0x4F6E6C7920636F6E7472616374206F776E657220697320616C6C6F7765642074 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x6F2063616C6C2074686973206D6574686F642E00000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x22 DUP2 MSTORE PUSH32 0x546F6B656E207769746820746F6B656E496420646F6573206E6F742065786973 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x742E000000000000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH2 0xF02 DUP2 PUSH2 0x1156 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x643 DUP3 DUP5 PUSH2 0xEF9 JUMP JUMPDEST PUSH1 0x60 DUP2 ADD PUSH2 0x106D DUP3 DUP7 PUSH2 0xEF9 JUMP JUMPDEST PUSH2 0x107A PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0x1048 JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x108C DUP2 DUP5 PUSH2 0xF11 JUMP JUMPDEST SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x643 DUP3 DUP5 PUSH2 0xF08 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xCAC DUP2 DUP5 PUSH2 0xF11 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x643 DUP2 PUSH2 0xF46 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x643 DUP2 PUSH2 0xF9C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x643 DUP2 PUSH2 0xFF2 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x643 DUP3 DUP5 PUSH2 0x1048 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x1111 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x1130 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH1 0x1F NOT AND ADD SWAP1 JUMP JUMPDEST MLOAD SWAP1 JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND SWAP1 JUMP JUMPDEST ISZERO ISZERO SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND SWAP1 JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x11A2 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x118A JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0x5FC JUMPI POP POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x1F ADD PUSH1 0x1F NOT AND SWAP1 JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 0xf STATICCALL 0xaa 0xd0 SWAP5 0xe9 0xaf 0x24 0xe4 0x2b 0xef 0xc SWAP10 0xc0 ADDRESS GAS INVALID PUSH7 0xDC20DF0F57455A 0xd6 PUSH31 0x1A0741D7C76C6578706572696D656E74616CF5003700000000000000000000 ", + "sourceMap": "734:1237:0:-;;;950:118;8:9:-1;5:2;;;30:1;27;20:12;5:2;950:118:0;;;;;;;;;;;;;;;;;;;;;;;;363:5:5;:18;;-1:-1:-1;;;;;;363:18:5;371:10;363:18;;;2885:13:1;;1048:4:0;;1054:6;;2885:13:1;;363:18:5;;2885:13:1;;;;;:::i;:::-;-1:-1:-1;2908:17:1;;;;:7;;:17;;;;;:::i;:::-;;2788:144;;950:118:0;;734:1237;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;734:1237:0;;;-1:-1:-1;734:1237:0;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;:::o;6:444:-1:-;;112:4;100:17;;96:27;-1:-1;86:2;;137:1;134;127:12;86:2;167:6;161:13;189:65;204:49;246:6;204:49;;;189:65;;;180:74;;274:6;267:5;260:21;310:4;302:6;298:17;343:4;336:5;332:16;378:3;369:6;364:3;360:16;357:25;354:2;;;395:1;392;385:12;354:2;405:39;437:6;432:3;427;405:39;;;79:371;;;;;;;;458:597;;;610:2;598:9;589:7;585:23;581:32;578:2;;;626:1;623;616:12;578:2;661:24;;-1:-1;;;;;694:30;;691:2;;;737:1;734;727:12;691:2;757:74;823:7;814:6;803:9;799:22;757:74;;;747:84;;640:197;889:2;878:9;874:18;868:25;-1:-1;;;;;905:6;902:30;899:2;;;945:1;942;935:12;899:2;965:74;1031:7;1022:6;1011:9;1007:22;965:74;;;955:84;;847:198;572:483;;;;;;1062:256;1124:2;1118:9;1150:17;;;-1:-1;;;;;1210:34;;1246:22;;;1207:62;1204:2;;;1282:1;1279;1272:12;1204:2;1298;1291:22;1102:216;;-1:-1;1102:216;1325:259;;-1:-1;;;;;1461:6;1458:30;1455:2;;;1501:1;1498;1491:12;1455:2;-1:-1;1574:4;1545;1522:17;;;;-1:-1;;1518:33;1564:15;;1392:192;1592:268;1657:1;1664:101;1678:6;1675:1;1672:13;1664:101;;;1745:11;;;1739:18;1726:11;;;1719:39;1700:2;1693:10;1664:101;;;1780:6;1777:1;1774:13;1771:2;;;1845:1;1836:6;1831:3;1827:16;1820:27;1771:2;1641:219;;;;;;734:1237:0;;;;;;" }, "deployedBytecode": { "linkReferences": {}, - "object": "0x6080604052600436106100da5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100df578063081812fc1461010a578063095ea7b31461013757806323b872dd1461015957806340c10f191461017957806342842e0e146101995780634f558e79146101b95780636352211e146101e657806370a08231146102065780638da5cb5b1461023357806395d89b4114610248578063a22cb4651461025d578063b88d4fde1461027d578063e985e9c51461029d578063f2fde38b146102bd575b600080fd5b3480156100eb57600080fd5b506100f46102dd565b6040516101019190610fae565b60405180910390f35b34801561011657600080fd5b5061012a610125366004610e3c565b610372565b6040516101019190610f5c565b34801561014357600080fd5b50610157610152366004610dee565b61038d565b005b34801561016557600080fd5b50610157610174366004610cf8565b610483565b34801561018557600080fd5b50610157610194366004610dee565b610532565b3480156101a557600080fd5b506101576101b4366004610cf8565b6105cd565b3480156101c557600080fd5b506101d96101d4366004610e3c565b610605565b6040516101019190610fa0565b3480156101f257600080fd5b5061012a610201366004610e3c565b610622565b34801561021257600080fd5b50610226610221366004610ca0565b61064c565b6040516101019190610fdf565b34801561023f57600080fd5b5061012a61067f565b34801561025457600080fd5b506100f461068e565b34801561026957600080fd5b50610157610278366004610dbe565b6106ec565b34801561028957600080fd5b50610157610298366004610d45565b610771565b3480156102a957600080fd5b506101d96102b8366004610cbe565b6107b0565b3480156102c957600080fd5b506101576102d8366004610ca0565b6107de565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156103685780601f1061033d57610100808354040283529160200191610368565b820191906000526020600020905b81548152906001019060200180831161034b57829003601f168201915b5050505050905090565b600090815260046020526040902054600160a060020a031690565b600061039882610622565b9050600160a060020a0383811690821614156103b357600080fd5b33600160a060020a03821614806103cf57506103cf81336107b0565b15156103da57600080fd5b60006103e583610372565b600160a060020a03161415806104035750600160a060020a03831615155b1561047e5760008281526004602052604090819020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038681169182179092559151908316907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610475908690610fdf565b60405180910390a35b505050565b8061048e338261085d565b151561049957600080fd5b600160a060020a03841615156104ae57600080fd5b600160a060020a03831615156104c357600080fd5b6104cd84836108bc565b6104d78483610962565b6104e183836109f2565b82600160a060020a031684600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516105249190610fdf565b60405180910390a350505050565b600054600160a060020a0316331461057f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161057690610fcf565b60405180910390fd5b61058881610605565b156105bf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161057690610fbf565b6105c98282610a83565b5050565b806105d8338261085d565b15156105e357600080fd5b6105ff8484846020604051908101604052806000815250610771565b50505050565b600090815260036020526040902054600160a060020a0316151590565b600081815260036020526040812054600160a060020a031680151561064657600080fd5b92915050565b6000600160a060020a038216151561066357600080fd5b50600160a060020a031660009081526005602052604090205490565b600054600160a060020a031681565b60028054604080516020601f60001961010060018716150201909416859004938401819004810282018101909252828152606093909290918301828280156103685780601f1061033d57610100808354040283529160200191610368565b600160a060020a03821633141561070257600080fd5b336000818152600660209081526040808320600160a060020a038716808552925291829020805460ff191685151517905590519091907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3190610765908590610fa0565b60405180910390a35050565b8161077c338261085d565b151561078757600080fd5b610792858585610483565b61079e85858585610ae6565b15156107a957600080fd5b5050505050565b600160a060020a03918216600090815260066020908152604080832093909416825291909152205460ff1690565b600054600160a060020a03163314610822576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161057690610fcf565b600160a060020a0381161561085a576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b60008061086983610622565b905080600160a060020a031684600160a060020a031614806108a4575083600160a060020a031661089984610372565b600160a060020a0316145b806108b457506108b481856107b0565b949350505050565b81600160a060020a03166108cf82610622565b600160a060020a0316146108e257600080fd5b600081815260046020526040902054600160a060020a0316156105c957600081815260046020526040808220805473ffffffffffffffffffffffffffffffffffffffff1916905551600160a060020a038416907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610765908590610fdf565b81600160a060020a031661097582610622565b600160a060020a03161461098857600080fd5b600160a060020a0382166000908152600560205260409020546109ac906001610bec565b600160a060020a03909216600090815260056020908152604080832094909455918152600390915220805473ffffffffffffffffffffffffffffffffffffffff19169055565b600081815260036020526040902054600160a060020a031615610a1457600080fd5b6000818152600360209081526040808320805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03871690811790915583526005909152902054610a63906001610bfe565b600160a060020a0390921660009081526005602052604090209190915550565b600160a060020a0382161515610a9857600080fd5b610aa282826109f2565b81600160a060020a03166000600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516107659190610fdf565b600080610af285610c14565b1515610b015760019150610be3565b6040517ff0b9e5ba000000000000000000000000000000000000000000000000000000008152600160a060020a0386169063f0b9e5ba90610b4a90899088908890600401610f6a565b602060405180830381600087803b158015610b6457600080fd5b505af1158015610b78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610b9c9190810190610e1e565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1981167ff0b9e5ba0000000000000000000000000000000000000000000000000000000014925090505b50949350505050565b600082821115610bf857fe5b50900390565b600082820183811015610c0d57fe5b9392505050565b6000903b1190565b6000610c0d8235611040565b6000610c0d823561104c565b6000610c0d8251611054565b6000601f82018313610c5157600080fd5b8135610c64610c5f82611014565b610fed565b91508082526020830160208301858383011115610c8057600080fd5b610c8b838284611076565b50505092915050565b6000610c0d8235611051565b600060208284031215610cb257600080fd5b60006108b48484610c1c565b60008060408385031215610cd157600080fd5b6000610cdd8585610c1c565b9250506020610cee85828601610c1c565b9150509250929050565b600080600060608486031215610d0d57600080fd5b6000610d198686610c1c565b9350506020610d2a86828701610c1c565b9250506040610d3b86828701610c94565b9150509250925092565b60008060008060808587031215610d5b57600080fd5b6000610d678787610c1c565b9450506020610d7887828801610c1c565b9350506040610d8987828801610c94565b925050606085013567ffffffffffffffff811115610da657600080fd5b610db287828801610c40565b91505092959194509250565b60008060408385031215610dd157600080fd5b6000610ddd8585610c1c565b9250506020610cee85828601610c28565b60008060408385031215610e0157600080fd5b6000610e0d8585610c1c565b9250506020610cee85828601610c94565b600060208284031215610e3057600080fd5b60006108b48484610c34565b600060208284031215610e4e57600080fd5b60006108b48484610c94565b610e6381611040565b82525050565b610e638161104c565b6000610e7d8261103c565b808452610e91816020860160208601611082565b610e9a816110ae565b9093016020019392505050565b602281527f546f6b656e207769746820746f6b656e496420616c726561647920657869737460208201527f732e000000000000000000000000000000000000000000000000000000000000604082015260600190565b603381527f4f6e6c7920636f6e7472616374206f776e657220697320616c6c6f776564207460208201527f6f2063616c6c2074686973206d6574686f642e00000000000000000000000000604082015260600190565b610e6381611051565b602081016106468284610e5a565b60608101610f788286610e5a565b610f856020830185610f53565b8181036040830152610f978184610e72565b95945050505050565b602081016106468284610e69565b60208082528101610c0d8184610e72565b6020808252810161064681610ea7565b6020808252810161064681610efd565b602081016106468284610f53565b60405181810167ffffffffffffffff8111828210171561100c57600080fd5b604052919050565b600067ffffffffffffffff82111561102b57600080fd5b506020601f91909101601f19160190565b5190565b600160a060020a031690565b151590565b90565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690565b82818337506000910152565b60005b8381101561109d578181015183820152602001611085565b838111156105ff5750506000910152565b601f01601f1916905600a265627a7a72305820dca99ed080138e68d1f26208ce796f211cfc01d8c3da8021f8ee95e54f4b4d2d6c6578706572696d656e74616cf50037", - "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0xDA JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x6FDDE03 DUP2 EQ PUSH2 0xDF JUMPI DUP1 PUSH4 0x81812FC EQ PUSH2 0x10A JUMPI DUP1 PUSH4 0x95EA7B3 EQ PUSH2 0x137 JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0x159 JUMPI DUP1 PUSH4 0x40C10F19 EQ PUSH2 0x179 JUMPI DUP1 PUSH4 0x42842E0E EQ PUSH2 0x199 JUMPI DUP1 PUSH4 0x4F558E79 EQ PUSH2 0x1B9 JUMPI DUP1 PUSH4 0x6352211E EQ PUSH2 0x1E6 JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0x206 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x233 JUMPI DUP1 PUSH4 0x95D89B41 EQ PUSH2 0x248 JUMPI DUP1 PUSH4 0xA22CB465 EQ PUSH2 0x25D JUMPI DUP1 PUSH4 0xB88D4FDE EQ PUSH2 0x27D JUMPI DUP1 PUSH4 0xE985E9C5 EQ PUSH2 0x29D JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x2BD JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xEB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xF4 PUSH2 0x2DD JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x101 SWAP2 SWAP1 PUSH2 0xFAE JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x116 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x12A PUSH2 0x125 CALLDATASIZE PUSH1 0x4 PUSH2 0xE3C JUMP JUMPDEST PUSH2 0x372 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x101 SWAP2 SWAP1 PUSH2 0xF5C JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x143 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x157 PUSH2 0x152 CALLDATASIZE PUSH1 0x4 PUSH2 0xDEE JUMP JUMPDEST PUSH2 0x38D JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x165 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x157 PUSH2 0x174 CALLDATASIZE PUSH1 0x4 PUSH2 0xCF8 JUMP JUMPDEST PUSH2 0x483 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x185 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x157 PUSH2 0x194 CALLDATASIZE PUSH1 0x4 PUSH2 0xDEE JUMP JUMPDEST PUSH2 0x532 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1A5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x157 PUSH2 0x1B4 CALLDATASIZE PUSH1 0x4 PUSH2 0xCF8 JUMP JUMPDEST PUSH2 0x5CD JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1C5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1D9 PUSH2 0x1D4 CALLDATASIZE PUSH1 0x4 PUSH2 0xE3C JUMP JUMPDEST PUSH2 0x605 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x101 SWAP2 SWAP1 PUSH2 0xFA0 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1F2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x12A PUSH2 0x201 CALLDATASIZE PUSH1 0x4 PUSH2 0xE3C JUMP JUMPDEST PUSH2 0x622 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x212 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x226 PUSH2 0x221 CALLDATASIZE PUSH1 0x4 PUSH2 0xCA0 JUMP JUMPDEST PUSH2 0x64C JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x101 SWAP2 SWAP1 PUSH2 0xFDF JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x23F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x12A PUSH2 0x67F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x254 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xF4 PUSH2 0x68E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x269 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x157 PUSH2 0x278 CALLDATASIZE PUSH1 0x4 PUSH2 0xDBE JUMP JUMPDEST PUSH2 0x6EC JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x289 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x157 PUSH2 0x298 CALLDATASIZE PUSH1 0x4 PUSH2 0xD45 JUMP JUMPDEST PUSH2 0x771 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2A9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1D9 PUSH2 0x2B8 CALLDATASIZE PUSH1 0x4 PUSH2 0xCBE JUMP JUMPDEST PUSH2 0x7B0 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2C9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x157 PUSH2 0x2D8 CALLDATASIZE PUSH1 0x4 PUSH2 0xCA0 JUMP JUMPDEST PUSH2 0x7DE JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH1 0x0 NOT PUSH2 0x100 DUP8 DUP10 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH1 0x60 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x368 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x33D JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x368 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x34B JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x398 DUP3 PUSH2 0x622 JUMP JUMPDEST SWAP1 POP PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP4 DUP2 AND SWAP1 DUP3 AND EQ ISZERO PUSH2 0x3B3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST CALLER PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP3 AND EQ DUP1 PUSH2 0x3CF JUMPI POP PUSH2 0x3CF DUP2 CALLER PUSH2 0x7B0 JUMP JUMPDEST ISZERO ISZERO PUSH2 0x3DA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x3E5 DUP4 PUSH2 0x372 JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND EQ ISZERO DUP1 PUSH2 0x403 JUMPI POP PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP4 AND ISZERO ISZERO JUMPDEST ISZERO PUSH2 0x47E JUMPI PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP7 DUP2 AND SWAP2 DUP3 OR SWAP1 SWAP3 SSTORE SWAP2 MLOAD SWAP1 DUP4 AND SWAP1 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP1 PUSH2 0x475 SWAP1 DUP7 SWAP1 PUSH2 0xFDF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 JUMPDEST POP POP POP JUMP JUMPDEST DUP1 PUSH2 0x48E CALLER DUP3 PUSH2 0x85D JUMP JUMPDEST ISZERO ISZERO PUSH2 0x499 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP5 AND ISZERO ISZERO PUSH2 0x4AE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP4 AND ISZERO ISZERO PUSH2 0x4C3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4CD DUP5 DUP4 PUSH2 0x8BC JUMP JUMPDEST PUSH2 0x4D7 DUP5 DUP4 PUSH2 0x962 JUMP JUMPDEST PUSH2 0x4E1 DUP4 DUP4 PUSH2 0x9F2 JUMP JUMPDEST DUP3 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP5 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF DUP5 PUSH1 0x40 MLOAD PUSH2 0x524 SWAP2 SWAP1 PUSH2 0xFDF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND CALLER EQ PUSH2 0x57F JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x576 SWAP1 PUSH2 0xFCF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x588 DUP2 PUSH2 0x605 JUMP JUMPDEST ISZERO PUSH2 0x5BF JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x576 SWAP1 PUSH2 0xFBF JUMP JUMPDEST PUSH2 0x5C9 DUP3 DUP3 PUSH2 0xA83 JUMP JUMPDEST POP POP JUMP JUMPDEST DUP1 PUSH2 0x5D8 CALLER DUP3 PUSH2 0x85D JUMP JUMPDEST ISZERO ISZERO PUSH2 0x5E3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x5FF DUP5 DUP5 DUP5 PUSH1 0x20 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x0 DUP2 MSTORE POP PUSH2 0x771 JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND ISZERO ISZERO SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP1 ISZERO ISZERO PUSH2 0x646 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP3 AND ISZERO ISZERO PUSH2 0x663 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x5 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP2 JUMP JUMPDEST PUSH1 0x2 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x0 NOT PUSH2 0x100 PUSH1 0x1 DUP8 AND ISZERO MUL ADD SWAP1 SWAP5 AND DUP6 SWAP1 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH1 0x60 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x368 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x33D JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x368 JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP3 AND CALLER EQ ISZERO PUSH2 0x702 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x6 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP8 AND DUP1 DUP6 MSTORE SWAP3 MSTORE SWAP2 DUP3 SWAP1 KECCAK256 DUP1 SLOAD PUSH1 0xFF NOT AND DUP6 ISZERO ISZERO OR SWAP1 SSTORE SWAP1 MLOAD SWAP1 SWAP2 SWAP1 PUSH32 0x17307EAB39AB6107E8899845AD3D59BD9653F200F220920489CA2B5937696C31 SWAP1 PUSH2 0x765 SWAP1 DUP6 SWAP1 PUSH2 0xFA0 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP JUMP JUMPDEST DUP2 PUSH2 0x77C CALLER DUP3 PUSH2 0x85D JUMP JUMPDEST ISZERO ISZERO PUSH2 0x787 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x792 DUP6 DUP6 DUP6 PUSH2 0x483 JUMP JUMPDEST PUSH2 0x79E DUP6 DUP6 DUP6 DUP6 PUSH2 0xAE6 JUMP JUMPDEST ISZERO ISZERO PUSH2 0x7A9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP2 DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x6 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 SWAP1 SWAP5 AND DUP3 MSTORE SWAP2 SWAP1 SWAP2 MSTORE KECCAK256 SLOAD PUSH1 0xFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND CALLER EQ PUSH2 0x822 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x576 SWAP1 PUSH2 0xFCF JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP2 AND ISZERO PUSH2 0x85A JUMPI PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP4 AND OR SWAP1 SSTORE JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x869 DUP4 PUSH2 0x622 JUMP JUMPDEST SWAP1 POP DUP1 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP5 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND EQ DUP1 PUSH2 0x8A4 JUMPI POP DUP4 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH2 0x899 DUP5 PUSH2 0x372 JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND EQ JUMPDEST DUP1 PUSH2 0x8B4 JUMPI POP PUSH2 0x8B4 DUP2 DUP6 PUSH2 0x7B0 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST DUP2 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH2 0x8CF DUP3 PUSH2 0x622 JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND EQ PUSH2 0x8E2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND ISZERO PUSH2 0x5C9 JUMPI PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND SWAP1 SSTORE MLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP5 AND SWAP1 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP1 PUSH2 0x765 SWAP1 DUP6 SWAP1 PUSH2 0xFDF JUMP JUMPDEST DUP2 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH2 0x975 DUP3 PUSH2 0x622 JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND EQ PUSH2 0x988 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x5 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH2 0x9AC SWAP1 PUSH1 0x1 PUSH2 0xBEC JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP1 SWAP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x5 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP5 SWAP1 SWAP5 SSTORE SWAP2 DUP2 MSTORE PUSH1 0x3 SWAP1 SWAP2 MSTORE KECCAK256 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND SWAP1 SSTORE JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND ISZERO PUSH2 0xA14 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP8 AND SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP4 MSTORE PUSH1 0x5 SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH2 0xA63 SWAP1 PUSH1 0x1 PUSH2 0xBFE JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP1 SWAP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x5 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SWAP2 SWAP1 SWAP2 SSTORE POP JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP3 AND ISZERO ISZERO PUSH2 0xA98 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xAA2 DUP3 DUP3 PUSH2 0x9F2 JUMP JUMPDEST DUP2 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH1 0x0 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF DUP4 PUSH1 0x40 MLOAD PUSH2 0x765 SWAP2 SWAP1 PUSH2 0xFDF JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0xAF2 DUP6 PUSH2 0xC14 JUMP JUMPDEST ISZERO ISZERO PUSH2 0xB01 JUMPI PUSH1 0x1 SWAP2 POP PUSH2 0xBE3 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0xF0B9E5BA00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP7 AND SWAP1 PUSH4 0xF0B9E5BA SWAP1 PUSH2 0xB4A SWAP1 DUP10 SWAP1 DUP9 SWAP1 DUP9 SWAP1 PUSH1 0x4 ADD PUSH2 0xF6A JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xB64 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0xB78 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0xB9C SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0xE1E JUMP JUMPDEST PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT DUP2 AND PUSH32 0xF0B9E5BA00000000000000000000000000000000000000000000000000000000 EQ SWAP3 POP SWAP1 POP JUMPDEST POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0xBF8 JUMPI INVALID JUMPDEST POP SWAP1 SUB SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0xC0D JUMPI INVALID JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 SWAP1 EXTCODESIZE GT SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC0D DUP3 CALLDATALOAD PUSH2 0x1040 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC0D DUP3 CALLDATALOAD PUSH2 0x104C JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC0D DUP3 MLOAD PUSH2 0x1054 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0xC51 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0xC64 PUSH2 0xC5F DUP3 PUSH2 0x1014 JUMP JUMPDEST PUSH2 0xFED JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH2 0xC80 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xC8B DUP4 DUP3 DUP5 PUSH2 0x1076 JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC0D DUP3 CALLDATALOAD PUSH2 0x1051 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xCB2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x8B4 DUP5 DUP5 PUSH2 0xC1C JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0xCD1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xCDD DUP6 DUP6 PUSH2 0xC1C JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0xCEE DUP6 DUP3 DUP7 ADD PUSH2 0xC1C JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0xD0D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xD19 DUP7 DUP7 PUSH2 0xC1C JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0xD2A DUP7 DUP3 DUP8 ADD PUSH2 0xC1C JUMP JUMPDEST SWAP3 POP POP PUSH1 0x40 PUSH2 0xD3B DUP7 DUP3 DUP8 ADD PUSH2 0xC94 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 POP SWAP3 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x80 DUP6 DUP8 SUB SLT ISZERO PUSH2 0xD5B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xD67 DUP8 DUP8 PUSH2 0xC1C JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 PUSH2 0xD78 DUP8 DUP3 DUP9 ADD PUSH2 0xC1C JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 PUSH2 0xD89 DUP8 DUP3 DUP9 ADD PUSH2 0xC94 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x60 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0xDA6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xDB2 DUP8 DUP3 DUP9 ADD PUSH2 0xC40 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 SWAP2 SWAP5 POP SWAP3 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0xDD1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xDDD DUP6 DUP6 PUSH2 0xC1C JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0xCEE DUP6 DUP3 DUP7 ADD PUSH2 0xC28 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0xE01 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xE0D DUP6 DUP6 PUSH2 0xC1C JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0xCEE DUP6 DUP3 DUP7 ADD PUSH2 0xC94 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xE30 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x8B4 DUP5 DUP5 PUSH2 0xC34 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xE4E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x8B4 DUP5 DUP5 PUSH2 0xC94 JUMP JUMPDEST PUSH2 0xE63 DUP2 PUSH2 0x1040 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH2 0xE63 DUP2 PUSH2 0x104C JUMP JUMPDEST PUSH1 0x0 PUSH2 0xE7D DUP3 PUSH2 0x103C JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH2 0xE91 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0x1082 JUMP JUMPDEST PUSH2 0xE9A DUP2 PUSH2 0x10AE JUMP JUMPDEST SWAP1 SWAP4 ADD PUSH1 0x20 ADD SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x22 DUP2 MSTORE PUSH32 0x546F6B656E207769746820746F6B656E496420616C7265616479206578697374 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x732E000000000000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x33 DUP2 MSTORE PUSH32 0x4F6E6C7920636F6E7472616374206F776E657220697320616C6C6F7765642074 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x6F2063616C6C2074686973206D6574686F642E00000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH2 0xE63 DUP2 PUSH2 0x1051 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x646 DUP3 DUP5 PUSH2 0xE5A JUMP JUMPDEST PUSH1 0x60 DUP2 ADD PUSH2 0xF78 DUP3 DUP7 PUSH2 0xE5A JUMP JUMPDEST PUSH2 0xF85 PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0xF53 JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0xF97 DUP2 DUP5 PUSH2 0xE72 JUMP JUMPDEST SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x646 DUP3 DUP5 PUSH2 0xE69 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xC0D DUP2 DUP5 PUSH2 0xE72 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x646 DUP2 PUSH2 0xEA7 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x646 DUP2 PUSH2 0xEFD JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x646 DUP3 DUP5 PUSH2 0xF53 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x100C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x102B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH1 0x1F NOT AND ADD SWAP1 JUMP JUMPDEST MLOAD SWAP1 JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND SWAP1 JUMP JUMPDEST ISZERO ISZERO SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND SWAP1 JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x109D JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x1085 JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0x5FF JUMPI POP POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x1F ADD PUSH1 0x1F NOT AND SWAP1 JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 0xdc 0xa9 SWAP15 0xd0 DUP1 SGT DUP15 PUSH9 0xD1F26208CE796F211C 0xfc ADD 0xd8 0xc3 0xda DUP1 0x21 0xf8 0xee SWAP6 0xe5 0x4f 0x4b 0x4d 0x2d PUSH13 0x6578706572696D656E74616CF5 STOP CALLDATACOPY ", - "sourceMap": "734:822:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3033:102:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3033:102:1;;;;;;;;;;;;;;;;;;;;5586:145;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5586:145:1;;;;;;;;;;;;;;;;;4948:401;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4948:401:1;;;;;;;;;;;7190:362;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;7190:362:1;;;;;;;;;1332:222:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1332:222:0;;;;;;;;;8183:254:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;8183:254:1;;;;;;;;;4339:178;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4339:178:1;;;;;;;;;;;;;;;;;3947:206;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3947:206:1;;;;;;;;;3546:180;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3546:180:1;;;;;;;;;;;;;;;;;292:20:5;;8:9:-1;5:2;;;30:1;27;20:12;5:2;292:20:5;;;;3240:106:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3240:106:1;;;;6025:231;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;6025:231:1;;;;;;;;;9139:339;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;9139:339:1;;;;;;;;;6574:176;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;6574:176:1;;;;;;;;;566:167:5;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;566:167:5;;;;;;;;;3033:102:1;3123:5;3116:12;;;;;;;;-1:-1:-1;;3116:12:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3094:6;;3116:12;;3123:5;;3116:12;;3123:5;3116:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3033:102;:::o;5586:145::-;5670:7;5700:24;;;:14;:24;;;;;;-1:-1:-1;;;;;5700:24:1;;5586:145::o;4948:401::-;5025:13;5041:17;5049:8;5041:7;:17::i;:::-;5025:33;-1:-1:-1;;;;;;5076:12:1;;;;;;;;5068:21;;;;;;5107:10;-1:-1:-1;;;;;5107:19:1;;;;:58;;;5130:35;5147:5;5154:10;5130:16;:35::i;:::-;5099:67;;;;;;;;5214:1;5181:21;5193:8;5181:11;:21::i;:::-;-1:-1:-1;;;;;5181:35:1;;;:56;;;-1:-1:-1;;;;;;5220:17:1;;;;5181:56;5177:166;;;5253:24;;;;:14;:24;;;;;;;:30;;-1:-1:-1;;5253:30:1;-1:-1:-1;;;;;5253:30:1;;;;;;;;;5302;;;;;;;;;;5253:24;;5302:30;;;;;;;;;;5177:166;4948:401;;;:::o;7190:362::-;7293:8;2724:39;2742:10;2754:8;2724:17;:39::i;:::-;2716:48;;;;;;;;-1:-1:-1;;;;;7325:19:1;;;;7317:28;;;;;;-1:-1:-1;;;;;7363:17:1;;;;7355:26;;;;;;7392:30;7406:5;7413:8;7392:13;:30::i;:::-;7432:32;7448:5;7455:8;7432:15;:32::i;:::-;7474:25;7485:3;7490:8;7474:10;:25::i;:::-;7531:3;-1:-1:-1;;;;;7515:30:1;7524:5;-1:-1:-1;;;;;7515:30:1;;7536:8;7515:30;;;;;;;;;;;;;;;7190:362;;;;:::o;1332:222:0:-;460:5:5;;-1:-1:-1;;;;;460:5:5;446:10;:19;425:117;;;;;;;;;;;;;;;;;;;;;;1444:15:0;1451:7;1444:6;:15::i;:::-;1443:16;1422:97;;;;;;;;;;;;;;1529:18;1535:2;1539:7;1529:5;:18::i;:::-;1332:222;;:::o;8183:254:1:-;8315:8;2724:39;2742:10;2754:8;2724:17;:39::i;:::-;2716:48;;;;;;;;8388:42;8405:5;8412:3;8417:8;8388:42;;;;;;;;;;;;;:16;:42::i;:::-;8183:254;;;;:::o;4339:178::-;4418:4;4454:20;;;:10;:20;;;;;;-1:-1:-1;;;;;4454:20:1;4491:19;;;4339:178::o;3947:206::-;4027:7;4066:20;;;:10;:20;;;;;;-1:-1:-1;;;;;4066:20:1;4104:19;;;4096:28;;;;;;4141:5;3947:206;-1:-1:-1;;3947:206:1:o;3546:180::-;3626:7;-1:-1:-1;;;;;3657:20:1;;;;3649:29;;;;;;-1:-1:-1;;;;;;3695:24:1;;;;;:16;:24;;;;;;;3546:180::o;292:20:5:-;;;-1:-1:-1;;;;;292:20:5;;:::o;3240:106:1:-;3332:7;3325:14;;;;;;;-1:-1:-1;;3325:14:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3303:6;;3325:14;;3332:7;;3325:14;;3332:7;3325:14;;;;;;;;;;;;;;;;;;;;;;;;6025:231;-1:-1:-1;;;;;6118:17:1;;6125:10;6118:17;;6110:26;;;;;;6164:10;6146:29;;;;:17;:29;;;;;;;;-1:-1:-1;;;;;6146:34:1;;;;;;;;;;;:46;;-1:-1:-1;;6146:46:1;;;;;;;6207:42;;6146:34;;6164:10;6207:42;;;;6146:46;;6207:42;;;;;;;;;;6025:231;;:::o;9139:339::-;9292:8;2724:39;2742:10;2754:8;2724:17;:39::i;:::-;2716:48;;;;;;;;9316:34;9329:5;9336:3;9341:8;9316:12;:34::i;:::-;9417:53;9442:5;9449:3;9454:8;9464:5;9417:24;:53::i;:::-;9409:62;;;;;;;;9139:339;;;;;:::o;6574:176::-;-1:-1:-1;;;;;6707:25:1;;;6680:4;6707:25;;;:17;:25;;;;;;;;:36;;;;;;;;;;;;;;;6574:176::o;566:167:5:-;460:5;;-1:-1:-1;;;;;460:5:5;446:10;:19;425:117;;;;;;;;;;;;;;-1:-1:-1;;;;;662:22:5;;;658:69;;700:5;:16;;-1:-1:-1;;700:16:5;-1:-1:-1;;;;;700:16:5;;;;;658:69;566:167;:::o;9835:278:1:-;9945:4;9965:13;9981:17;9989:8;9981:7;:17::i;:::-;9965:33;;10027:5;-1:-1:-1;;;;;10015:17:1;:8;-1:-1:-1;;;;;10015:17:1;;:54;;;;10061:8;-1:-1:-1;;;;;10036:33:1;:21;10048:8;10036:11;:21::i;:::-;-1:-1:-1;;;;;10036:33:1;;10015:54;:91;;;;10073:33;10090:5;10097:8;10073:16;:33::i;:::-;10008:98;9835:278;-1:-1:-1;;;;9835:278:1:o;11260:303::-;11377:6;-1:-1:-1;;;;;11356:27:1;:17;11364:8;11356:7;:17::i;:::-;-1:-1:-1;;;;;11356:27:1;;11348:36;;;;;;11434:1;11398:24;;;:14;:24;;;;;;-1:-1:-1;;;;;11398:24:1;:38;11394:163;;11487:1;11452:24;;;:14;:24;;;;;;:37;;-1:-1:-1;;11452:37:1;;;11508:38;-1:-1:-1;;;;;11508:38:1;;;;;;;11467:8;;11508:38;;12356:245;12474:5;-1:-1:-1;;;;;12453:26:1;:17;12461:8;12453:7;:17::i;:::-;-1:-1:-1;;;;;12453:26:1;;12445:35;;;;;;-1:-1:-1;;;;;12524:23:1;;;;;;:16;:23;;;;;;12516:35;;12549:1;12516:7;:35::i;:::-;-1:-1:-1;;;;;12490:23:1;;;;;;;:16;:23;;;;;;;;:61;;;;12561:20;;;:10;:20;;;;:33;;-1:-1:-1;;12561:33:1;;;12356:245::o;11834:235::-;11956:1;11924:20;;;:10;:20;;;;;;-1:-1:-1;;;;;11924:20:1;:34;11916:43;;;;;;11969:20;;;;:10;:20;;;;;;;;:26;;-1:-1:-1;;11969:26:1;-1:-1:-1;;;;;11969:26:1;;;;;;;;12037:21;;:16;:21;;;;;;12029:33;;-1:-1:-1;12029:7:1;:33::i;:::-;-1:-1:-1;;;;;12005:21:1;;;;;;;:16;:21;;;;;:57;;;;-1:-1:-1;11834:235:1:o;10376:195::-;-1:-1:-1;;;;;10461:17:1;;;;10453:26;;;;;;10489:25;10500:3;10505:8;10489:10;:25::i;:::-;10550:3;-1:-1:-1;;;;;10529:35:1;10546:1;-1:-1:-1;;;;;10529:35:1;;10555:8;10529:35;;;;;;;13124:375;13284:4;13371:13;13309:15;13320:3;13309:10;:15::i;:::-;13308:16;13304:58;;;13347:4;13340:11;;;;13304:58;13387:61;;;;;-1:-1:-1;;;;;13387:37:1;;;;;:61;;13425:5;;13432:8;;13442:5;;13387:61;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;13387:61:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;13387:61:1;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;13387:61:1;;;;;;;;;-1:-1:-1;;13466:25:1;;13476:15;13466:25;;-1:-1:-1;13371:77:1;-1:-1:-1;13124:375:1;;;;;;;;:::o;418:146:6:-;498:7;528:6;;;;521:14;;;;-1:-1:-1;552:5:6;;;418:146::o;570:166::-;650:7;682:5;;;704:6;;;;697:14;;;;728:1;570:166;-1:-1:-1;;;570:166:6:o;13505:634:1:-;13586:4;14037:17;;14124:8;;13505:634::o;5:118:-1:-;;72:46;110:6;97:20;72:46;;130:112;;194:43;229:6;216:20;194:43;;249:120;;326:38;356:6;350:13;326:38;;377:440;;471:4;459:17;;455:27;-1:-1;445:2;;496:1;493;486:12;445:2;533:6;520:20;555:64;570:48;611:6;570:48;;;555:64;;;546:73;;639:6;632:5;625:21;675:4;667:6;663:17;708:4;701:5;697:16;743:3;734:6;729:3;725:16;722:25;719:2;;;760:1;757;750:12;719:2;770:41;804:6;799:3;794;770:41;;;438:379;;;;;;;;825:118;;892:46;930:6;917:20;892:46;;950:241;;1054:2;1042:9;1033:7;1029:23;1025:32;1022:2;;;1070:1;1067;1060:12;1022:2;1105:1;1122:53;1167:7;1147:9;1122:53;;1198:366;;;1319:2;1307:9;1298:7;1294:23;1290:32;1287:2;;;1335:1;1332;1325:12;1287:2;1370:1;1387:53;1432:7;1412:9;1387:53;;;1377:63;;1349:97;1477:2;1495:53;1540:7;1531:6;1520:9;1516:22;1495:53;;;1485:63;;1456:98;1281:283;;;;;;1571:491;;;;1709:2;1697:9;1688:7;1684:23;1680:32;1677:2;;;1725:1;1722;1715:12;1677:2;1760:1;1777:53;1822:7;1802:9;1777:53;;;1767:63;;1739:97;1867:2;1885:53;1930:7;1921:6;1910:9;1906:22;1885:53;;;1875:63;;1846:98;1975:2;1993:53;2038:7;2029:6;2018:9;2014:22;1993:53;;;1983:63;;1954:98;1671:391;;;;;;2069:721;;;;;2233:3;2221:9;2212:7;2208:23;2204:33;2201:2;;;2250:1;2247;2240:12;2201:2;2285:1;2302:53;2347:7;2327:9;2302:53;;;2292:63;;2264:97;2392:2;2410:53;2455:7;2446:6;2435:9;2431:22;2410:53;;;2400:63;;2371:98;2500:2;2518:53;2563:7;2554:6;2543:9;2539:22;2518:53;;;2508:63;;2479:98;2636:2;2625:9;2621:18;2608:32;2660:18;2652:6;2649:30;2646:2;;;2692:1;2689;2682:12;2646:2;2712:62;2766:7;2757:6;2746:9;2742:22;2712:62;;;2702:72;;2587:193;2195:595;;;;;;;;2797:360;;;2915:2;2903:9;2894:7;2890:23;2886:32;2883:2;;;2931:1;2928;2921:12;2883:2;2966:1;2983:53;3028:7;3008:9;2983:53;;;2973:63;;2945:97;3073:2;3091:50;3133:7;3124:6;3113:9;3109:22;3091:50;;3164:366;;;3285:2;3273:9;3264:7;3260:23;3256:32;3253:2;;;3301:1;3298;3291:12;3253:2;3336:1;3353:53;3398:7;3378:9;3353:53;;;3343:63;;3315:97;3443:2;3461:53;3506:7;3497:6;3486:9;3482:22;3461:53;;3537:261;;3651:2;3639:9;3630:7;3626:23;3622:32;3619:2;;;3667:1;3664;3657:12;3619:2;3702:1;3719:63;3774:7;3754:9;3719:63;;3805:241;;3909:2;3897:9;3888:7;3884:23;3880:32;3877:2;;;3925:1;3922;3915:12;3877:2;3960:1;3977:53;4022:7;4002:9;3977:53;;4053:110;4126:31;4151:5;4126:31;;;4121:3;4114:44;4108:55;;;4170:101;4237:28;4259:5;4237:28;;4278:297;;4378:38;4410:5;4378:38;;;4433:6;4428:3;4421:19;4445:63;4501:6;4494:4;4489:3;4485:14;4478:4;4471:5;4467:16;4445:63;;;4540:29;4562:6;4540:29;;;4520:50;;;4533:4;4520:50;;4358:217;-1:-1;;;4358:217;4890:397;5045:2;5033:15;;5082:66;5077:2;5068:12;;5061:88;5183:66;5178:2;5169:12;;5162:88;5278:2;5269:12;;5026:261;5296:397;5451:2;5439:15;;5488:66;5483:2;5474:12;;5467:88;5589:66;5584:2;5575:12;;5568:88;5684:2;5675:12;;5432:261;5701:110;5774:31;5799:5;5774:31;;5818:193;5926:2;5911:18;;5940:61;5915:9;5974:6;5940:61;;6018:479;6200:2;6185:18;;6214:61;6189:9;6248:6;6214:61;;;6286:62;6344:2;6333:9;6329:18;6320:6;6286:62;;;6396:9;6390:4;6386:20;6381:2;6370:9;6366:18;6359:48;6421:66;6482:4;6473:6;6421:66;;;6413:74;6171:326;-1:-1;;;;;6171:326;6504:181;6606:2;6591:18;;6620:55;6595:9;6648:6;6620:55;;6692:281;6820:2;6834:47;;;6805:18;;6895:68;6805:18;6949:6;6895:68;;6980:387;7161:2;7175:47;;;7146:18;;7236:121;7146:18;7236:121;;7374:387;7555:2;7569:47;;;7540:18;;7630:121;7540:18;7630:121;;7768:193;7876:2;7861:18;;7890:61;7865:9;7924:6;7890:61;;7968:256;8030:2;8024:9;8056:17;;;8131:18;8116:34;;8152:22;;;8113:62;8110:2;;;8188:1;8185;8178:12;8110:2;8204;8197:22;8008:216;;-1:-1;8008:216;8231:258;;8374:18;8366:6;8363:30;8360:2;;;8406:1;8403;8396:12;8360:2;-1:-1;8479:4;8450;8427:17;;;;-1:-1;;8423:33;8469:15;;8297:192;8496:91;8570:12;;8554:33;8693:128;-1:-1;;;;;8762:54;;8745:76;8828:92;8901:13;8894:21;;8877:43;8927:79;8996:5;8979:27;9247:151;-1:-1;;9315:78;;9298:100;9492:145;9573:6;9568:3;9563;9550:30;-1:-1;9629:1;9611:16;;9604:27;9543:94;9646:268;9711:1;9718:101;9732:6;9729:1;9726:13;9718:101;;;9799:11;;;9793:18;9780:11;;;9773:39;9754:2;9747:10;9718:101;;;9834:6;9831:1;9828:13;9825:2;;;-1:-1;;9899:1;9881:16;;9874:27;9695:219;9922:97;10010:2;9990:14;-1:-1;;9986:28;;9970:49" + "object": "0x6080604052600436106100e55763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100ea578063081812fc14610115578063095ea7b31461014257806323b872dd1461016457806340c10f191461018457806342842e0e146101a45780634f558e79146101c45780636352211e146101f157806370a08231146102115780638da5cb5b1461023e57806395d89b41146102535780639dc29fac14610268578063a22cb46514610288578063b88d4fde146102a8578063e985e9c5146102c8578063f2fde38b146102e8575b600080fd5b3480156100f657600080fd5b506100ff610308565b60405161010c91906110a3565b60405180910390f35b34801561012157600080fd5b50610135610130366004610edb565b61039d565b60405161010c9190611051565b34801561014e57600080fd5b5061016261015d366004610e8d565b6103b8565b005b34801561017057600080fd5b5061016261017f366004610d97565b6104ae565b34801561019057600080fd5b5061016261019f366004610e8d565b61055d565b3480156101b057600080fd5b506101626101bf366004610d97565b6105ca565b3480156101d057600080fd5b506101e46101df366004610edb565b610602565b60405161010c9190611095565b3480156101fd57600080fd5b5061013561020c366004610edb565b61061f565b34801561021d57600080fd5b5061023161022c366004610d3f565b610649565b60405161010c91906110e4565b34801561024a57600080fd5b5061013561067c565b34801561025f57600080fd5b506100ff61068b565b34801561027457600080fd5b50610162610283366004610e8d565b6106e9565b34801561029457600080fd5b506101626102a3366004610e5d565b61074a565b3480156102b457600080fd5b506101626102c3366004610de4565b6107cf565b3480156102d457600080fd5b506101e46102e3366004610d5d565b61080e565b3480156102f457600080fd5b50610162610303366004610d3f565b61083c565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156103935780601f1061036857610100808354040283529160200191610393565b820191906000526020600020905b81548152906001019060200180831161037657829003601f168201915b5050505050905090565b600090815260046020526040902054600160a060020a031690565b60006103c38261061f565b9050600160a060020a0383811690821614156103de57600080fd5b33600160a060020a03821614806103fa57506103fa813361080e565b151561040557600080fd5b60006104108361039d565b600160a060020a031614158061042e5750600160a060020a03831615155b156104a95760008281526004602052604090819020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038681169182179092559151908316907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104a09086906110e4565b60405180910390a35b505050565b806104b933826108a4565b15156104c457600080fd5b600160a060020a03841615156104d957600080fd5b600160a060020a03831615156104ee57600080fd5b6104f88483610903565b61050284836109a9565b61050c8383610a39565b82600160a060020a031684600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161054f91906110e4565b60405180910390a350505050565b600054600160a060020a031633146105935760405160e560020a62461bcd02815260040161058a906110c4565b60405180910390fd5b61059c81610602565b156105bc5760405160e560020a62461bcd02815260040161058a906110b4565b6105c68282610aca565b5050565b806105d533826108a4565b15156105e057600080fd5b6105fc84848460206040519081016040528060008152506107cf565b50505050565b600090815260036020526040902054600160a060020a0316151590565b600081815260036020526040812054600160a060020a031680151561064357600080fd5b92915050565b6000600160a060020a038216151561066057600080fd5b50600160a060020a031660009081526005602052604090205490565b600054600160a060020a031681565b60028054604080516020601f60001961010060018716150201909416859004938401819004810282018101909252828152606093909290918301828280156103935780601f1061036857610100808354040283529160200191610393565b600054600160a060020a031633146107165760405160e560020a62461bcd02815260040161058a906110c4565b61071f81610602565b15156107405760405160e560020a62461bcd02815260040161058a906110d4565b6105c68282610b2d565b600160a060020a03821633141561076057600080fd5b336000818152600660209081526040808320600160a060020a038716808552925291829020805460ff191685151517905590519091907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31906107c3908590611095565b60405180910390a35050565b816107da33826108a4565b15156107e557600080fd5b6107f08585856104ae565b6107fc85858585610b85565b151561080757600080fd5b5050505050565b600160a060020a03918216600090815260066020908152604080832093909416825291909152205460ff1690565b600054600160a060020a031633146108695760405160e560020a62461bcd02815260040161058a906110c4565b600160a060020a038116156108a1576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b6000806108b08361061f565b905080600160a060020a031684600160a060020a031614806108eb575083600160a060020a03166108e08461039d565b600160a060020a0316145b806108fb57506108fb818561080e565b949350505050565b81600160a060020a03166109168261061f565b600160a060020a03161461092957600080fd5b600081815260046020526040902054600160a060020a0316156105c657600081815260046020526040808220805473ffffffffffffffffffffffffffffffffffffffff1916905551600160a060020a038416907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906107c39085906110e4565b81600160a060020a03166109bc8261061f565b600160a060020a0316146109cf57600080fd5b600160a060020a0382166000908152600560205260409020546109f3906001610c8b565b600160a060020a03909216600090815260056020908152604080832094909455918152600390915220805473ffffffffffffffffffffffffffffffffffffffff19169055565b600081815260036020526040902054600160a060020a031615610a5b57600080fd5b6000818152600360209081526040808320805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03871690811790915583526005909152902054610aaa906001610c9d565b600160a060020a0390921660009081526005602052604090209190915550565b600160a060020a0382161515610adf57600080fd5b610ae98282610a39565b81600160a060020a03166000600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516107c391906110e4565b610b378282610903565b610b4182826109a9565b6000600160a060020a031682600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516107c391906110e4565b600080610b9185610cb3565b1515610ba05760019150610c82565b6040517ff0b9e5ba000000000000000000000000000000000000000000000000000000008152600160a060020a0386169063f0b9e5ba90610be99089908890889060040161105f565b602060405180830381600087803b158015610c0357600080fd5b505af1158015610c17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610c3b9190810190610ebd565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1981167ff0b9e5ba0000000000000000000000000000000000000000000000000000000014925090505b50949350505050565b600082821115610c9757fe5b50900390565b600082820183811015610cac57fe5b9392505050565b6000903b1190565b6000610cac8235611145565b6000610cac8235611151565b6000610cac8251611159565b6000601f82018313610cf057600080fd5b8135610d03610cfe82611119565b6110f2565b91508082526020830160208301858383011115610d1f57600080fd5b610d2a83828461117b565b50505092915050565b6000610cac8235611156565b600060208284031215610d5157600080fd5b60006108fb8484610cbb565b60008060408385031215610d7057600080fd5b6000610d7c8585610cbb565b9250506020610d8d85828601610cbb565b9150509250929050565b600080600060608486031215610dac57600080fd5b6000610db88686610cbb565b9350506020610dc986828701610cbb565b9250506040610dda86828701610d33565b9150509250925092565b60008060008060808587031215610dfa57600080fd5b6000610e068787610cbb565b9450506020610e1787828801610cbb565b9350506040610e2887828801610d33565b925050606085013567ffffffffffffffff811115610e4557600080fd5b610e5187828801610cdf565b91505092959194509250565b60008060408385031215610e7057600080fd5b6000610e7c8585610cbb565b9250506020610d8d85828601610cc7565b60008060408385031215610ea057600080fd5b6000610eac8585610cbb565b9250506020610d8d85828601610d33565b600060208284031215610ecf57600080fd5b60006108fb8484610cd3565b600060208284031215610eed57600080fd5b60006108fb8484610d33565b610f0281611145565b82525050565b610f0281611151565b6000610f1c82611141565b808452610f30816020860160208601611187565b610f39816111b3565b9093016020019392505050565b602281527f546f6b656e207769746820746f6b656e496420616c726561647920657869737460208201527f732e000000000000000000000000000000000000000000000000000000000000604082015260600190565b603381527f4f6e6c7920636f6e7472616374206f776e657220697320616c6c6f776564207460208201527f6f2063616c6c2074686973206d6574686f642e00000000000000000000000000604082015260600190565b602281527f546f6b656e207769746820746f6b656e496420646f6573206e6f74206578697360208201527f742e000000000000000000000000000000000000000000000000000000000000604082015260600190565b610f0281611156565b602081016106438284610ef9565b6060810161106d8286610ef9565b61107a6020830185611048565b818103604083015261108c8184610f11565b95945050505050565b602081016106438284610f08565b60208082528101610cac8184610f11565b6020808252810161064381610f46565b6020808252810161064381610f9c565b6020808252810161064381610ff2565b602081016106438284611048565b60405181810167ffffffffffffffff8111828210171561111157600080fd5b604052919050565b600067ffffffffffffffff82111561113057600080fd5b506020601f91909101601f19160190565b5190565b600160a060020a031690565b151590565b90565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690565b82818337506000910152565b60005b838110156111a257818101518382015260200161118a565b838111156105fc5750506000910152565b601f01601f1916905600a265627a7a723058200ffaaad094e9af24e42bef0c99c0305afe66dc20df0f57455ad67e1a0741d7c76c6578706572696d656e74616cf50037", + "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0xE5 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x6FDDE03 DUP2 EQ PUSH2 0xEA JUMPI DUP1 PUSH4 0x81812FC EQ PUSH2 0x115 JUMPI DUP1 PUSH4 0x95EA7B3 EQ PUSH2 0x142 JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0x164 JUMPI DUP1 PUSH4 0x40C10F19 EQ PUSH2 0x184 JUMPI DUP1 PUSH4 0x42842E0E EQ PUSH2 0x1A4 JUMPI DUP1 PUSH4 0x4F558E79 EQ PUSH2 0x1C4 JUMPI DUP1 PUSH4 0x6352211E EQ PUSH2 0x1F1 JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0x211 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x23E JUMPI DUP1 PUSH4 0x95D89B41 EQ PUSH2 0x253 JUMPI DUP1 PUSH4 0x9DC29FAC EQ PUSH2 0x268 JUMPI DUP1 PUSH4 0xA22CB465 EQ PUSH2 0x288 JUMPI DUP1 PUSH4 0xB88D4FDE EQ PUSH2 0x2A8 JUMPI DUP1 PUSH4 0xE985E9C5 EQ PUSH2 0x2C8 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x2E8 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xF6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xFF PUSH2 0x308 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x10C SWAP2 SWAP1 PUSH2 0x10A3 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x121 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x135 PUSH2 0x130 CALLDATASIZE PUSH1 0x4 PUSH2 0xEDB JUMP JUMPDEST PUSH2 0x39D JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x10C SWAP2 SWAP1 PUSH2 0x1051 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x14E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x162 PUSH2 0x15D CALLDATASIZE PUSH1 0x4 PUSH2 0xE8D JUMP JUMPDEST PUSH2 0x3B8 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x170 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x162 PUSH2 0x17F CALLDATASIZE PUSH1 0x4 PUSH2 0xD97 JUMP JUMPDEST PUSH2 0x4AE JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x190 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x162 PUSH2 0x19F CALLDATASIZE PUSH1 0x4 PUSH2 0xE8D JUMP JUMPDEST PUSH2 0x55D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1B0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x162 PUSH2 0x1BF CALLDATASIZE PUSH1 0x4 PUSH2 0xD97 JUMP JUMPDEST PUSH2 0x5CA JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1D0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1E4 PUSH2 0x1DF CALLDATASIZE PUSH1 0x4 PUSH2 0xEDB JUMP JUMPDEST PUSH2 0x602 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x10C SWAP2 SWAP1 PUSH2 0x1095 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1FD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x135 PUSH2 0x20C CALLDATASIZE PUSH1 0x4 PUSH2 0xEDB JUMP JUMPDEST PUSH2 0x61F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x21D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x231 PUSH2 0x22C CALLDATASIZE PUSH1 0x4 PUSH2 0xD3F JUMP JUMPDEST PUSH2 0x649 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x10C SWAP2 SWAP1 PUSH2 0x10E4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x24A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x135 PUSH2 0x67C JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x25F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xFF PUSH2 0x68B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x274 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x162 PUSH2 0x283 CALLDATASIZE PUSH1 0x4 PUSH2 0xE8D JUMP JUMPDEST PUSH2 0x6E9 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x294 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x162 PUSH2 0x2A3 CALLDATASIZE PUSH1 0x4 PUSH2 0xE5D JUMP JUMPDEST PUSH2 0x74A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2B4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x162 PUSH2 0x2C3 CALLDATASIZE PUSH1 0x4 PUSH2 0xDE4 JUMP JUMPDEST PUSH2 0x7CF JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2D4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1E4 PUSH2 0x2E3 CALLDATASIZE PUSH1 0x4 PUSH2 0xD5D JUMP JUMPDEST PUSH2 0x80E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2F4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x162 PUSH2 0x303 CALLDATASIZE PUSH1 0x4 PUSH2 0xD3F JUMP JUMPDEST PUSH2 0x83C JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH1 0x0 NOT PUSH2 0x100 DUP8 DUP10 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH1 0x60 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x393 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x368 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x393 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x376 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x3C3 DUP3 PUSH2 0x61F JUMP JUMPDEST SWAP1 POP PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP4 DUP2 AND SWAP1 DUP3 AND EQ ISZERO PUSH2 0x3DE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST CALLER PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP3 AND EQ DUP1 PUSH2 0x3FA JUMPI POP PUSH2 0x3FA DUP2 CALLER PUSH2 0x80E JUMP JUMPDEST ISZERO ISZERO PUSH2 0x405 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x410 DUP4 PUSH2 0x39D JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND EQ ISZERO DUP1 PUSH2 0x42E JUMPI POP PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP4 AND ISZERO ISZERO JUMPDEST ISZERO PUSH2 0x4A9 JUMPI PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP7 DUP2 AND SWAP2 DUP3 OR SWAP1 SWAP3 SSTORE SWAP2 MLOAD SWAP1 DUP4 AND SWAP1 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP1 PUSH2 0x4A0 SWAP1 DUP7 SWAP1 PUSH2 0x10E4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 JUMPDEST POP POP POP JUMP JUMPDEST DUP1 PUSH2 0x4B9 CALLER DUP3 PUSH2 0x8A4 JUMP JUMPDEST ISZERO ISZERO PUSH2 0x4C4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP5 AND ISZERO ISZERO PUSH2 0x4D9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP4 AND ISZERO ISZERO PUSH2 0x4EE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4F8 DUP5 DUP4 PUSH2 0x903 JUMP JUMPDEST PUSH2 0x502 DUP5 DUP4 PUSH2 0x9A9 JUMP JUMPDEST PUSH2 0x50C DUP4 DUP4 PUSH2 0xA39 JUMP JUMPDEST DUP3 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP5 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF DUP5 PUSH1 0x40 MLOAD PUSH2 0x54F SWAP2 SWAP1 PUSH2 0x10E4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND CALLER EQ PUSH2 0x593 JUMPI PUSH1 0x40 MLOAD PUSH1 0xE5 PUSH1 0x2 EXP PUSH3 0x461BCD MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x58A SWAP1 PUSH2 0x10C4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x59C DUP2 PUSH2 0x602 JUMP JUMPDEST ISZERO PUSH2 0x5BC JUMPI PUSH1 0x40 MLOAD PUSH1 0xE5 PUSH1 0x2 EXP PUSH3 0x461BCD MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x58A SWAP1 PUSH2 0x10B4 JUMP JUMPDEST PUSH2 0x5C6 DUP3 DUP3 PUSH2 0xACA JUMP JUMPDEST POP POP JUMP JUMPDEST DUP1 PUSH2 0x5D5 CALLER DUP3 PUSH2 0x8A4 JUMP JUMPDEST ISZERO ISZERO PUSH2 0x5E0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x5FC DUP5 DUP5 DUP5 PUSH1 0x20 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x0 DUP2 MSTORE POP PUSH2 0x7CF JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND ISZERO ISZERO SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP1 ISZERO ISZERO PUSH2 0x643 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP3 AND ISZERO ISZERO PUSH2 0x660 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x5 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP2 JUMP JUMPDEST PUSH1 0x2 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x0 NOT PUSH2 0x100 PUSH1 0x1 DUP8 AND ISZERO MUL ADD SWAP1 SWAP5 AND DUP6 SWAP1 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH1 0x60 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x393 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x368 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x393 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND CALLER EQ PUSH2 0x716 JUMPI PUSH1 0x40 MLOAD PUSH1 0xE5 PUSH1 0x2 EXP PUSH3 0x461BCD MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x58A SWAP1 PUSH2 0x10C4 JUMP JUMPDEST PUSH2 0x71F DUP2 PUSH2 0x602 JUMP JUMPDEST ISZERO ISZERO PUSH2 0x740 JUMPI PUSH1 0x40 MLOAD PUSH1 0xE5 PUSH1 0x2 EXP PUSH3 0x461BCD MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x58A SWAP1 PUSH2 0x10D4 JUMP JUMPDEST PUSH2 0x5C6 DUP3 DUP3 PUSH2 0xB2D JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP3 AND CALLER EQ ISZERO PUSH2 0x760 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x6 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP8 AND DUP1 DUP6 MSTORE SWAP3 MSTORE SWAP2 DUP3 SWAP1 KECCAK256 DUP1 SLOAD PUSH1 0xFF NOT AND DUP6 ISZERO ISZERO OR SWAP1 SSTORE SWAP1 MLOAD SWAP1 SWAP2 SWAP1 PUSH32 0x17307EAB39AB6107E8899845AD3D59BD9653F200F220920489CA2B5937696C31 SWAP1 PUSH2 0x7C3 SWAP1 DUP6 SWAP1 PUSH2 0x1095 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP JUMP JUMPDEST DUP2 PUSH2 0x7DA CALLER DUP3 PUSH2 0x8A4 JUMP JUMPDEST ISZERO ISZERO PUSH2 0x7E5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x7F0 DUP6 DUP6 DUP6 PUSH2 0x4AE JUMP JUMPDEST PUSH2 0x7FC DUP6 DUP6 DUP6 DUP6 PUSH2 0xB85 JUMP JUMPDEST ISZERO ISZERO PUSH2 0x807 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP2 DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x6 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 SWAP1 SWAP5 AND DUP3 MSTORE SWAP2 SWAP1 SWAP2 MSTORE KECCAK256 SLOAD PUSH1 0xFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND CALLER EQ PUSH2 0x869 JUMPI PUSH1 0x40 MLOAD PUSH1 0xE5 PUSH1 0x2 EXP PUSH3 0x461BCD MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x58A SWAP1 PUSH2 0x10C4 JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP2 AND ISZERO PUSH2 0x8A1 JUMPI PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP4 AND OR SWAP1 SSTORE JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x8B0 DUP4 PUSH2 0x61F JUMP JUMPDEST SWAP1 POP DUP1 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP5 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND EQ DUP1 PUSH2 0x8EB JUMPI POP DUP4 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH2 0x8E0 DUP5 PUSH2 0x39D JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND EQ JUMPDEST DUP1 PUSH2 0x8FB JUMPI POP PUSH2 0x8FB DUP2 DUP6 PUSH2 0x80E JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST DUP2 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH2 0x916 DUP3 PUSH2 0x61F JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND EQ PUSH2 0x929 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND ISZERO PUSH2 0x5C6 JUMPI PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND SWAP1 SSTORE MLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP5 AND SWAP1 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP1 PUSH2 0x7C3 SWAP1 DUP6 SWAP1 PUSH2 0x10E4 JUMP JUMPDEST DUP2 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH2 0x9BC DUP3 PUSH2 0x61F JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND EQ PUSH2 0x9CF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x5 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH2 0x9F3 SWAP1 PUSH1 0x1 PUSH2 0xC8B JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP1 SWAP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x5 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP5 SWAP1 SWAP5 SSTORE SWAP2 DUP2 MSTORE PUSH1 0x3 SWAP1 SWAP2 MSTORE KECCAK256 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND SWAP1 SSTORE JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND ISZERO PUSH2 0xA5B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP8 AND SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP4 MSTORE PUSH1 0x5 SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH2 0xAAA SWAP1 PUSH1 0x1 PUSH2 0xC9D JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP1 SWAP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x5 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SWAP2 SWAP1 SWAP2 SSTORE POP JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP3 AND ISZERO ISZERO PUSH2 0xADF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xAE9 DUP3 DUP3 PUSH2 0xA39 JUMP JUMPDEST DUP2 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH1 0x0 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF DUP4 PUSH1 0x40 MLOAD PUSH2 0x7C3 SWAP2 SWAP1 PUSH2 0x10E4 JUMP JUMPDEST PUSH2 0xB37 DUP3 DUP3 PUSH2 0x903 JUMP JUMPDEST PUSH2 0xB41 DUP3 DUP3 PUSH2 0x9A9 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP3 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF DUP4 PUSH1 0x40 MLOAD PUSH2 0x7C3 SWAP2 SWAP1 PUSH2 0x10E4 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0xB91 DUP6 PUSH2 0xCB3 JUMP JUMPDEST ISZERO ISZERO PUSH2 0xBA0 JUMPI PUSH1 0x1 SWAP2 POP PUSH2 0xC82 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0xF0B9E5BA00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP7 AND SWAP1 PUSH4 0xF0B9E5BA SWAP1 PUSH2 0xBE9 SWAP1 DUP10 SWAP1 DUP9 SWAP1 DUP9 SWAP1 PUSH1 0x4 ADD PUSH2 0x105F JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xC03 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0xC17 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0xC3B SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0xEBD JUMP JUMPDEST PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT DUP2 AND PUSH32 0xF0B9E5BA00000000000000000000000000000000000000000000000000000000 EQ SWAP3 POP SWAP1 POP JUMPDEST POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0xC97 JUMPI INVALID JUMPDEST POP SWAP1 SUB SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0xCAC JUMPI INVALID JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 SWAP1 EXTCODESIZE GT SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xCAC DUP3 CALLDATALOAD PUSH2 0x1145 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xCAC DUP3 CALLDATALOAD PUSH2 0x1151 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xCAC DUP3 MLOAD PUSH2 0x1159 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0xCF0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0xD03 PUSH2 0xCFE DUP3 PUSH2 0x1119 JUMP JUMPDEST PUSH2 0x10F2 JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH2 0xD1F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xD2A DUP4 DUP3 DUP5 PUSH2 0x117B JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xCAC DUP3 CALLDATALOAD PUSH2 0x1156 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xD51 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x8FB DUP5 DUP5 PUSH2 0xCBB JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0xD70 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xD7C DUP6 DUP6 PUSH2 0xCBB JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0xD8D DUP6 DUP3 DUP7 ADD PUSH2 0xCBB JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0xDAC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xDB8 DUP7 DUP7 PUSH2 0xCBB JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0xDC9 DUP7 DUP3 DUP8 ADD PUSH2 0xCBB JUMP JUMPDEST SWAP3 POP POP PUSH1 0x40 PUSH2 0xDDA DUP7 DUP3 DUP8 ADD PUSH2 0xD33 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 POP SWAP3 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x80 DUP6 DUP8 SUB SLT ISZERO PUSH2 0xDFA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xE06 DUP8 DUP8 PUSH2 0xCBB JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 PUSH2 0xE17 DUP8 DUP3 DUP9 ADD PUSH2 0xCBB JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 PUSH2 0xE28 DUP8 DUP3 DUP9 ADD PUSH2 0xD33 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x60 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0xE45 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xE51 DUP8 DUP3 DUP9 ADD PUSH2 0xCDF JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 SWAP2 SWAP5 POP SWAP3 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0xE70 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xE7C DUP6 DUP6 PUSH2 0xCBB JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0xD8D DUP6 DUP3 DUP7 ADD PUSH2 0xCC7 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0xEA0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xEAC DUP6 DUP6 PUSH2 0xCBB JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0xD8D DUP6 DUP3 DUP7 ADD PUSH2 0xD33 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xECF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x8FB DUP5 DUP5 PUSH2 0xCD3 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xEED JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x8FB DUP5 DUP5 PUSH2 0xD33 JUMP JUMPDEST PUSH2 0xF02 DUP2 PUSH2 0x1145 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH2 0xF02 DUP2 PUSH2 0x1151 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xF1C DUP3 PUSH2 0x1141 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH2 0xF30 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0x1187 JUMP JUMPDEST PUSH2 0xF39 DUP2 PUSH2 0x11B3 JUMP JUMPDEST SWAP1 SWAP4 ADD PUSH1 0x20 ADD SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x22 DUP2 MSTORE PUSH32 0x546F6B656E207769746820746F6B656E496420616C7265616479206578697374 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x732E000000000000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x33 DUP2 MSTORE PUSH32 0x4F6E6C7920636F6E7472616374206F776E657220697320616C6C6F7765642074 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x6F2063616C6C2074686973206D6574686F642E00000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x22 DUP2 MSTORE PUSH32 0x546F6B656E207769746820746F6B656E496420646F6573206E6F742065786973 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x742E000000000000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH2 0xF02 DUP2 PUSH2 0x1156 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x643 DUP3 DUP5 PUSH2 0xEF9 JUMP JUMPDEST PUSH1 0x60 DUP2 ADD PUSH2 0x106D DUP3 DUP7 PUSH2 0xEF9 JUMP JUMPDEST PUSH2 0x107A PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0x1048 JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x108C DUP2 DUP5 PUSH2 0xF11 JUMP JUMPDEST SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x643 DUP3 DUP5 PUSH2 0xF08 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xCAC DUP2 DUP5 PUSH2 0xF11 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x643 DUP2 PUSH2 0xF46 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x643 DUP2 PUSH2 0xF9C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x643 DUP2 PUSH2 0xFF2 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x643 DUP3 DUP5 PUSH2 0x1048 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x1111 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x1130 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH1 0x1F NOT AND ADD SWAP1 JUMP JUMPDEST MLOAD SWAP1 JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND SWAP1 JUMP JUMPDEST ISZERO ISZERO SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND SWAP1 JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x11A2 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x118A JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0x5FC JUMPI POP POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x1F ADD PUSH1 0x1F NOT AND SWAP1 JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 0xf STATICCALL 0xaa 0xd0 SWAP5 0xe9 0xaf 0x24 0xe4 0x2b 0xef 0xc SWAP10 0xc0 ADDRESS GAS INVALID PUSH7 0xDC20DF0F57455A 0xd6 PUSH31 0x1A0741D7C76C6578706572696D656E74616CF5003700000000000000000000 ", + "sourceMap": "734:1237:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3033:102:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3033:102:1;;;;;;;;;;;;;;;;;;;;5586:145;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5586:145:1;;;;;;;;;;;;;;;;;4948:401;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4948:401:1;;;;;;;;;;;7190:362;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;7190:362:1;;;;;;;;;1332:222:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1332:222:0;;;;;;;;;8183:254:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;8183:254:1;;;;;;;;;4339:178;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4339:178:1;;;;;;;;;;;;;;;;;3947:206;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3947:206:1;;;;;;;;;3546:180;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3546:180:1;;;;;;;;;;;;;;;;;292:20:5;;8:9:-1;5:2;;;30:1;27;20:12;5:2;292:20:5;;;;3240:106:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3240:106:1;;;;1742:227:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1742:227:0;;;;;;;;;6025:231:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;6025:231:1;;;;;;;;;9139:339;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;9139:339:1;;;;;;;;;6574:176;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;6574:176:1;;;;;;;;;566:167:5;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;566:167:5;;;;;;;;;3033:102:1;3123:5;3116:12;;;;;;;;-1:-1:-1;;3116:12:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3094:6;;3116:12;;3123:5;;3116:12;;3123:5;3116:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3033:102;:::o;5586:145::-;5670:7;5700:24;;;:14;:24;;;;;;-1:-1:-1;;;;;5700:24:1;;5586:145::o;4948:401::-;5025:13;5041:17;5049:8;5041:7;:17::i;:::-;5025:33;-1:-1:-1;;;;;;5076:12:1;;;;;;;;5068:21;;;;;;5107:10;-1:-1:-1;;;;;5107:19:1;;;;:58;;;5130:35;5147:5;5154:10;5130:16;:35::i;:::-;5099:67;;;;;;;;5214:1;5181:21;5193:8;5181:11;:21::i;:::-;-1:-1:-1;;;;;5181:35:1;;;:56;;;-1:-1:-1;;;;;;5220:17:1;;;;5181:56;5177:166;;;5253:24;;;;:14;:24;;;;;;;:30;;-1:-1:-1;;5253:30:1;-1:-1:-1;;;;;5253:30:1;;;;;;;;;5302;;;;;;;;;;5253:24;;5302:30;;;;;;;;;;5177:166;4948:401;;;:::o;7190:362::-;7293:8;2724:39;2742:10;2754:8;2724:17;:39::i;:::-;2716:48;;;;;;;;-1:-1:-1;;;;;7325:19:1;;;;7317:28;;;;;;-1:-1:-1;;;;;7363:17:1;;;;7355:26;;;;;;7392:30;7406:5;7413:8;7392:13;:30::i;:::-;7432:32;7448:5;7455:8;7432:15;:32::i;:::-;7474:25;7485:3;7490:8;7474:10;:25::i;:::-;7531:3;-1:-1:-1;;;;;7515:30:1;7524:5;-1:-1:-1;;;;;7515:30:1;;7536:8;7515:30;;;;;;;;;;;;;;;7190:362;;;;:::o;1332:222:0:-;460:5:5;;-1:-1:-1;;;;;460:5:5;446:10;:19;425:117;;;;-1:-1:-1;;;;;425:117:5;;;;;;;;;;;;;;;;;1444:15:0;1451:7;1444:6;:15::i;:::-;1443:16;1422:97;;;;-1:-1:-1;;;;;1422:97:0;;;;;;;;;1529:18;1535:2;1539:7;1529:5;:18::i;:::-;1332:222;;:::o;8183:254:1:-;8315:8;2724:39;2742:10;2754:8;2724:17;:39::i;:::-;2716:48;;;;;;;;8388:42;8405:5;8412:3;8417:8;8388:42;;;;;;;;;;;;;:16;:42::i;:::-;8183:254;;;;:::o;4339:178::-;4418:4;4454:20;;;:10;:20;;;;;;-1:-1:-1;;;;;4454:20:1;4491:19;;;4339:178::o;3947:206::-;4027:7;4066:20;;;:10;:20;;;;;;-1:-1:-1;;;;;4066:20:1;4104:19;;;4096:28;;;;;;4141:5;3947:206;-1:-1:-1;;3947:206:1:o;3546:180::-;3626:7;-1:-1:-1;;;;;3657:20:1;;;;3649:29;;;;;;-1:-1:-1;;;;;;3695:24:1;;;;;:16;:24;;;;;;;3546:180::o;292:20:5:-;;;-1:-1:-1;;;;;292:20:5;;:::o;3240:106:1:-;3332:7;3325:14;;;;;;;-1:-1:-1;;3325:14:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3303:6;;3325:14;;3332:7;;3325:14;;3332:7;3325:14;;;;;;;;;;;;;;;;;;;;;;;;1742:227:0;460:5:5;;-1:-1:-1;;;;;460:5:5;446:10;:19;425:117;;;;-1:-1:-1;;;;;425:117:5;;;;;;;;;1856:15:0;1863:7;1856:6;:15::i;:::-;1835:96;;;;;;-1:-1:-1;;;;;1835:96:0;;;;;;;;;1941:21;1947:5;1954:7;1941:5;:21::i;6025:231:1:-;-1:-1:-1;;;;;6118:17:1;;6125:10;6118:17;;6110:26;;;;;;6164:10;6146:29;;;;:17;:29;;;;;;;;-1:-1:-1;;;;;6146:34:1;;;;;;;;;;;:46;;-1:-1:-1;;6146:46:1;;;;;;;6207:42;;6146:34;;6164:10;6207:42;;;;6146:46;;6207:42;;;;;;;;;;6025:231;;:::o;9139:339::-;9292:8;2724:39;2742:10;2754:8;2724:17;:39::i;:::-;2716:48;;;;;;;;9316:34;9329:5;9336:3;9341:8;9316:12;:34::i;:::-;9417:53;9442:5;9449:3;9454:8;9464:5;9417:24;:53::i;:::-;9409:62;;;;;;;;9139:339;;;;;:::o;6574:176::-;-1:-1:-1;;;;;6707:25:1;;;6680:4;6707:25;;;:17;:25;;;;;;;;:36;;;;;;;;;;;;;;;6574:176::o;566:167:5:-;460:5;;-1:-1:-1;;;;;460:5:5;446:10;:19;425:117;;;;-1:-1:-1;;;;;425:117:5;;;;;;;;;-1:-1:-1;;;;;662:22:5;;;658:69;;700:5;:16;;-1:-1:-1;;700:16:5;-1:-1:-1;;;;;700:16:5;;;;;658:69;566:167;:::o;9835:278:1:-;9945:4;9965:13;9981:17;9989:8;9981:7;:17::i;:::-;9965:33;;10027:5;-1:-1:-1;;;;;10015:17:1;:8;-1:-1:-1;;;;;10015:17:1;;:54;;;;10061:8;-1:-1:-1;;;;;10036:33:1;:21;10048:8;10036:11;:21::i;:::-;-1:-1:-1;;;;;10036:33:1;;10015:54;:91;;;;10073:33;10090:5;10097:8;10073:16;:33::i;:::-;10008:98;9835:278;-1:-1:-1;;;;9835:278:1:o;11260:303::-;11377:6;-1:-1:-1;;;;;11356:27:1;:17;11364:8;11356:7;:17::i;:::-;-1:-1:-1;;;;;11356:27:1;;11348:36;;;;;;11434:1;11398:24;;;:14;:24;;;;;;-1:-1:-1;;;;;11398:24:1;:38;11394:163;;11487:1;11452:24;;;:14;:24;;;;;;:37;;-1:-1:-1;;11452:37:1;;;11508:38;-1:-1:-1;;;;;11508:38:1;;;;;;;11467:8;;11508:38;;12356:245;12474:5;-1:-1:-1;;;;;12453:26:1;:17;12461:8;12453:7;:17::i;:::-;-1:-1:-1;;;;;12453:26:1;;12445:35;;;;;;-1:-1:-1;;;;;12524:23:1;;;;;;:16;:23;;;;;;12516:35;;12549:1;12516:7;:35::i;:::-;-1:-1:-1;;;;;12490:23:1;;;;;;;:16;:23;;;;;;;;:61;;;;12561:20;;;:10;:20;;;;:33;;-1:-1:-1;;12561:33:1;;;12356:245::o;11834:235::-;11956:1;11924:20;;;:10;:20;;;;;;-1:-1:-1;;;;;11924:20:1;:34;11916:43;;;;;;11969:20;;;;:10;:20;;;;;;;;:26;;-1:-1:-1;;11969:26:1;-1:-1:-1;;;;;11969:26:1;;;;;;;;12037:21;;:16;:21;;;;;;12029:33;;-1:-1:-1;12029:7:1;:33::i;:::-;-1:-1:-1;;;;;12005:21:1;;;;;;;:16;:21;;;;;:57;;;;-1:-1:-1;11834:235:1:o;10376:195::-;-1:-1:-1;;;;;10461:17:1;;;;10453:26;;;;;;10489:25;10500:3;10505:8;10489:10;:25::i;:::-;10550:3;-1:-1:-1;;;;;10529:35:1;10546:1;-1:-1:-1;;;;;10529:35:1;;10555:8;10529:35;;;;;;;10770:214;10850:31;10864:6;10872:8;10850:13;:31::i;:::-;10891:33;10907:6;10915:8;10891:15;:33::i;:::-;10964:1;-1:-1:-1;;;;;10939:38:1;10948:6;-1:-1:-1;;;;;10939:38:1;;10968:8;10939:38;;;;;;;13124:375;13284:4;13371:13;13309:15;13320:3;13309:10;:15::i;:::-;13308:16;13304:58;;;13347:4;13340:11;;;;13304:58;13387:61;;;;;-1:-1:-1;;;;;13387:37:1;;;;;:61;;13425:5;;13432:8;;13442:5;;13387:61;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;13387:61:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;13387:61:1;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;13387:61:1;;;;;;;;;-1:-1:-1;;13466:25:1;;13476:15;13466:25;;-1:-1:-1;13371:77:1;-1:-1:-1;13124:375:1;;;;;;;;:::o;418:146:6:-;498:7;528:6;;;;521:14;;;;-1:-1:-1;552:5:6;;;418:146::o;570:166::-;650:7;682:5;;;704:6;;;;697:14;;;;728:1;570:166;-1:-1:-1;;;570:166:6:o;13505:634:1:-;13586:4;14037:17;;14124:8;;13505:634::o;5:118:-1:-;;72:46;110:6;97:20;72:46;;130:112;;194:43;229:6;216:20;194:43;;249:120;;326:38;356:6;350:13;326:38;;377:440;;471:4;459:17;;455:27;-1:-1;445:2;;496:1;493;486:12;445:2;533:6;520:20;555:64;570:48;611:6;570:48;;;555:64;;;546:73;;639:6;632:5;625:21;675:4;667:6;663:17;708:4;701:5;697:16;743:3;734:6;729:3;725:16;722:25;719:2;;;760:1;757;750:12;719:2;770:41;804:6;799:3;794;770:41;;;438:379;;;;;;;;825:118;;892:46;930:6;917:20;892:46;;950:241;;1054:2;1042:9;1033:7;1029:23;1025:32;1022:2;;;1070:1;1067;1060:12;1022:2;1105:1;1122:53;1167:7;1147:9;1122:53;;1198:366;;;1319:2;1307:9;1298:7;1294:23;1290:32;1287:2;;;1335:1;1332;1325:12;1287:2;1370:1;1387:53;1432:7;1412:9;1387:53;;;1377:63;;1349:97;1477:2;1495:53;1540:7;1531:6;1520:9;1516:22;1495:53;;;1485:63;;1456:98;1281:283;;;;;;1571:491;;;;1709:2;1697:9;1688:7;1684:23;1680:32;1677:2;;;1725:1;1722;1715:12;1677:2;1760:1;1777:53;1822:7;1802:9;1777:53;;;1767:63;;1739:97;1867:2;1885:53;1930:7;1921:6;1910:9;1906:22;1885:53;;;1875:63;;1846:98;1975:2;1993:53;2038:7;2029:6;2018:9;2014:22;1993:53;;;1983:63;;1954:98;1671:391;;;;;;2069:721;;;;;2233:3;2221:9;2212:7;2208:23;2204:33;2201:2;;;2250:1;2247;2240:12;2201:2;2285:1;2302:53;2347:7;2327:9;2302:53;;;2292:63;;2264:97;2392:2;2410:53;2455:7;2446:6;2435:9;2431:22;2410:53;;;2400:63;;2371:98;2500:2;2518:53;2563:7;2554:6;2543:9;2539:22;2518:53;;;2508:63;;2479:98;2636:2;2625:9;2621:18;2608:32;2660:18;2652:6;2649:30;2646:2;;;2692:1;2689;2682:12;2646:2;2712:62;2766:7;2757:6;2746:9;2742:22;2712:62;;;2702:72;;2587:193;2195:595;;;;;;;;2797:360;;;2915:2;2903:9;2894:7;2890:23;2886:32;2883:2;;;2931:1;2928;2921:12;2883:2;2966:1;2983:53;3028:7;3008:9;2983:53;;;2973:63;;2945:97;3073:2;3091:50;3133:7;3124:6;3113:9;3109:22;3091:50;;3164:366;;;3285:2;3273:9;3264:7;3260:23;3256:32;3253:2;;;3301:1;3298;3291:12;3253:2;3336:1;3353:53;3398:7;3378:9;3353:53;;;3343:63;;3315:97;3443:2;3461:53;3506:7;3497:6;3486:9;3482:22;3461:53;;3537:261;;3651:2;3639:9;3630:7;3626:23;3622:32;3619:2;;;3667:1;3664;3657:12;3619:2;3702:1;3719:63;3774:7;3754:9;3719:63;;3805:241;;3909:2;3897:9;3888:7;3884:23;3880:32;3877:2;;;3925:1;3922;3915:12;3877:2;3960:1;3977:53;4022:7;4002:9;3977:53;;4053:110;4126:31;4151:5;4126:31;;;4121:3;4114:44;4108:55;;;4170:101;4237:28;4259:5;4237:28;;4278:297;;4378:38;4410:5;4378:38;;;4433:6;4428:3;4421:19;4445:63;4501:6;4494:4;4489:3;4485:14;4478:4;4471:5;4467:16;4445:63;;;4540:29;4562:6;4540:29;;;4520:50;;;4533:4;4520:50;;4358:217;-1:-1;;;4358:217;4890:397;5045:2;5033:15;;5082:66;5077:2;5068:12;;5061:88;5183:66;5178:2;5169:12;;5162:88;5278:2;5269:12;;5026:261;5296:397;5451:2;5439:15;;5488:66;5483:2;5474:12;;5467:88;5589:66;5584:2;5575:12;;5568:88;5684:2;5675:12;;5432:261;5702:397;5857:2;5845:15;;5894:66;5889:2;5880:12;;5873:88;5995:66;5990:2;5981:12;;5974:88;6090:2;6081:12;;5838:261;6107:110;6180:31;6205:5;6180:31;;6224:193;6332:2;6317:18;;6346:61;6321:9;6380:6;6346:61;;6424:479;6606:2;6591:18;;6620:61;6595:9;6654:6;6620:61;;;6692:62;6750:2;6739:9;6735:18;6726:6;6692:62;;;6802:9;6796:4;6792:20;6787:2;6776:9;6772:18;6765:48;6827:66;6888:4;6879:6;6827:66;;;6819:74;6577:326;-1:-1;;;;;6577:326;6910:181;7012:2;6997:18;;7026:55;7001:9;7054:6;7026:55;;7098:281;7226:2;7240:47;;;7211:18;;7301:68;7211:18;7355:6;7301:68;;7386:387;7567:2;7581:47;;;7552:18;;7642:121;7552:18;7642:121;;7780:387;7961:2;7975:47;;;7946:18;;8036:121;7946:18;8036:121;;8174:387;8355:2;8369:47;;;8340:18;;8430:121;8340:18;8430:121;;8568:193;8676:2;8661:18;;8690:61;8665:9;8724:6;8690:61;;8768:256;8830:2;8824:9;8856:17;;;8931:18;8916:34;;8952:22;;;8913:62;8910:2;;;8988:1;8985;8978:12;8910:2;9004;8997:22;8808:216;;-1:-1;8808:216;9031:258;;9174:18;9166:6;9163:30;9160:2;;;9206:1;9203;9196:12;9160:2;-1:-1;9279:4;9250;9227:17;;;;-1:-1;;9223:33;9269:15;;9097:192;9296:91;9370:12;;9354:33;9493:128;-1:-1;;;;;9562:54;;9545:76;9628:92;9701:13;9694:21;;9677:43;9727:79;9796:5;9779:27;10047:151;-1:-1;;10115:78;;10098:100;10292:145;10373:6;10368:3;10363;10350:30;-1:-1;10429:1;10411:16;;10404:27;10343:94;10446:268;10511:1;10518:101;10532:6;10529:1;10526:13;10518:101;;;10599:11;;;10593:18;10580:11;;;10573:39;10554:2;10547:10;10518:101;;;10634:6;10631:1;10628:13;10625:2;;;-1:-1;;10699:1;10681:16;;10674:27;10495:219;10722:97;10810:2;10790:14;-1:-1;;10786:28;;10770:49" } } }, @@ -403,7 +421,7 @@ } }, "sourceCodes": { - "current/test/DummyERC721Token/DummyERC721Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../../tokens/ERC721Token/ERC721Token.sol\";\nimport \"../../utils/Ownable/Ownable.sol\";\n\ncontract DummyERC721Token is\n Ownable,\n ERC721Token\n{\n\n /**\n * @dev Constructor passes its arguments to the base ERC721Token constructor\n * @param name of token\n * @param symbol of token\n */\n constructor (\n string name,\n string symbol\n )\n public\n ERC721Token(name, symbol)\n {}\n\n /**\n * @dev Function to mint a new token\n * @dev Reverts if the given token ID already exists\n * @param to address the beneficiary that will own the minted token\n * @param tokenId uint256 ID of the token to be minted by the msg.sender\n */\n function mint(address to, uint256 tokenId)\n public\n onlyOwner\n {\n require(\n !exists(tokenId),\n \"Token with tokenId already exists.\"\n );\n _mint(to, tokenId);\n }\n}\n", + "current/test/DummyERC721Token/DummyERC721Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../../tokens/ERC721Token/ERC721Token.sol\";\nimport \"../../utils/Ownable/Ownable.sol\";\n\ncontract DummyERC721Token is\n Ownable,\n ERC721Token\n{\n\n /**\n * @dev Constructor passes its arguments to the base ERC721Token constructor\n * @param name of token\n * @param symbol of token\n */\n constructor (\n string name,\n string symbol\n )\n public\n ERC721Token(name, symbol)\n {}\n\n /**\n * @dev Function to mint a new token\n * @dev Reverts if the given token ID already exists\n * @param to address the beneficiary that will own the minted token\n * @param tokenId uint256 ID of the token to be minted by the msg.sender\n */\n function mint(address to, uint256 tokenId)\n public\n onlyOwner\n {\n require(\n !exists(tokenId),\n \"Token with tokenId already exists.\"\n );\n _mint(to, tokenId);\n }\n\n /**\n * @dev Function to burn a token\n * @dev Reverts if the given token ID doesn't exist\n * @param tokenId uint256 ID of the token to be minted by the msg.sender\n */\n function burn(address owner, uint256 tokenId)\n public\n onlyOwner\n {\n require(\n exists(tokenId),\n \"Token with tokenId does not exist.\"\n );\n _burn(owner, tokenId);\n }\n}\n", "current/tokens/ERC721Token/ERC721Token.sol": "/*\nThe MIT License (MIT)\n\nCopyright (c) 2016 Smart Contract Solutions, Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\nOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\npragma solidity ^0.4.24;\n\nimport \"./IERC721Token.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"../../utils/SafeMath/SafeMath.sol\";\n\n/**\n * @title ERC721 Non-Fungible Token Standard basic implementation\n * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md\n * Modified from https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/ERC721/ERC721BasicToken.sol\n */\ncontract ERC721Token is\n IERC721Token,\n SafeMath\n{\n // Equals to `bytes4(keccak256(\"onERC721Received(address,uint256,bytes)\"))`\n // which can be also obtained as `ERC721Receiver(0).onERC721Received.selector`\n bytes4 constant ERC721_RECEIVED = 0xf0b9e5ba;\n\n // Mapping from token ID to owner\n mapping (uint256 => address) internal tokenOwner;\n\n // Mapping from token ID to approved address\n mapping (uint256 => address) internal tokenApprovals;\n\n // Mapping from owner to number of owned token\n mapping (address => uint256) internal ownedTokensCount;\n\n // Mapping from owner to operator approvals\n mapping (address => mapping (address => bool)) internal operatorApprovals;\n\n /**\n * @dev Guarantees msg.sender is owner of the given token\n * @param _tokenId uint256 ID of the token to validate its ownership belongs to msg.sender\n */\n modifier onlyOwnerOf(uint256 _tokenId) {\n require(ownerOf(_tokenId) == msg.sender);\n _;\n }\n\n /**\n * @dev Checks msg.sender can transfer a token, by being owner, approved, or operator\n * @param _tokenId uint256 ID of the token to validate\n */\n modifier canTransfer(uint256 _tokenId) {\n require(isApprovedOrOwner(msg.sender, _tokenId));\n _;\n }\n\n function ERC721Token(\n string _name,\n string _symbol)\n public\n {\n name_ = _name;\n symbol_ = _symbol;\n }\n\n /**\n * @dev Gets the token name\n * @return string representing the token name\n */\n function name()\n public\n view\n returns (string)\n {\n return name_;\n }\n\n /**\n * @dev Gets the token symbol\n * @return string representing the token symbol\n */\n function symbol()\n public\n view\n returns (string)\n {\n return symbol_;\n }\n\n /**\n * @dev Gets the balance of the specified address\n * @param _owner address to query the balance of\n * @return uint256 representing the amount owned by the passed address\n */\n function balanceOf(address _owner)\n public\n view\n returns (uint256)\n {\n require(_owner != address(0));\n return ownedTokensCount[_owner];\n }\n\n /**\n * @dev Gets the owner of the specified token ID\n * @param _tokenId uint256 ID of the token to query the owner of\n * @return owner address currently marked as the owner of the given token ID\n */\n function ownerOf(uint256 _tokenId)\n public\n view\n returns (address)\n {\n address owner = tokenOwner[_tokenId];\n require(owner != address(0));\n return owner;\n }\n\n /**\n * @dev Returns whether the specified token exists\n * @param _tokenId uint256 ID of the token to query the existance of\n * @return whether the token exists\n */\n function exists(uint256 _tokenId)\n public\n view\n returns (bool)\n {\n address owner = tokenOwner[_tokenId];\n return owner != address(0);\n }\n\n /**\n * @dev Approves another address to transfer the given token ID\n * @dev The zero address indicates there is no approved address.\n * @dev There can only be one approved address per token at a given time.\n * @dev Can only be called by the token owner or an approved operator.\n * @param _to address to be approved for the given token ID\n * @param _tokenId uint256 ID of the token to be approved\n */\n function approve(address _to, uint256 _tokenId)\n public\n {\n address owner = ownerOf(_tokenId);\n require(_to != owner);\n require(msg.sender == owner || isApprovedForAll(owner, msg.sender));\n\n if (getApproved(_tokenId) != address(0) || _to != address(0)) {\n tokenApprovals[_tokenId] = _to;\n emit Approval(owner, _to, _tokenId);\n }\n }\n\n /**\n * @dev Gets the approved address for a token ID, or zero if no address set\n * @param _tokenId uint256 ID of the token to query the approval of\n * @return address currently approved for a the given token ID\n */\n function getApproved(uint256 _tokenId)\n public\n view\n returns (address)\n {\n return tokenApprovals[_tokenId];\n }\n\n /**\n * @dev Sets or unsets the approval of a given operator\n * @dev An operator is allowed to transfer all tokens of the sender on their behalf\n * @param _to operator address to set the approval\n * @param _approved representing the status of the approval to be set\n */\n function setApprovalForAll(address _to, bool _approved)\n public\n {\n require(_to != msg.sender);\n operatorApprovals[msg.sender][_to] = _approved;\n emit ApprovalForAll(msg.sender, _to, _approved);\n }\n\n /**\n * @dev Tells whether an operator is approved by a given owner\n * @param _owner owner address which you want to query the approval of\n * @param _operator operator address which you want to query the approval of\n * @return bool whether the given operator is approved by the given owner\n */\n function isApprovedForAll(address _owner, address _operator)\n public\n view\n returns (bool)\n {\n return operatorApprovals[_owner][_operator];\n }\n\n /**\n * @dev Transfers the ownership of a given token ID to another address\n * @dev Usage of this method is discouraged, use `safeTransferFrom` whenever possible\n * @dev Requires the msg sender to be the owner, approved, or operator\n * @param _from current owner of the token\n * @param _to address to receive the ownership of the given token ID\n * @param _tokenId uint256 ID of the token to be transferred\n */\n function transferFrom(address _from, address _to, uint256 _tokenId)\n public\n canTransfer(_tokenId)\n {\n require(_from != address(0));\n require(_to != address(0));\n\n clearApproval(_from, _tokenId);\n removeTokenFrom(_from, _tokenId);\n addTokenTo(_to, _tokenId);\n\n emit Transfer(_from, _to, _tokenId);\n }\n\n /**\n * @dev Safely transfers the ownership of a given token ID to another address\n * @dev If the target address is a contract, it must implement `onERC721Received`,\n * which is called upon a safe transfer, and return the magic value\n * `bytes4(keccak256(\"onERC721Received(address,uint256,bytes)\"))`; otherwise,\n * the transfer is reverted.\n * @dev Requires the msg sender to be the owner, approved, or operator\n * @param _from current owner of the token\n * @param _to address to receive the ownership of the given token ID\n * @param _tokenId uint256 ID of the token to be transferred\n */\n function safeTransferFrom(\n address _from,\n address _to,\n uint256 _tokenId)\n public\n canTransfer(_tokenId)\n {\n // solium-disable-next-line arg-overflow\n safeTransferFrom(_from, _to, _tokenId, \"\");\n }\n\n /**\n * @dev Safely transfers the ownership of a given token ID to another address\n * @dev If the target address is a contract, it must implement `onERC721Received`,\n * which is called upon a safe transfer, and return the magic value\n * `bytes4(keccak256(\"onERC721Received(address,uint256,bytes)\"))`; otherwise,\n * the transfer is reverted.\n * @dev Requires the msg sender to be the owner, approved, or operator\n * @param _from current owner of the token\n * @param _to address to receive the ownership of the given token ID\n * @param _tokenId uint256 ID of the token to be transferred\n * @param _data bytes data to send along with a safe transfer check\n */\n function safeTransferFrom(\n address _from,\n address _to,\n uint256 _tokenId,\n bytes _data)\n public\n canTransfer(_tokenId)\n {\n transferFrom(_from, _to, _tokenId);\n // solium-disable-next-line arg-overflow\n require(checkAndCallSafeTransfer(_from, _to, _tokenId, _data));\n }\n\n /**\n * @dev Returns whether the given spender can transfer a given token ID\n * @param _spender address of the spender to query\n * @param _tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function isApprovedOrOwner(address _spender, uint256 _tokenId)\n internal\n view\n returns (bool)\n {\n address owner = ownerOf(_tokenId);\n return _spender == owner || getApproved(_tokenId) == _spender || isApprovedForAll(owner, _spender);\n }\n\n /**\n * @dev Internal function to mint a new token\n * @dev Reverts if the given token ID already exists\n * @param _to The address that will own the minted token\n * @param _tokenId uint256 ID of the token to be minted by the msg.sender\n */\n function _mint(address _to, uint256 _tokenId)\n internal\n {\n require(_to != address(0));\n addTokenTo(_to, _tokenId);\n emit Transfer(address(0), _to, _tokenId);\n }\n\n /**\n * @dev Internal function to burn a specific token\n * @dev Reverts if the token does not exist\n * @param _tokenId uint256 ID of the token being burned by the msg.sender\n */\n function _burn(address _owner, uint256 _tokenId)\n internal\n {\n clearApproval(_owner, _tokenId);\n removeTokenFrom(_owner, _tokenId);\n emit Transfer(_owner, address(0), _tokenId);\n }\n\n /**\n * @dev Internal function to clear current approval of a given token ID\n * @dev Reverts if the given address is not indeed the owner of the token\n * @param _owner owner of the token\n * @param _tokenId uint256 ID of the token to be transferred\n */\n function clearApproval(address _owner, uint256 _tokenId)\n internal\n {\n require(ownerOf(_tokenId) == _owner);\n if (tokenApprovals[_tokenId] != address(0)) {\n tokenApprovals[_tokenId] = address(0);\n emit Approval(_owner, address(0), _tokenId);\n }\n }\n\n /**\n * @dev Internal function to add a token ID to the list of a given address\n * @param _to address representing the new owner of the given token ID\n * @param _tokenId uint256 ID of the token to be added to the tokens list of the given address\n */\n function addTokenTo(address _to, uint256 _tokenId)\n internal\n {\n require(tokenOwner[_tokenId] == address(0));\n tokenOwner[_tokenId] = _to;\n ownedTokensCount[_to] = safeAdd(ownedTokensCount[_to], 1);\n }\n\n /**\n * @dev Internal function to remove a token ID from the list of a given address\n * @param _from address representing the previous owner of the given token ID\n * @param _tokenId uint256 ID of the token to be removed from the tokens list of the given address\n */\n function removeTokenFrom(address _from, uint256 _tokenId)\n internal\n {\n require(ownerOf(_tokenId) == _from);\n ownedTokensCount[_from] = safeSub(ownedTokensCount[_from], 1);\n tokenOwner[_tokenId] = address(0);\n }\n\n /**\n * @dev Internal function to invoke `onERC721Received` on a target address\n * @dev The call is not executed if the target address is not a contract\n * @param _from address representing the previous owner of the given token ID\n * @param _to target address that will receive the tokens\n * @param _tokenId uint256 ID of the token to be transferred\n * @param _data bytes optional data to send along with the call\n * @return whether the call correctly returned the expected magic value\n */\n function checkAndCallSafeTransfer(\n address _from,\n address _to,\n uint256 _tokenId,\n bytes _data)\n internal\n returns (bool)\n {\n if (!isContract(_to)) {\n return true;\n }\n bytes4 retval = IERC721Receiver(_to).onERC721Received(_from, _tokenId, _data);\n return (retval == ERC721_RECEIVED);\n }\n\n function isContract(address addr)\n internal\n view\n returns (bool)\n {\n uint256 size;\n // XXX Currently there is no better way to check if there is a contract in an address\n // than to check the size of the code at that address.\n // See https://ethereum.stackexchange.com/a/14016/36603\n // for more details about how this works.\n // TODO Check this again before the Serenity release, because all addresses will be\n // contracts then.\n assembly { size := extcodesize(addr) } // solium-disable-line security/no-inline-assembly\n return size > 0;\n }\n}\n", "current/tokens/ERC721Token/IERC721Receiver.sol": "/*\nThe MIT License (MIT)\n\nCopyright (c) 2016 Smart Contract Solutions, Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\nOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\npragma solidity ^0.4.24;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * rom ERC721 asset contracts.\n * Modified from https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/ERC721/ERC721Receiver.sol\n */\ncontract IERC721Receiver {\n /**\n * @dev Magic value to be returned upon successful reception of an NFT\n * Equals to `bytes4(keccak256(\"onERC721Received(address,uint256,bytes)\"))`,\n * which can be also obtained as `ERC721Receiver(0).onERC721Received.selector`\n */\n bytes4 constant ERC721_RECEIVED = 0xf0b9e5ba;\n\n /**\n * @notice Handle the receipt of an NFT\n * @dev The ERC721 smart contract calls this function on the recipient\n * after a `safetransfer`. This function MAY throw to revert and reject the\n * transfer. This function MUST use 50,000 gas or less. Return of other\n * than the magic value MUST result in the transaction being reverted.\n * Note: the contract address is always the message sender.\n * @param _from The sending address\n * @param _tokenId The NFT identifier which is being transfered\n * @param _data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC721Received(address,uint256,bytes)\"))`\n */\n function onERC721Received(\n address _from,\n uint256 _tokenId,\n bytes _data)\n public\n returns (bytes4);\n}\n", "current/tokens/ERC721Token/IERC721Token.sol": "/*\nThe MIT License (MIT)\n\nCopyright (c) 2016 Smart Contract Solutions, Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\nOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\npragma solidity ^0.4.24;\n\n/**\n * @title ERC721 Non-Fungible Token Standard basic interface\n * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md\n * Modified from https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/ERC721/ERC721Basic.sol\n */\ncontract IERC721Token {\n string internal name_;\n string internal symbol_;\n\n event Transfer(\n address indexed _from,\n address indexed _to,\n uint256 _tokenId\n );\n event Approval(\n address indexed _owner,\n address indexed _approved,\n uint256 _tokenId\n );\n event ApprovalForAll(\n address indexed _owner,\n address indexed _operator,\n bool _approved\n );\n\n function name()\n public\n view\n returns (string);\n function symbol()\n public\n view\n returns (string);\n\n function balanceOf(address _owner)\n public\n view\n returns (uint256 _balance);\n function ownerOf(uint256 _tokenId)\n public\n view\n returns (address _owner);\n function exists(uint256 _tokenId)\n public\n view\n returns (bool _exists);\n\n function approve(address _to, uint256 _tokenId)\n public;\n function getApproved(uint256 _tokenId)\n public\n view\n returns (address _operator);\n\n function setApprovalForAll(address _operator, bool _approved)\n public;\n function isApprovedForAll(address _owner, address _operator)\n public\n view\n returns (bool);\n\n function transferFrom(\n address _from,\n address _to,\n uint256 _tokenId)\n public;\n function safeTransferFrom(\n address _from,\n address _to,\n uint256 _tokenId)\n public;\n function safeTransferFrom(\n address _from,\n address _to,\n uint256 _tokenId,\n bytes _data)\n public;\n}\n", @@ -411,7 +429,7 @@ "current/utils/Ownable/Ownable.sol": "pragma solidity ^0.4.24;\npragma experimental ABIEncoderV2;\n\n/*\n * Ownable\n *\n * Base contract with an owner.\n * Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner.\n */\n\nimport \"./IOwnable.sol\";\n\ncontract Ownable is IOwnable {\n address public owner;\n\n constructor ()\n public\n {\n owner = msg.sender;\n }\n\n modifier onlyOwner() {\n require(\n msg.sender == owner,\n \"Only contract owner is allowed to call this method.\"\n );\n _;\n }\n\n function transferOwnership(address newOwner)\n public\n onlyOwner\n {\n if (newOwner != address(0)) {\n owner = newOwner;\n }\n }\n}\n", "current/utils/SafeMath/SafeMath.sol": "pragma solidity ^0.4.24;\npragma experimental ABIEncoderV2;\n\ncontract SafeMath {\n function safeMul(uint a, uint b)\n internal\n pure\n returns (uint256)\n {\n uint c = a * b;\n assert(a == 0 || c / a == b);\n return c;\n }\n\n function safeDiv(uint a, uint b)\n internal\n pure\n returns (uint256)\n {\n uint c = a / b;\n return c;\n }\n\n function safeSub(uint a, uint b)\n internal\n pure\n returns (uint256)\n {\n assert(b <= a);\n return a - b;\n }\n\n function safeAdd(uint a, uint b)\n internal\n pure\n returns (uint256)\n {\n uint c = a + b;\n assert(c >= a);\n return c;\n }\n\n function max64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n\n function max256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n}\n" }, - "sourceTreeHashHex": "0xd868b50be7aa97eabea9bd6a18b16340a24e2b30ea7ab0ab76f34342dadccbf1", + "sourceTreeHashHex": "0xd6bb686ff65d23302296d9d4f80d38d0fb8cb970b8d10ffdd36d8befbcd1803d", "compiler": { "name": "solc", "version": "soljson-v0.4.24+commit.e67f0147.js", diff --git a/packages/order-utils/src/abstract/abstract_order_filled_cancelled_fetcher.ts b/packages/order-utils/src/abstract/abstract_order_filled_cancelled_fetcher.ts index ec398a11e..865ea4e43 100644 --- a/packages/order-utils/src/abstract/abstract_order_filled_cancelled_fetcher.ts +++ b/packages/order-utils/src/abstract/abstract_order_filled_cancelled_fetcher.ts @@ -3,5 +3,5 @@ import { BigNumber } from '@0xproject/utils'; export abstract class AbstractOrderFilledCancelledFetcher { public abstract async getFilledTakerAmountAsync(orderHash: string): Promise<BigNumber>; public abstract async isOrderCancelledAsync(orderHash: string): Promise<boolean>; - public abstract getZRXTokenAddress(): string; + public abstract getZRXAssetData(): string; } diff --git a/packages/order-utils/src/exchange_transfer_simulator.ts b/packages/order-utils/src/exchange_transfer_simulator.ts index 32d53d6a2..a70259fcd 100644 --- a/packages/order-utils/src/exchange_transfer_simulator.ts +++ b/packages/order-utils/src/exchange_transfer_simulator.ts @@ -1,7 +1,8 @@ -import { ExchangeContractErrs } from '@0xproject/types'; +import { AssetProxyId, ExchangeContractErrs } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { AbstractBalanceAndProxyAllowanceLazyStore } from './abstract/abstract_balance_and_proxy_allowance_lazy_store'; +import { assetProxyUtils } from './asset_proxy_utils'; import { constants } from './constants'; import { TradeSide, TransferType } from './types'; @@ -89,7 +90,11 @@ export class ExchangeTransferSimulator { userAddress: string, amountInBaseUnits: BigNumber, ): Promise<void> { + const assetProxyId = assetProxyUtils.decodeAssetDataId(assetData); const proxyAllowance = await this._store.getProxyAllowanceAsync(assetData, userAddress); + // HACK: This code assumes that all tokens with an UNLIMITED_ALLOWANCE_IN_BASE_UNITS set, + // are UnlimitedAllowanceTokens. This is however not true, it just so happens that all + // DummyERC20Tokens we use in tests are. if (!proxyAllowance.eq(constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS)) { this._store.setProxyAllowance(assetData, userAddress, proxyAllowance.minus(amountInBaseUnits)); } diff --git a/packages/order-utils/src/index.ts b/packages/order-utils/src/index.ts index 514488e02..b4a7a6b67 100644 --- a/packages/order-utils/src/index.ts +++ b/packages/order-utils/src/index.ts @@ -16,6 +16,7 @@ export { generatePseudoRandomSalt } from './salt'; export { OrderError, MessagePrefixType, MessagePrefixOpts, EIP712Parameter, EIP712Schema, EIP712Types } from './types'; export { AbstractBalanceAndProxyAllowanceFetcher } from './abstract/abstract_balance_and_proxy_allowance_fetcher'; export { AbstractOrderFilledCancelledFetcher } from './abstract/abstract_order_filled_cancelled_fetcher'; +export { BalanceAndProxyAllowanceLazyStore } from './store/balance_and_proxy_allowance_lazy_store'; export { RemainingFillableCalculator } from './remaining_fillable_calculator'; export { OrderStateUtils } from './order_state_utils'; export { assetProxyUtils } from './asset_proxy_utils'; diff --git a/packages/order-utils/src/order_state_utils.ts b/packages/order-utils/src/order_state_utils.ts index 40f235da7..3752fdadb 100644 --- a/packages/order-utils/src/order_state_utils.ts +++ b/packages/order-utils/src/order_state_utils.ts @@ -7,43 +7,86 @@ import { SignedOrder, } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; +import * as _ from 'lodash'; import { AbstractBalanceAndProxyAllowanceFetcher } from './abstract/abstract_balance_and_proxy_allowance_fetcher'; import { AbstractOrderFilledCancelledFetcher } from './abstract/abstract_order_filled_cancelled_fetcher'; -import { assetProxyUtils } from './asset_proxy_utils'; +import { constants } from './constants'; import { orderHashUtils } from './order_hash'; import { RemainingFillableCalculator } from './remaining_fillable_calculator'; +import { utils } from './utils'; + +interface SidedOrderRelevantState { + isMakerSide: boolean; + traderBalance: BigNumber; + traderProxyAllowance: BigNumber; + traderFeeBalance: BigNumber; + traderFeeProxyAllowance: BigNumber; + filledTakerAssetAmount: BigNumber; + remainingFillableAssetAmount: BigNumber; +} const ACCEPTABLE_RELATIVE_ROUNDING_ERROR = 0.0001; export class OrderStateUtils { private _balanceAndProxyAllowanceFetcher: AbstractBalanceAndProxyAllowanceFetcher; private _orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher; - private static _validateIfOrderIsValid(signedOrder: SignedOrder, orderRelevantState: OrderRelevantState): void { - const availableTakerAssetAmount = signedOrder.takerAssetAmount.minus(orderRelevantState.filledTakerAssetAmount); + private static _validateIfOrderIsValid( + signedOrder: SignedOrder, + sidedOrderRelevantState: SidedOrderRelevantState, + ): void { + const isMakerSide = sidedOrderRelevantState.isMakerSide; + const availableTakerAssetAmount = signedOrder.takerAssetAmount.minus( + sidedOrderRelevantState.filledTakerAssetAmount, + ); if (availableTakerAssetAmount.eq(0)) { throw new Error(ExchangeContractErrs.OrderRemainingFillAmountZero); } - if (orderRelevantState.makerBalance.eq(0)) { - throw new Error(ExchangeContractErrs.InsufficientMakerBalance); + if (sidedOrderRelevantState.traderBalance.eq(0)) { + throw new Error( + isMakerSide + ? ExchangeContractErrs.InsufficientMakerBalance + : ExchangeContractErrs.InsufficientTakerBalance, + ); } - if (orderRelevantState.makerProxyAllowance.eq(0)) { - throw new Error(ExchangeContractErrs.InsufficientMakerAllowance); + if (sidedOrderRelevantState.traderProxyAllowance.eq(0)) { + throw new Error( + isMakerSide + ? ExchangeContractErrs.InsufficientMakerAllowance + : ExchangeContractErrs.InsufficientTakerAllowance, + ); } if (!signedOrder.makerFee.eq(0)) { - if (orderRelevantState.makerFeeBalance.eq(0)) { - throw new Error(ExchangeContractErrs.InsufficientMakerFeeBalance); + if (sidedOrderRelevantState.traderFeeBalance.eq(0)) { + throw new Error( + isMakerSide + ? ExchangeContractErrs.InsufficientMakerFeeBalance + : ExchangeContractErrs.InsufficientTakerFeeBalance, + ); } - if (orderRelevantState.makerFeeProxyAllowance.eq(0)) { - throw new Error(ExchangeContractErrs.InsufficientMakerFeeAllowance); + if (sidedOrderRelevantState.traderFeeProxyAllowance.eq(0)) { + throw new Error( + isMakerSide + ? ExchangeContractErrs.InsufficientMakerFeeAllowance + : ExchangeContractErrs.InsufficientTakerFeeAllowance, + ); } } - const minFillableTakerAssetAmountWithinNoRoundingErrorRange = signedOrder.takerAssetAmount - .dividedBy(ACCEPTABLE_RELATIVE_ROUNDING_ERROR) - .dividedBy(signedOrder.makerAssetAmount); + + let minFillableTakerAssetAmountWithinNoRoundingErrorRange; + if (isMakerSide) { + minFillableTakerAssetAmountWithinNoRoundingErrorRange = signedOrder.takerAssetAmount + .dividedBy(ACCEPTABLE_RELATIVE_ROUNDING_ERROR) + .dividedBy(signedOrder.makerAssetAmount); + } else { + minFillableTakerAssetAmountWithinNoRoundingErrorRange = signedOrder.makerAssetAmount + .dividedBy(ACCEPTABLE_RELATIVE_ROUNDING_ERROR) + .dividedBy(signedOrder.takerAssetAmount); + } + if ( - orderRelevantState.remainingFillableTakerAssetAmount.lessThan( + sidedOrderRelevantState.remainingFillableAssetAmount.lessThan( minFillableTakerAssetAmountWithinNoRoundingErrorRange, ) ) { @@ -57,11 +100,20 @@ export class OrderStateUtils { this._balanceAndProxyAllowanceFetcher = balanceAndProxyAllowanceFetcher; this._orderFilledCancelledFetcher = orderFilledCancelledFetcher; } - public async getOrderStateAsync(signedOrder: SignedOrder): Promise<OrderState> { - const orderRelevantState = await this.getOrderRelevantStateAsync(signedOrder); + public async getOpenOrderStateAsync(signedOrder: SignedOrder): Promise<OrderState> { + const orderRelevantState = await this.getOpenOrderRelevantStateAsync(signedOrder); const orderHash = orderHashUtils.getOrderHashHex(signedOrder); + const sidedOrderRelevantState = { + isMakerSide: true, + traderBalance: orderRelevantState.makerBalance, + traderProxyAllowance: orderRelevantState.makerProxyAllowance, + traderFeeBalance: orderRelevantState.makerFeeBalance, + traderFeeProxyAllowance: orderRelevantState.makerFeeProxyAllowance, + filledTakerAssetAmount: orderRelevantState.filledTakerAssetAmount, + remainingFillableAssetAmount: orderRelevantState.remainingFillableMakerAssetAmount, + }; try { - OrderStateUtils._validateIfOrderIsValid(signedOrder, orderRelevantState); + OrderStateUtils._validateIfOrderIsValid(signedOrder, sidedOrderRelevantState); const orderState: OrderStateValid = { isValid: true, orderHash, @@ -77,63 +129,158 @@ export class OrderStateUtils { return orderState; } } - public async getOrderRelevantStateAsync(signedOrder: SignedOrder): Promise<OrderRelevantState> { - const zrxTokenAddress = this._orderFilledCancelledFetcher.getZRXTokenAddress(); - const makerProxyData = assetProxyUtils.decodeERC20AssetData(signedOrder.makerAssetData); - const makerAssetAddress = makerProxyData.tokenAddress; - const orderHash = orderHashUtils.getOrderHashHex(signedOrder); - const makerBalance = await this._balanceAndProxyAllowanceFetcher.getBalanceAsync( - makerAssetAddress, - signedOrder.makerAddress, + public async getOpenOrderRelevantStateAsync(signedOrder: SignedOrder): Promise<OrderRelevantState> { + const isMaker = true; + const sidedOrderRelevantState = await this._getSidedOrderRelevantStateAsync( + isMaker, + signedOrder, + signedOrder.takerAddress, ); - const makerProxyAllowance = await this._balanceAndProxyAllowanceFetcher.getProxyAllowanceAsync( - makerAssetAddress, - signedOrder.makerAddress, + const remainingFillableTakerAssetAmount = sidedOrderRelevantState.remainingFillableAssetAmount + .times(signedOrder.takerAssetAmount) + .dividedToIntegerBy(signedOrder.makerAssetAmount); + + const orderRelevantState = { + makerBalance: sidedOrderRelevantState.traderBalance, + makerProxyAllowance: sidedOrderRelevantState.traderProxyAllowance, + makerFeeBalance: sidedOrderRelevantState.traderFeeBalance, + makerFeeProxyAllowance: sidedOrderRelevantState.traderFeeProxyAllowance, + filledTakerAssetAmount: sidedOrderRelevantState.filledTakerAssetAmount, + remainingFillableMakerAssetAmount: sidedOrderRelevantState.remainingFillableAssetAmount, + remainingFillableTakerAssetAmount, + }; + return orderRelevantState; + } + public async getMaxFillableTakerAssetAmountAsync( + signedOrder: SignedOrder, + takerAddress: string, + ): Promise<BigNumber> { + // Get max fillable amount for an order, considering the makers ability to fill + let isMaker = true; + const orderRelevantMakerState = await this._getSidedOrderRelevantStateAsync( + isMaker, + signedOrder, + signedOrder.takerAddress, ); - const makerFeeBalance = await this._balanceAndProxyAllowanceFetcher.getBalanceAsync( - zrxTokenAddress, - signedOrder.makerAddress, + const remainingFillableTakerAssetAmountGivenMakersStatus = signedOrder.makerAssetAmount.eq(0) + ? new BigNumber(0) + : utils.getPartialAmount( + orderRelevantMakerState.remainingFillableAssetAmount, + signedOrder.makerAssetAmount, + signedOrder.takerAssetAmount, + ); + + // Get max fillable amount for an order, considering the takers ability to fill + isMaker = false; + const orderRelevantTakerState = await this._getSidedOrderRelevantStateAsync(isMaker, signedOrder, takerAddress); + const remainingFillableTakerAssetAmountGivenTakersStatus = orderRelevantTakerState.remainingFillableAssetAmount; + + // The min of these two in the actualy max fillable by either party + const fillableTakerAssetAmount = BigNumber.min([ + remainingFillableTakerAssetAmountGivenMakersStatus, + remainingFillableTakerAssetAmountGivenTakersStatus, + ]); + + return fillableTakerAssetAmount; + } + public async getMaxFillableTakerAssetAmountForFailingOrderAsync( + signedOrder: SignedOrder, + takerAddress: string, + ): Promise<BigNumber> { + // Get min of taker balance & allowance + const takerAssetBalanceOfTaker = await this._balanceAndProxyAllowanceFetcher.getBalanceAsync( + signedOrder.takerAssetData, + takerAddress, ); - const makerFeeProxyAllowance = await this._balanceAndProxyAllowanceFetcher.getProxyAllowanceAsync( - zrxTokenAddress, - signedOrder.makerAddress, + const takerAssetAllowanceOfTaker = await this._balanceAndProxyAllowanceFetcher.getProxyAllowanceAsync( + signedOrder.takerAssetData, + takerAddress, ); + const minTakerAssetAmount = BigNumber.min([takerAssetBalanceOfTaker, takerAssetAllowanceOfTaker]); + + // get remainingFillAmount + const orderHash = orderHashUtils.getOrderHashHex(signedOrder); + const filledTakerAssetAmount = await this._orderFilledCancelledFetcher.getFilledTakerAmountAsync(orderHash); + const remainingFillTakerAssetAmount = signedOrder.takerAssetAmount.minus(filledTakerAssetAmount); + + if (minTakerAssetAmount.gte(remainingFillTakerAssetAmount)) { + return remainingFillTakerAssetAmount; + } else { + return minTakerAssetAmount; + } + } + private async _getSidedOrderRelevantStateAsync( + isMakerSide: boolean, + signedOrder: SignedOrder, + takerAddress: string, + ): Promise<SidedOrderRelevantState> { + let traderAddress; + let assetData; + let assetAmount; + let feeAmount; + if (isMakerSide) { + traderAddress = signedOrder.makerAddress; + assetData = signedOrder.makerAssetData; + assetAmount = signedOrder.makerAssetAmount; + feeAmount = signedOrder.makerFee; + } else { + traderAddress = takerAddress; + assetData = signedOrder.takerAssetData; + assetAmount = signedOrder.takerAssetAmount; + feeAmount = signedOrder.takerFee; + } + const zrxAssetData = this._orderFilledCancelledFetcher.getZRXAssetData(); + const isAssetZRX = assetData === zrxAssetData; + + const traderBalance = await this._balanceAndProxyAllowanceFetcher.getBalanceAsync(assetData, traderAddress); + const traderProxyAllowance = await this._balanceAndProxyAllowanceFetcher.getProxyAllowanceAsync( + assetData, + traderAddress, + ); + const traderFeeBalance = await this._balanceAndProxyAllowanceFetcher.getBalanceAsync( + zrxAssetData, + traderAddress, + ); + const traderFeeProxyAllowance = await this._balanceAndProxyAllowanceFetcher.getProxyAllowanceAsync( + zrxAssetData, + traderAddress, + ); + + const transferrableTraderAssetAmount = BigNumber.min([traderProxyAllowance, traderBalance]); + const transferrableFeeAssetAmount = BigNumber.min([traderFeeProxyAllowance, traderFeeBalance]); + + const orderHash = orderHashUtils.getOrderHashHex(signedOrder); const filledTakerAssetAmount = await this._orderFilledCancelledFetcher.getFilledTakerAmountAsync(orderHash); - const isOrderCancelled = await this._orderFilledCancelledFetcher.isOrderCancelledAsync(orderHash); const totalMakerAssetAmount = signedOrder.makerAssetAmount; const totalTakerAssetAmount = signedOrder.takerAssetAmount; + const isOrderCancelled = await this._orderFilledCancelledFetcher.isOrderCancelledAsync(orderHash); const remainingTakerAssetAmount = isOrderCancelled ? new BigNumber(0) : totalTakerAssetAmount.minus(filledTakerAssetAmount); - const remainingMakerAssetAmount = remainingTakerAssetAmount - .times(totalMakerAssetAmount) - .dividedToIntegerBy(totalTakerAssetAmount); - const transferrableMakerAssetAmount = BigNumber.min([makerProxyAllowance, makerBalance]); - const transferrableFeeAssetAmount = BigNumber.min([makerFeeProxyAllowance, makerFeeBalance]); - - const zrxAssetData = assetProxyUtils.encodeERC20AssetData(zrxTokenAddress); - const isMakerAssetZRX = signedOrder.makerAssetData === zrxAssetData; + const remainingMakerAssetAmount = remainingTakerAssetAmount.eq(0) + ? new BigNumber(0) + : remainingTakerAssetAmount.times(totalMakerAssetAmount).dividedToIntegerBy(totalTakerAssetAmount); + const remainingAssetAmount = isMakerSide ? remainingMakerAssetAmount : remainingTakerAssetAmount; + const remainingFillableCalculator = new RemainingFillableCalculator( - signedOrder.makerFee, - signedOrder.makerAssetAmount, - isMakerAssetZRX, - transferrableMakerAssetAmount, + feeAmount, + assetAmount, + isAssetZRX, + transferrableTraderAssetAmount, transferrableFeeAssetAmount, - remainingMakerAssetAmount, + remainingAssetAmount, ); - const remainingFillableMakerAssetAmount = remainingFillableCalculator.computeRemainingFillable(); - const remainingFillableTakerAssetAmount = remainingFillableMakerAssetAmount - .times(signedOrder.takerAssetAmount) - .dividedToIntegerBy(signedOrder.makerAssetAmount); - const orderRelevantState = { - makerBalance, - makerProxyAllowance, - makerFeeBalance, - makerFeeProxyAllowance, + const remainingFillableAssetAmount = remainingFillableCalculator.computeRemainingFillable(); + + const sidedOrderRelevantState = { + isMakerSide, + traderBalance, + traderProxyAllowance, + traderFeeBalance, + traderFeeProxyAllowance, filledTakerAssetAmount, - remainingFillableMakerAssetAmount, - remainingFillableTakerAssetAmount, + remainingFillableAssetAmount, }; - return orderRelevantState; + return sidedOrderRelevantState; } } diff --git a/packages/order-utils/src/order_validation_utils.ts b/packages/order-utils/src/order_validation_utils.ts index 3a6704f26..da5b37456 100644 --- a/packages/order-utils/src/order_validation_utils.ts +++ b/packages/order-utils/src/order_validation_utils.ts @@ -5,20 +5,15 @@ import * as _ from 'lodash'; import { OrderError, TradeSide, TransferType } from './types'; +import { AbstractOrderFilledCancelledFetcher } from './abstract/abstract_order_filled_cancelled_fetcher'; import { constants } from './constants'; import { ExchangeTransferSimulator } from './exchange_transfer_simulator'; -import { ExchangeContract } from './generated_contract_wrappers/exchange'; import { orderHashUtils } from './order_hash'; import { isValidSignatureAsync } from './signature_utils'; import { utils } from './utils'; export class OrderValidationUtils { - private _exchangeContract: ExchangeContract; - // TODO: Write some tests for the function - // const numerator = new BigNumber(20); - // const denominator = new BigNumber(999); - // const target = new BigNumber(50); - // rounding error = ((20*50/999) - floor(20*50/999)) / (20*50/999) = 0.1% + private _orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher; public static isRoundingError(numerator: BigNumber, denominator: BigNumber, target: BigNumber): boolean { // Solidity's mulmod() in JS // Source: https://solidity.readthedocs.io/en/latest/units-and-global-variables.html#mathematical-and-cryptographic-functions @@ -55,12 +50,12 @@ export class OrderValidationUtils { public static async validateFillOrderBalancesAllowancesThrowIfInvalidAsync( exchangeTradeEmulator: ExchangeTransferSimulator, signedOrder: SignedOrder, - fillTakerTokenAmount: BigNumber, + fillTakerAssetAmount: BigNumber, senderAddress: string, - zrxTokenAddress: string, + zrxAssetData: string, ): Promise<void> { - const fillMakerTokenAmount = OrderValidationUtils._getPartialAmount( - fillTakerTokenAmount, + const fillMakerTokenAmount = utils.getPartialAmount( + fillTakerAssetAmount, signedOrder.takerAssetAmount, signedOrder.makerAssetAmount, ); @@ -76,30 +71,30 @@ export class OrderValidationUtils { signedOrder.takerAssetData, senderAddress, signedOrder.makerAddress, - fillTakerTokenAmount, + fillTakerAssetAmount, TradeSide.Taker, TransferType.Trade, ); - const makerFeeAmount = OrderValidationUtils._getPartialAmount( - fillTakerTokenAmount, + const makerFeeAmount = utils.getPartialAmount( + fillTakerAssetAmount, signedOrder.takerAssetAmount, signedOrder.makerFee, ); await exchangeTradeEmulator.transferFromAsync( - zrxTokenAddress, + zrxAssetData, signedOrder.makerAddress, signedOrder.feeRecipientAddress, makerFeeAmount, TradeSide.Maker, TransferType.Fee, ); - const takerFeeAmount = OrderValidationUtils._getPartialAmount( - fillTakerTokenAmount, + const takerFeeAmount = utils.getPartialAmount( + fillTakerAssetAmount, signedOrder.takerAssetAmount, signedOrder.takerFee, ); await exchangeTradeEmulator.transferFromAsync( - zrxTokenAddress, + zrxAssetData, senderAddress, signedOrder.feeRecipientAddress, takerFeeAmount, @@ -121,50 +116,43 @@ export class OrderValidationUtils { throw new Error(ExchangeContractErrs.OrderFillExpired); } } - private static _getPartialAmount(numerator: BigNumber, denominator: BigNumber, target: BigNumber): BigNumber { - const fillMakerTokenAmount = numerator - .mul(target) - .div(denominator) - .round(0); - return fillMakerTokenAmount; - } - constructor(exchangeContract: ExchangeContract) { - this._exchangeContract = exchangeContract; + constructor(orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher) { + this._orderFilledCancelledFetcher = orderFilledCancelledFetcher; } public async validateOrderFillableOrThrowAsync( exchangeTradeEmulator: ExchangeTransferSimulator, signedOrder: SignedOrder, - zrxTokenAddress: string, + zrxAssetData: string, expectedFillTakerTokenAmount?: BigNumber, ): Promise<void> { const orderHash = orderHashUtils.getOrderHashHex(signedOrder); - const filledTakerTokenAmount = await this._exchangeContract.filled.callAsync(orderHash); + const filledTakerTokenAmount = await this._orderFilledCancelledFetcher.getFilledTakerAmountAsync(orderHash); OrderValidationUtils._validateRemainingFillAmountNotZeroOrThrow( signedOrder.takerAssetAmount, filledTakerTokenAmount, ); OrderValidationUtils._validateOrderNotExpiredOrThrow(signedOrder.expirationTimeSeconds); - let fillTakerTokenAmount = signedOrder.takerAssetAmount.minus(filledTakerTokenAmount); + let fillTakerAssetAmount = signedOrder.takerAssetAmount.minus(filledTakerTokenAmount); if (!_.isUndefined(expectedFillTakerTokenAmount)) { - fillTakerTokenAmount = expectedFillTakerTokenAmount; + fillTakerAssetAmount = expectedFillTakerTokenAmount; } await OrderValidationUtils.validateFillOrderBalancesAllowancesThrowIfInvalidAsync( exchangeTradeEmulator, signedOrder, - fillTakerTokenAmount, + fillTakerAssetAmount, signedOrder.takerAddress, - zrxTokenAddress, + zrxAssetData, ); } public async validateFillOrderThrowIfInvalidAsync( exchangeTradeEmulator: ExchangeTransferSimulator, provider: Provider, signedOrder: SignedOrder, - fillTakerTokenAmount: BigNumber, + fillTakerAssetAmount: BigNumber, takerAddress: string, - zrxTokenAddress: string, + zrxAssetData: string, ): Promise<BigNumber> { - if (fillTakerTokenAmount.eq(0)) { + if (fillTakerAssetAmount.eq(0)) { throw new Error(ExchangeContractErrs.OrderFillAmountZero); } const orderHash = orderHashUtils.getOrderHashHex(signedOrder); @@ -177,7 +165,7 @@ export class OrderValidationUtils { if (!isValid) { throw new Error(OrderError.InvalidSignature); } - const filledTakerTokenAmount = await this._exchangeContract.filled.callAsync(orderHash); + const filledTakerTokenAmount = await this._orderFilledCancelledFetcher.getFilledTakerAmountAsync(orderHash); OrderValidationUtils._validateRemainingFillAmountNotZeroOrThrow( signedOrder.takerAssetAmount, filledTakerTokenAmount, @@ -187,19 +175,19 @@ export class OrderValidationUtils { } OrderValidationUtils._validateOrderNotExpiredOrThrow(signedOrder.expirationTimeSeconds); const remainingTakerTokenAmount = signedOrder.takerAssetAmount.minus(filledTakerTokenAmount); - const desiredFillTakerTokenAmount = remainingTakerTokenAmount.lessThan(fillTakerTokenAmount) + const desiredFillTakerTokenAmount = remainingTakerTokenAmount.lessThan(fillTakerAssetAmount) ? remainingTakerTokenAmount - : fillTakerTokenAmount; + : fillTakerAssetAmount; await OrderValidationUtils.validateFillOrderBalancesAllowancesThrowIfInvalidAsync( exchangeTradeEmulator, signedOrder, desiredFillTakerTokenAmount, takerAddress, - zrxTokenAddress, + zrxAssetData, ); const wouldRoundingErrorOccur = OrderValidationUtils.isRoundingError( - filledTakerTokenAmount, + desiredFillTakerTokenAmount, signedOrder.takerAssetAmount, signedOrder.makerAssetAmount, ); @@ -212,19 +200,19 @@ export class OrderValidationUtils { exchangeTradeEmulator: ExchangeTransferSimulator, provider: Provider, signedOrder: SignedOrder, - fillTakerTokenAmount: BigNumber, + fillTakerAssetAmount: BigNumber, takerAddress: string, - zrxTokenAddress: string, + zrxAssetData: string, ): Promise<void> { const filledTakerTokenAmount = await this.validateFillOrderThrowIfInvalidAsync( exchangeTradeEmulator, provider, signedOrder, - fillTakerTokenAmount, + fillTakerAssetAmount, takerAddress, - zrxTokenAddress, + zrxAssetData, ); - if (filledTakerTokenAmount !== fillTakerTokenAmount) { + if (filledTakerTokenAmount !== fillTakerAssetAmount) { throw new Error(ExchangeContractErrs.InsufficientRemainingFillAmount); } } diff --git a/packages/order-utils/src/remaining_fillable_calculator.ts b/packages/order-utils/src/remaining_fillable_calculator.ts index bc146e931..29e19e5ab 100644 --- a/packages/order-utils/src/remaining_fillable_calculator.ts +++ b/packages/order-utils/src/remaining_fillable_calculator.ts @@ -23,9 +23,9 @@ export class RemainingFillableCalculator { this._transferrableAssetAmount = transferrableAssetAmount; this._transferrableFeeAmount = transferrableFeeAmount; this._remainingOrderAssetAmount = remainingOrderAssetAmount; - this._remainingOrderFeeAmount = remainingOrderAssetAmount - .times(this._orderFee) - .dividedToIntegerBy(this._orderAssetAmount); + this._remainingOrderFeeAmount = orderAssetAmount.eq(0) + ? new BigNumber(0) + : remainingOrderAssetAmount.times(orderFee).dividedToIntegerBy(orderAssetAmount); } public computeRemainingFillable(): BigNumber { if (this._hasSufficientFundsForFeeAndTransferAmount()) { diff --git a/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts b/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts index 08d50b924..e7352119d 100644 --- a/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts +++ b/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts @@ -19,8 +19,8 @@ export class BalanceAndProxyAllowanceLazyStore implements AbstractBalanceAndProx [userAddress: string]: BigNumber; }; }; - constructor(token: AbstractBalanceAndProxyAllowanceFetcher) { - this._balanceAndProxyAllowanceFetcher = token; + constructor(balanceAndProxyAllowanceFetcher: AbstractBalanceAndProxyAllowanceFetcher) { + this._balanceAndProxyAllowanceFetcher = balanceAndProxyAllowanceFetcher; this._balance = {}; this._proxyAllowance = {}; } diff --git a/packages/order-utils/src/utils.ts b/packages/order-utils/src/utils.ts index 6149316f6..7aaaf0609 100644 --- a/packages/order-utils/src/utils.ts +++ b/packages/order-utils/src/utils.ts @@ -12,4 +12,11 @@ export const utils = { const milisecondsInSecond = 1000; return new BigNumber(Date.now() / milisecondsInSecond).round(); }, + getPartialAmount(numerator: BigNumber, denominator: BigNumber, target: BigNumber): BigNumber { + const fillMakerTokenAmount = numerator + .mul(target) + .div(denominator) + .round(0); + return fillMakerTokenAmount; + }, }; diff --git a/packages/order-utils/test/exchange_transfer_simulator_test.ts b/packages/order-utils/test/exchange_transfer_simulator_test.ts index 52385f611..bed04d879 100644 --- a/packages/order-utils/test/exchange_transfer_simulator_test.ts +++ b/packages/order-utils/test/exchange_transfer_simulator_test.ts @@ -4,6 +4,7 @@ import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import { artifacts } from '../src/artifacts'; +import { assetProxyUtils } from '../src/asset_proxy_utils'; import { constants } from '../src/constants'; import { ExchangeTransferSimulator } from '../src/exchange_transfer_simulator'; import { DummyERC20TokenContract } from '../src/generated_contract_wrappers/dummy_e_r_c20_token'; @@ -27,7 +28,7 @@ describe('ExchangeTransferSimulator', async () => { let coinbase: string; let sender: string; let recipient: string; - let exampleTokenAddress: string; + let exampleAssetData: string; let exchangeTransferSimulator: ExchangeTransferSimulator; let txHash: string; let erc20ProxyAddress: string; @@ -65,7 +66,7 @@ describe('ExchangeTransferSimulator', async () => { totalSupply, ); - exampleTokenAddress = dummyERC20Token.address; + exampleAssetData = assetProxyUtils.encodeERC20AssetData(dummyERC20Token.address); }); beforeEach(async () => { await blockchainLifecycle.startAsync(); @@ -91,7 +92,7 @@ describe('ExchangeTransferSimulator', async () => { it("throws if the user doesn't have enough allowance", async () => { return expect( exchangeTransferSimulator.transferFromAsync( - exampleTokenAddress, + exampleAssetData, sender, recipient, transferAmount, @@ -107,7 +108,7 @@ describe('ExchangeTransferSimulator', async () => { await web3Wrapper.awaitTransactionSuccessAsync(txHash); return expect( exchangeTransferSimulator.transferFromAsync( - exampleTokenAddress, + exampleAssetData, sender, recipient, transferAmount, @@ -128,7 +129,7 @@ describe('ExchangeTransferSimulator', async () => { await web3Wrapper.awaitTransactionSuccessAsync(txHash); await exchangeTransferSimulator.transferFromAsync( - exampleTokenAddress, + exampleAssetData, sender, recipient, transferAmount, @@ -136,9 +137,9 @@ describe('ExchangeTransferSimulator', async () => { TransferType.Trade, ); const store = (exchangeTransferSimulator as any)._store; - const senderBalance = await store.getBalanceAsync(exampleTokenAddress, sender); - const recipientBalance = await store.getBalanceAsync(exampleTokenAddress, recipient); - const senderProxyAllowance = await store.getProxyAllowanceAsync(exampleTokenAddress, sender); + const senderBalance = await store.getBalanceAsync(exampleAssetData, sender); + const recipientBalance = await store.getBalanceAsync(exampleAssetData, recipient); + const senderProxyAllowance = await store.getProxyAllowanceAsync(exampleAssetData, sender); expect(senderBalance).to.be.bignumber.equal(0); expect(recipientBalance).to.be.bignumber.equal(transferAmount); expect(senderProxyAllowance).to.be.bignumber.equal(0); @@ -157,7 +158,7 @@ describe('ExchangeTransferSimulator', async () => { ); await web3Wrapper.awaitTransactionSuccessAsync(txHash); await exchangeTransferSimulator.transferFromAsync( - exampleTokenAddress, + exampleAssetData, sender, recipient, transferAmount, @@ -165,9 +166,9 @@ describe('ExchangeTransferSimulator', async () => { TransferType.Trade, ); const store = (exchangeTransferSimulator as any)._store; - const senderBalance = await store.getBalanceAsync(exampleTokenAddress, sender); - const recipientBalance = await store.getBalanceAsync(exampleTokenAddress, recipient); - const senderProxyAllowance = await store.getProxyAllowanceAsync(exampleTokenAddress, sender); + const senderBalance = await store.getBalanceAsync(exampleAssetData, sender); + const recipientBalance = await store.getBalanceAsync(exampleAssetData, recipient); + const senderProxyAllowance = await store.getProxyAllowanceAsync(exampleAssetData, sender); expect(senderBalance).to.be.bignumber.equal(0); expect(recipientBalance).to.be.bignumber.equal(transferAmount); expect(senderProxyAllowance).to.be.bignumber.equal(constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS); diff --git a/packages/order-watcher/test/global_hooks.ts b/packages/order-watcher/test/global_hooks.ts index 9d6903af5..30b0cd697 100644 --- a/packages/order-watcher/test/global_hooks.ts +++ b/packages/order-watcher/test/global_hooks.ts @@ -6,7 +6,7 @@ import { provider } from './utils/web3_wrapper'; before('migrate contracts', async function(): Promise<void> { // HACK: Since the migrations take longer then our global mocha timeout limit // we manually increase it for this before hook. - const mochaTestTimeoutMs = 20000; + const mochaTestTimeoutMs = 25000; this.timeout(mochaTestTimeoutMs); const txDefaults = { gas: devConstants.GAS_LIMIT, |