More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 8516079 | 1853 days ago | IN | 0 ETH | 0.0263157 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
ZeroExExchangeWrapper
Compiler Version
v0.5.7+commit.6da8b019
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2019-09-09 */ // File: openzeppelin-solidity/contracts/math/SafeMath.sol pragma solidity ^0.5.2; pragma experimental "ABIEncoderV2"; /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; } /** * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; } /** * @dev Adds two unsigned integers, reverts on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } /** * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo), * reverts when dividing by zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; } } // File: contracts/lib/CommonMath.sol /* Copyright 2018 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.7; library CommonMath { using SafeMath for uint256; /** * Calculates and returns the maximum value for a uint256 * * @return The maximum value for uint256 */ function maxUInt256() internal pure returns (uint256) { return 2 ** 256 - 1; } /** * @dev Performs the power on a specified value, reverts on overflow. */ function safePower( uint256 a, uint256 pow ) internal pure returns (uint256) { require(a > 0); uint256 result = 1; for (uint256 i = 0; i < pow; i++){ uint256 previousResult = result; // Using safemath multiplication prevents overflows result = previousResult.mul(a); } return result; } /** * Checks for rounding errors and returns value of potential partial amounts of a principal * * @param _principal Number fractional amount is derived from * @param _numerator Numerator of fraction * @param _denominator Denominator of fraction * @return uint256 Fractional amount of principal calculated */ function getPartialAmount( uint256 _principal, uint256 _numerator, uint256 _denominator ) internal pure returns (uint256) { // Get remainder of partial amount (if 0 not a partial amount) uint256 remainder = mulmod(_principal, _numerator, _denominator); // Return if not a partial amount if (remainder == 0) { return _principal.mul(_numerator).div(_denominator); } // Calculate error percentage uint256 errPercentageTimes1000000 = remainder.mul(1000000).div(_numerator.mul(_principal)); // Require error percentage is less than 0.1%. require( errPercentageTimes1000000 < 1000, "CommonMath.getPartialAmount: Rounding error exceeds bounds" ); return _principal.mul(_numerator).div(_denominator); } } // File: contracts/lib/IERC20.sol /* Copyright 2018 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.7; /** * @title IERC20 * @author Set Protocol * * Interface for using ERC20 Tokens. This interface is needed to interact with tokens that are not * fully ERC20 compliant and return something other than true on successful transfers. */ interface IERC20 { function balanceOf( address _owner ) external view returns (uint256); function allowance( address _owner, address _spender ) external view returns (uint256); function transfer( address _to, uint256 _quantity ) external; function transferFrom( address _from, address _to, uint256 _quantity ) external; function approve( address _spender, uint256 _quantity ) external returns (bool); function totalSupply() external returns (uint256); } // File: contracts/lib/ERC20Wrapper.sol /* Copyright 2018 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.7; /** * @title ERC20Wrapper * @author Set Protocol * * This library contains functions for interacting wtih ERC20 tokens, even those not fully compliant. * For all functions we will only accept tokens that return a null or true value, any other values will * cause the operation to revert. */ library ERC20Wrapper { // ============ Internal Functions ============ /** * Check balance owner's balance of ERC20 token * * @param _token The address of the ERC20 token * @param _owner The owner who's balance is being checked * @return uint256 The _owner's amount of tokens */ function balanceOf( address _token, address _owner ) external view returns (uint256) { return IERC20(_token).balanceOf(_owner); } /** * Checks spender's allowance to use token's on owner's behalf. * * @param _token The address of the ERC20 token * @param _owner The token owner address * @param _spender The address the allowance is being checked on * @return uint256 The spender's allowance on behalf of owner */ function allowance( address _token, address _owner, address _spender ) internal view returns (uint256) { return IERC20(_token).allowance(_owner, _spender); } /** * Transfers tokens from an address. Handle's tokens that return true or null. * If other value returned, reverts. * * @param _token The address of the ERC20 token * @param _to The address to transfer to * @param _quantity The amount of tokens to transfer */ function transfer( address _token, address _to, uint256 _quantity ) external { IERC20(_token).transfer(_to, _quantity); // Check that transfer returns true or null require( checkSuccess(), "ERC20Wrapper.transfer: Bad return value" ); } /** * Transfers tokens from an address (that has set allowance on the proxy). * Handle's tokens that return true or null. If other value returned, reverts. * * @param _token The address of the ERC20 token * @param _from The address to transfer from * @param _to The address to transfer to * @param _quantity The number of tokens to transfer */ function transferFrom( address _token, address _from, address _to, uint256 _quantity ) external { IERC20(_token).transferFrom(_from, _to, _quantity); // Check that transferFrom returns true or null require( checkSuccess(), "ERC20Wrapper.transferFrom: Bad return value" ); } /** * Grants spender ability to spend on owner's behalf. * Handle's tokens that return true or null. If other value returned, reverts. * * @param _token The address of the ERC20 token * @param _spender The address to approve for transfer * @param _quantity The amount of tokens to approve spender for */ function approve( address _token, address _spender, uint256 _quantity ) internal { IERC20(_token).approve(_spender, _quantity); // Check that approve returns true or null require( checkSuccess(), "ERC20Wrapper.approve: Bad return value" ); } /** * Ensure's the owner has granted enough allowance for system to * transfer tokens. * * @param _token The address of the ERC20 token * @param _owner The address of the token owner * @param _spender The address to grant/check allowance for * @param _quantity The amount to see if allowed for */ function ensureAllowance( address _token, address _owner, address _spender, uint256 _quantity ) internal { uint256 currentAllowance = allowance(_token, _owner, _spender); if (currentAllowance < _quantity) { approve( _token, _spender, CommonMath.maxUInt256() ); } } // ============ Private Functions ============ /** * Checks the return value of the previous function up to 32 bytes. Returns true if the previous * function returned 0 bytes or 1. */ function checkSuccess( ) private pure returns (bool) { // default to failure uint256 returnValue = 0; assembly { // check number of bytes returned from last function call switch returndatasize // no bytes returned: assume success case 0x0 { returnValue := 1 } // 32 bytes returned case 0x20 { // copy 32 bytes into scratch space returndatacopy(0x0, 0x0, 0x20) // load those bytes into returnValue returnValue := mload(0x0) } // not sure what was returned: dont mark as success default { } } // check if returned value is one or nothing return returnValue == 1; } } // File: contracts/core/interfaces/ICore.sol /* Copyright 2018 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.7; /** * @title ICore * @author Set Protocol * * The ICore Contract defines all the functions exposed in the Core through its * various extensions and is a light weight way to interact with the contract. */ interface ICore { /** * Return transferProxy address. * * @return address transferProxy address */ function transferProxy() external view returns (address); /** * Return vault address. * * @return address vault address */ function vault() external view returns (address); /** * Return address belonging to given exchangeId. * * @param _exchangeId ExchangeId number * @return address Address belonging to given exchangeId */ function exchangeIds( uint8 _exchangeId ) external view returns (address); /* * Returns if valid set * * @return bool Returns true if Set created through Core and isn't disabled */ function validSets(address) external view returns (bool); /* * Returns if valid module * * @return bool Returns true if valid module */ function validModules(address) external view returns (bool); /** * Return boolean indicating if address is a valid Rebalancing Price Library. * * @param _priceLibrary Price library address * @return bool Boolean indicating if valid Price Library */ function validPriceLibraries( address _priceLibrary ) external view returns (bool); /** * Exchanges components for Set Tokens * * @param _set Address of set to issue * @param _quantity Quantity of set to issue */ function issue( address _set, uint256 _quantity ) external; /** * Issues a specified Set for a specified quantity to the recipient * using the caller's components from the wallet and vault. * * @param _recipient Address to issue to * @param _set Address of the Set to issue * @param _quantity Number of tokens to issue */ function issueTo( address _recipient, address _set, uint256 _quantity ) external; /** * Converts user's components into Set Tokens held directly in Vault instead of user's account * * @param _set Address of the Set * @param _quantity Number of tokens to redeem */ function issueInVault( address _set, uint256 _quantity ) external; /** * Function to convert Set Tokens into underlying components * * @param _set The address of the Set token * @param _quantity The number of tokens to redeem. Should be multiple of natural unit. */ function redeem( address _set, uint256 _quantity ) external; /** * Redeem Set token and return components to specified recipient. The components * are left in the vault * * @param _recipient Recipient of Set being issued * @param _set Address of the Set * @param _quantity Number of tokens to redeem */ function redeemTo( address _recipient, address _set, uint256 _quantity ) external; /** * Function to convert Set Tokens held in vault into underlying components * * @param _set The address of the Set token * @param _quantity The number of tokens to redeem. Should be multiple of natural unit. */ function redeemInVault( address _set, uint256 _quantity ) external; /** * Composite method to redeem and withdraw with a single transaction * * Normally, you should expect to be able to withdraw all of the tokens. * However, some have central abilities to freeze transfers (e.g. EOS). _toExclude * allows you to optionally specify which component tokens to exclude when * redeeming. They will remain in the vault under the users' addresses. * * @param _set Address of the Set * @param _to Address to withdraw or attribute tokens to * @param _quantity Number of tokens to redeem * @param _toExclude Mask of indexes of tokens to exclude from withdrawing */ function redeemAndWithdrawTo( address _set, address _to, uint256 _quantity, uint256 _toExclude ) external; /** * Deposit multiple tokens to the vault. Quantities should be in the * order of the addresses of the tokens being deposited. * * @param _tokens Array of the addresses of the ERC20 tokens * @param _quantities Array of the number of tokens to deposit */ function batchDeposit( address[] calldata _tokens, uint256[] calldata _quantities ) external; /** * Withdraw multiple tokens from the vault. Quantities should be in the * order of the addresses of the tokens being withdrawn. * * @param _tokens Array of the addresses of the ERC20 tokens * @param _quantities Array of the number of tokens to withdraw */ function batchWithdraw( address[] calldata _tokens, uint256[] calldata _quantities ) external; /** * Deposit any quantity of tokens into the vault. * * @param _token The address of the ERC20 token * @param _quantity The number of tokens to deposit */ function deposit( address _token, uint256 _quantity ) external; /** * Withdraw a quantity of tokens from the vault. * * @param _token The address of the ERC20 token * @param _quantity The number of tokens to withdraw */ function withdraw( address _token, uint256 _quantity ) external; /** * Transfer tokens associated with the sender's account in vault to another user's * account in vault. * * @param _token Address of token being transferred * @param _to Address of user receiving tokens * @param _quantity Amount of tokens being transferred */ function internalTransfer( address _token, address _to, uint256 _quantity ) external; /** * Deploys a new Set Token and adds it to the valid list of SetTokens * * @param _factory The address of the Factory to create from * @param _components The address of component tokens * @param _units The units of each component token * @param _naturalUnit The minimum unit to be issued or redeemed * @param _name The bytes32 encoded name of the new Set * @param _symbol The bytes32 encoded symbol of the new Set * @param _callData Byte string containing additional call parameters * @return setTokenAddress The address of the new Set */ function createSet( address _factory, address[] calldata _components, uint256[] calldata _units, uint256 _naturalUnit, bytes32 _name, bytes32 _symbol, bytes calldata _callData ) external returns (address); /** * Exposes internal function that deposits a quantity of tokens to the vault and attributes * the tokens respectively, to system modules. * * @param _from Address to transfer tokens from * @param _to Address to credit for deposit * @param _token Address of token being deposited * @param _quantity Amount of tokens to deposit */ function depositModule( address _from, address _to, address _token, uint256 _quantity ) external; /** * Exposes internal function that withdraws a quantity of tokens from the vault and * deattributes the tokens respectively, to system modules. * * @param _from Address to decredit for withdraw * @param _to Address to transfer tokens to * @param _token Address of token being withdrawn * @param _quantity Amount of tokens to withdraw */ function withdrawModule( address _from, address _to, address _token, uint256 _quantity ) external; /** * Exposes internal function that deposits multiple tokens to the vault, to system * modules. Quantities should be in the order of the addresses of the tokens being * deposited. * * @param _from Address to transfer tokens from * @param _to Address to credit for deposits * @param _tokens Array of the addresses of the tokens being deposited * @param _quantities Array of the amounts of tokens to deposit */ function batchDepositModule( address _from, address _to, address[] calldata _tokens, uint256[] calldata _quantities ) external; /** * Exposes internal function that withdraws multiple tokens from the vault, to system * modules. Quantities should be in the order of the addresses of the tokens being withdrawn. * * @param _from Address to decredit for withdrawals * @param _to Address to transfer tokens to * @param _tokens Array of the addresses of the tokens being withdrawn * @param _quantities Array of the amounts of tokens to withdraw */ function batchWithdrawModule( address _from, address _to, address[] calldata _tokens, uint256[] calldata _quantities ) external; /** * Expose internal function that exchanges components for Set tokens, * accepting any owner, to system modules * * @param _owner Address to use tokens from * @param _recipient Address to issue Set to * @param _set Address of the Set to issue * @param _quantity Number of tokens to issue */ function issueModule( address _owner, address _recipient, address _set, uint256 _quantity ) external; /** * Expose internal function that exchanges Set tokens for components, * accepting any owner, to system modules * * @param _burnAddress Address to burn token from * @param _incrementAddress Address to increment component tokens to * @param _set Address of the Set to redeem * @param _quantity Number of tokens to redeem */ function redeemModule( address _burnAddress, address _incrementAddress, address _set, uint256 _quantity ) external; /** * Expose vault function that increments user's balance in the vault. * Available to system modules * * @param _tokens The addresses of the ERC20 tokens * @param _owner The address of the token owner * @param _quantities The numbers of tokens to attribute to owner */ function batchIncrementTokenOwnerModule( address[] calldata _tokens, address _owner, uint256[] calldata _quantities ) external; /** * Expose vault function that decrement user's balance in the vault * Only available to system modules. * * @param _tokens The addresses of the ERC20 tokens * @param _owner The address of the token owner * @param _quantities The numbers of tokens to attribute to owner */ function batchDecrementTokenOwnerModule( address[] calldata _tokens, address _owner, uint256[] calldata _quantities ) external; /** * Expose vault function that transfer vault balances between users * Only available to system modules. * * @param _tokens Addresses of tokens being transferred * @param _from Address tokens being transferred from * @param _to Address tokens being transferred to * @param _quantities Amounts of tokens being transferred */ function batchTransferBalanceModule( address[] calldata _tokens, address _from, address _to, uint256[] calldata _quantities ) external; /** * Transfers token from one address to another using the transfer proxy. * Only available to system modules. * * @param _token The address of the ERC20 token * @param _quantity The number of tokens to transfer * @param _from The address to transfer from * @param _to The address to transfer to */ function transferModule( address _token, uint256 _quantity, address _from, address _to ) external; /** * Expose transfer proxy function to transfer tokens from one address to another * Only available to system modules. * * @param _tokens The addresses of the ERC20 token * @param _quantities The numbers of tokens to transfer * @param _from The address to transfer from * @param _to The address to transfer to */ function batchTransferModule( address[] calldata _tokens, uint256[] calldata _quantities, address _from, address _to ) external; } // File: contracts/core/lib/ExchangeWrapperLibraryV2.sol /* Copyright 2018 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.7; /** * @title ExchangeWrapperLibrary * @author Set Protocol * * This library contains structs and functions to assist executing orders on third party exchanges * * CHANGELOG * - Removes functions that result in circular dependencies when trying to flatten. * - Functions using this library mainly use it for the structs */ library ExchangeWrapperLibraryV2 { // ============ Structs ============ /** * caller Original user initiating transaction * orderCount Expected number of orders to execute */ struct ExchangeData { address caller; uint256 orderCount; } /** * components A list of the acquired components from exchange wrapper * componentQuantities A list of the component quantities acquired */ struct ExchangeResults { address[] receiveTokens; uint256[] receiveTokenAmounts; } } // File: contracts/core/interfaces/IExchangeWrapper.sol /* Copyright 2018 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.7; /** * @title IExchangeWrapper * @author Set Protocol * * Interface for executing an order with an exchange wrapper */ interface IExchangeWrapper { /* ============ External Functions ============ */ /** * Exchange some amount of makerToken for takerToken. * * maker Issuance order maker * taker Issuance order taker * makerToken Address of maker token used in exchange orders * makerAssetAmount Amount of issuance order maker token to use on this exchange * orderCount Expected number of orders to execute * fillQuantity Quantity of Set to be filled * attemptedFillQuantity Quantity of Set taker attempted to fill * * @param _orderData Arbitrary bytes data for any information to pass to the exchange */ function exchange( ExchangeWrapperLibraryV2.ExchangeData calldata _exchangeData, bytes calldata _orderData ) external returns (ExchangeWrapperLibraryV2.ExchangeResults memory); } // File: contracts/external/0x/LibBytes.sol /* Copyright 2018 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.7; library LibBytes { using LibBytes for bytes; /// @dev Gets the memory address for the contents of a byte array. /// @param input Byte array to lookup. /// @return memoryAddress Memory address of the contents of the byte array. function contentAddress(bytes memory input) internal pure returns (uint256 memoryAddress) { assembly { memoryAddress := add(input, 32) } return memoryAddress; } /// @dev Reads an unpadded bytes4 value from a position in a byte array. /// @param b Byte array containing a bytes4 value. /// @param index Index in byte array of bytes4 value. /// @return bytes4 value from byte array. function readBytes4( bytes memory b, uint256 index) internal pure returns (bytes4 result) { require( b.length >= index + 4, "GREATER_OR_EQUAL_TO_4_LENGTH_REQUIRED" ); assembly { result := mload(add(b, 32)) // Solidity does not require us to clean the trailing bytes. // We do it anyway result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000) } return result; } /// @dev Reads a bytes32 value from a position in a byte array. /// @param b Byte array containing a bytes32 value. /// @param index Index in byte array of bytes32 value. /// @return bytes32 value from byte array. function readBytes32( bytes memory b, uint256 index ) internal pure returns (bytes32 result) { require( b.length >= index + 32, "GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED" ); // Arrays are prefixed by a 256 bit length parameter index += 32; // Read the bytes32 from array memory assembly { result := mload(add(b, index)) } return result; } /// @dev Copies `length` bytes from memory location `source` to `dest`. /// @param dest memory address to copy bytes to. /// @param source memory address to copy bytes from. /// @param length number of bytes to copy. function memCopy( uint256 dest, uint256 source, uint256 length ) internal pure { if (length < 32) { // Handle a partial word by reading destination and masking // off the bits we are interested in. // This correctly handles overlap, zero lengths and source == dest assembly { let mask := sub(exp(256, sub(32, length)), 1) let s := and(mload(source), not(mask)) let d := and(mload(dest), mask) mstore(dest, or(s, d)) } } else { // Skip the O(length) loop when source == dest. if (source == dest) { return; } // For large copies we copy whole words at a time. The final // word is aligned to the end of the range (instead of after the // previous) to handle partial words. So a copy will look like this: // // #### // #### // #### // #### // // We handle overlap in the source and destination range by // changing the copying direction. This prevents us from // overwriting parts of source that we still need to copy. // // This correctly handles source == dest // if (source > dest) { assembly { // We subtract 32 from `sEnd` and `dEnd` because it // is easier to compare with in the loop, and these // are also the addresses we need for copying the // last bytes. length := sub(length, 32) let sEnd := add(source, length) let dEnd := add(dest, length) // Remember the last 32 bytes of source // This needs to be done here and not after the loop // because we may have overwritten the last bytes in // source already due to overlap. let last := mload(sEnd) // Copy whole words front to back // Note: the first check is always true, // this could have been a do-while loop. for {} lt(source, sEnd) {} { mstore(dest, mload(source)) source := add(source, 32) dest := add(dest, 32) } // Write the last 32 bytes mstore(dEnd, last) } } else { assembly { // We subtract 32 from `sEnd` and `dEnd` because those // are the starting points when copying a word at the end. length := sub(length, 32) let sEnd := add(source, length) let dEnd := add(dest, length) // Remember the first 32 bytes of source // This needs to be done here and not after the loop // because we may have overwritten the first bytes in // source already due to overlap. let first := mload(source) // Copy whole words back to front // We use a signed comparisson here to allow dEnd to become // negative (happens when source and dest < 32). Valid // addresses in local memory will never be larger than // 2**255, so they can be safely re-interpreted as signed. // Note: the first check is always true, // this could have been a do-while loop. for {} slt(dest, dEnd) {} { mstore(dEnd, mload(sEnd)) sEnd := sub(sEnd, 32) dEnd := sub(dEnd, 32) } // Write the first 32 bytes mstore(dest, first) } } } } /// @dev Returns a slices from a byte array. /// @param b The byte array to take a slice from. /// @param from The starting index for the slice (inclusive). /// @param to The final index for the slice (exclusive). /// @return result The slice containing bytes at indices [from, to) function slice(bytes memory b, uint256 from, uint256 to) internal pure returns (bytes memory result) { require( from <= to, "FROM_LESS_THAN_TO_REQUIRED" ); require( // NOTE: Set Protocol changed from `to < b.length` so that the last byte can be sliced off to <= b.length, "TO_LESS_THAN_LENGTH_REQUIRED" ); // Create a new bytes structure and copy contents result = new bytes(to - from); memCopy( result.contentAddress(), b.contentAddress() + from, result.length); return result; } } // File: contracts/core/lib/ExchangeWrapperLibrary.sol /* Copyright 2018 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.7; /** * @title ExchangeWrapperLibrary * @author Set Protocol * * This library contains structs and functions to assist executing orders on third party exchanges */ library ExchangeWrapperLibrary { // ============ Structs ============ /** * caller Original user initiating transaction * orderCount Expected number of orders to execute */ struct ExchangeData { address caller; uint256 orderCount; } /** * components A list of the acquired components from exchange wrapper * componentQuantities A list of the component quantities acquired */ struct ExchangeResults { address[] receiveTokens; uint256[] receiveTokenAmounts; } /** * Checks if any send tokens leftover and transfers to caller * @param _sendTokens The addresses of send tokens * @param _caller The address of the original transaction caller */ function returnLeftoverSendTokens( address[] memory _sendTokens, address _caller ) internal { for (uint256 i = 0; i < _sendTokens.length; i++) { // Transfer any unused or remainder send token back to the caller uint256 remainderSendToken = ERC20Wrapper.balanceOf(_sendTokens[i], address(this)); if (remainderSendToken > 0) { ERC20Wrapper.transfer( _sendTokens[i], _caller, remainderSendToken ); } } } /** * Calls exchange to execute trades and deposits fills into Vault for issuanceOrder maker. * * * @param _core Address of Core * @param _exchangeData Standard exchange wrapper interface object containing exchange metadata * @param _exchangeWrapper Address of exchange wrapper being called * @param _bodyData Arbitrary bytes data for orders to be executed on exchange */ function callExchange( address _core, ExchangeWrapperLibraryV2.ExchangeData memory _exchangeData, address _exchangeWrapper, bytes memory _bodyData ) internal { // Call Exchange ExchangeWrapperLibraryV2.ExchangeResults memory exchangeResults = IExchangeWrapper(_exchangeWrapper).exchange( _exchangeData, _bodyData ); // Transfer receiveToken tokens from wrapper to vault ICore(_core).batchDepositModule( _exchangeWrapper, _exchangeData.caller, exchangeResults.receiveTokens, exchangeResults.receiveTokenAmounts ); } } // File: contracts/external/0x/Exchange/libs/LibEIP712.sol /* Copyright 2018 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.7; contract LibEIP712 { // EIP191 header for EIP712 prefix string constant EIP191_HEADER = "\x19\x01"; // EIP712 Domain Name value string constant EIP712_DOMAIN_NAME = "0x Protocol"; // EIP712 Domain Version value string constant EIP712_DOMAIN_VERSION = "2"; // Hash of the EIP712 Domain Separator Schema bytes32 public constant EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH = keccak256(abi.encodePacked( "EIP712Domain(", "string name,", "string version,", "address verifyingContract", ")" )); // Hash of the EIP712 Domain Separator data bytes32 public EIP712_DOMAIN_HASH; } // File: contracts/external/0x/Exchange/libs/LibOrder.sol /* Copyright 2018 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.7; contract LibOrder is LibEIP712 { // Hash for the EIP712 Order Schema bytes32 constant EIP712_ORDER_SCHEMA_HASH = keccak256(abi.encodePacked( "Order(", "address makerAddress,", "address takerAddress,", "address feeRecipientAddress,", "address senderAddress,", "uint256 makerAssetAmount,", "uint256 takerAssetAmount,", "uint256 makerFee,", "uint256 takerFee,", "uint256 expirationTimeSeconds,", "uint256 salt,", "bytes makerAssetData,", "bytes takerAssetData", ")" )); // A valid order remains fillable until it is expired, fully filled, or cancelled. // An order's state is unaffected by external factors, like account balances. enum OrderStatus { INVALID, // Default value INVALID_MAKER_ASSET_AMOUNT, // Order does not have a valid maker asset amount INVALID_TAKER_ASSET_AMOUNT, // Order does not have a valid taker asset amount FILLABLE, // Order is fillable EXPIRED, // Order has already expired FULLY_FILLED, // Order is fully filled CANCELLED // Order has been cancelled } struct Order { address makerAddress; // Address that created the order. address takerAddress; // Address that is allowed to fill the order. If set to 0, any address is allowed to fill the order. address feeRecipientAddress; // Address that will recieve fees when order is filled. address senderAddress; // Address that is allowed to call Exchange contract methods that affect this order. If set to 0, any address is allowed to call these methods. uint256 makerAssetAmount; // Amount of makerAsset being offered by maker. Must be greater than 0. uint256 takerAssetAmount; // Amount of takerAsset being bid on by maker. Must be greater than 0. uint256 makerFee; // Amount of ZRX paid to feeRecipient by maker when order is filled. If set to 0, no transfer of ZRX from maker to feeRecipient will be attempted. uint256 takerFee; // Amount of ZRX paid to feeRecipient by taker when order is filled. If set to 0, no transfer of ZRX from taker to feeRecipient will be attempted. uint256 expirationTimeSeconds; // Timestamp in seconds at which order expires. uint256 salt; // Arbitrary number to facilitate uniqueness of the order's hash. bytes makerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring makerAsset. The last byte references the id of this proxy. bytes takerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring takerAsset. The last byte references the id of this proxy. } struct OrderInfo { uint8 orderStatus; // Status that describes order's validity and fillability. bytes32 orderHash; // EIP712 hash of the order (see LibOrder.getOrderHash). uint256 orderTakerAssetFilledAmount; // Amount of order that has already been filled. } } // File: contracts/external/0x/Exchange/libs/LibFillResults.sol /* Copyright 2018 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.7; contract LibFillResults { struct FillResults { uint256 makerAssetFilledAmount; // Total amount of makerAsset(s) filled. uint256 takerAssetFilledAmount; // Total amount of takerAsset(s) filled. uint256 makerFeePaid; // Total amount of ZRX paid by maker(s) to feeRecipient(s). uint256 takerFeePaid; // Total amount of ZRX paid by taker to feeRecipients(s). } struct MatchedFillResults { FillResults left; // Amounts filled and fees paid of left order. FillResults right; // Amounts filled and fees paid of right order. uint256 leftMakerAssetSpreadAmount; // Spread between price of left and right order, denominated in the left order's makerAsset, paid to taker. } } // File: contracts/external/0x/Exchange/interfaces/IExchangeCore.sol /* Copyright 2018 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.7; contract IExchangeCore { /// @dev Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch /// and senderAddress equal to msg.sender (or null address if msg.sender == makerAddress). /// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled. function cancelOrdersUpTo(uint256 targetOrderEpoch) external; /// @dev Fills the input order. /// @param order Order struct containing order specifications. /// @param takerAssetFillAmount Desired amount of takerAsset to sell. /// @param signature Proof that order has been created by maker. /// @return Amounts filled and fees paid by maker and taker. function fillOrder( LibOrder.Order memory order, uint256 takerAssetFillAmount, bytes memory signature ) public returns (LibFillResults.FillResults memory fillResults); /// @dev After calling, the order can not be filled anymore. /// @param order Order struct containing order specifications. function cancelOrder(LibOrder.Order memory order) public; /// @dev Gets information about an order: status, hash, and amount filled. /// @param order Order to gather information on. /// @return OrderInfo Information about the order and its state. /// See LibOrder.OrderInfo for a complete description. function getOrderInfo(LibOrder.Order memory order) public view returns (LibOrder.OrderInfo memory orderInfo); } // File: contracts/external/0x/Exchange/interfaces/IMatchOrders.sol /* Copyright 2018 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.7; contract IMatchOrders { /// @dev Match two complementary orders that have a profitable spread. /// Each order is filled at their respective price point. However, the calculations are /// carried out as though the orders are both being filled at the right order's price point. /// The profit made by the left order goes to the taker (who matched the two orders). /// @param leftOrder First order to match. /// @param rightOrder Second order to match. /// @param leftSignature Proof that order was created by the left maker. /// @param rightSignature Proof that order was created by the right maker. /// @return matchedFillResults Amounts filled and fees paid by maker and taker of matched orders. /// TODO: Make this function external once supported by Solidity (See Solidity Issues #3199, #1603) function matchOrders( LibOrder.Order memory leftOrder, LibOrder.Order memory rightOrder, bytes memory leftSignature, bytes memory rightSignature ) public returns (LibFillResults.MatchedFillResults memory matchedFillResults); } // File: contracts/external/0x/Exchange/interfaces/ISignatureValidator.sol /* Copyright 2018 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.7; contract ISignatureValidator { /// @dev Approves a hash on-chain using any valid signature type. /// After presigning a hash, the preSign signature type will become valid for that hash and signer. /// @param signerAddress Address that should have signed the given hash. /// @param signature Proof that the hash has been signed by signer. function preSign( bytes32 hash, address signerAddress, bytes calldata signature ) external; /// @dev Approves/unnapproves a Validator contract to verify signatures on signer's behalf. /// @param validatorAddress Address of Validator contract. /// @param approval Approval or disapproval of Validator contract. function setSignatureValidatorApproval( address validatorAddress, bool approval ) external; /// @dev Verifies that a signature is valid. /// @param hash Message hash that is signed. /// @param signerAddress Address of signer. /// @param signature Proof of signing. /// @return Validity of order signature. function isValidSignature( bytes32 hash, address signerAddress, bytes memory signature ) public view returns (bool isValid); } // File: contracts/external/0x/Exchange/interfaces/ITransactions.sol /* Copyright 2018 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.7; contract ITransactions { /// @dev Executes an exchange method call in the context of signer. /// @param salt Arbitrary number to ensure uniqueness of transaction hash. /// @param signerAddress Address of transaction signer. /// @param data AbiV2 encoded calldata. /// @param signature Proof of signer transaction by signer. function executeTransaction( uint256 salt, address signerAddress, bytes calldata data, bytes calldata signature ) external; } // File: contracts/external/0x/Exchange/interfaces/IAssetProxyDispatcher.sol /* Copyright 2018 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.7; contract IAssetProxyDispatcher { /// @dev Registers an asset proxy to an asset proxy id. /// An id can only be assigned to a single proxy at a given time. /// @param assetProxyId Id to register`newAssetProxy` under. /// @param newAssetProxy Address of new asset proxy to register, or 0x0 to unset assetProxyId. /// @param oldAssetProxy Existing asset proxy to overwrite, or 0x0 if assetProxyId is currently unused. function registerAssetProxy( bytes4 assetProxyId, address newAssetProxy, address oldAssetProxy ) external; /// @dev Gets an asset proxy. /// @param assetProxyId Id of the asset proxy. /// @return The asset proxy registered to assetProxyId. Returns 0x0 if no proxy is registered. function getAssetProxy(bytes4 assetProxyId) external view returns (address); } // File: contracts/external/0x/Exchange/interfaces/IWrapperFunctions.sol /* Copyright 2018 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.7; contract IWrapperFunctions { /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled. /// @param order LibOrder.Order struct containing order specifications. /// @param takerAssetFillAmount Desired amount of takerAsset to sell. /// @param signature Proof that order has been created by maker. function fillOrKillOrder( LibOrder.Order memory order, uint256 takerAssetFillAmount, bytes memory signature ) public returns (LibFillResults.FillResults memory fillResults); /// @dev Fills an order with specified parameters and ECDSA signature. /// Returns false if the transaction would otherwise revert. /// @param order LibOrder.Order struct containing order specifications. /// @param takerAssetFillAmount Desired amount of takerAsset to sell. /// @param signature Proof that order has been created by maker. /// @return Amounts filled and fees paid by maker and taker. function fillOrderNoThrow( LibOrder.Order memory order, uint256 takerAssetFillAmount, bytes memory signature ) public returns (LibFillResults.FillResults memory fillResults); /// @dev Synchronously executes multiple calls of fillOrder. /// @param orders Array of order specifications. /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders. /// @param signatures Proofs that orders have been created by makers. /// @return Amounts filled and fees paid by makers and taker. function batchFillOrders( LibOrder.Order[] memory orders, uint256[] memory takerAssetFillAmounts, bytes[] memory signatures ) public returns (LibFillResults.FillResults memory totalFillResults); /// @dev Synchronously executes multiple calls of fillOrKill. /// @param orders Array of order specifications. /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders. /// @param signatures Proofs that orders have been created by makers. /// @return Amounts filled and fees paid by makers and taker. function batchFillOrKillOrders( LibOrder.Order[] memory orders, uint256[] memory takerAssetFillAmounts, bytes[] memory signatures ) public returns (LibFillResults.FillResults memory totalFillResults); /// @dev Fills an order with specified parameters and ECDSA signature. /// Returns false if the transaction would otherwise revert. /// @param orders Array of order specifications. /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders. /// @param signatures Proofs that orders have been created by makers. /// @return Amounts filled and fees paid by makers and taker. function batchFillOrdersNoThrow( LibOrder.Order[] memory orders, uint256[] memory takerAssetFillAmounts, bytes[] memory signatures ) public returns (LibFillResults.FillResults memory totalFillResults); /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker. /// @param orders Array of order specifications. /// @param takerAssetFillAmount Desired amount of takerAsset to sell. /// @param signatures Proofs that orders have been created by makers. /// @return Amounts filled and fees paid by makers and taker. function marketSellOrders( LibOrder.Order[] memory orders, uint256 takerAssetFillAmount, bytes[] memory signatures ) public returns (LibFillResults.FillResults memory totalFillResults); /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker. /// Returns false if the transaction would otherwise revert. /// @param orders Array of order specifications. /// @param takerAssetFillAmount Desired amount of takerAsset to sell. /// @param signatures Proofs that orders have been signed by makers. /// @return Amounts filled and fees paid by makers and taker. function marketSellOrdersNoThrow( LibOrder.Order[] memory orders, uint256 takerAssetFillAmount, bytes[] memory signatures ) public returns (LibFillResults.FillResults memory totalFillResults); /// @dev Synchronously executes multiple calls of fillOrder until total amount of makerAsset is bought by taker. /// @param orders Array of order specifications. /// @param makerAssetFillAmount Desired amount of makerAsset to buy. /// @param signatures Proofs that orders have been signed by makers. /// @return Amounts filled and fees paid by makers and taker. function marketBuyOrders( LibOrder.Order[] memory orders, uint256 makerAssetFillAmount, bytes[] memory signatures ) public returns (LibFillResults.FillResults memory totalFillResults); /// @dev Synchronously executes multiple fill orders in a single transaction until total amount is bought by taker. /// Returns false if the transaction would otherwise revert. /// @param orders Array of order specifications. /// @param makerAssetFillAmount Desired amount of makerAsset to buy. /// @param signatures Proofs that orders have been signed by makers. /// @return Amounts filled and fees paid by makers and taker. function marketBuyOrdersNoThrow( LibOrder.Order[] memory orders, uint256 makerAssetFillAmount, bytes[] memory signatures ) public returns (LibFillResults.FillResults memory totalFillResults); /// @dev Synchronously cancels multiple orders in a single transaction. /// @param orders Array of order specifications. function batchCancelOrders(LibOrder.Order[] memory orders) public; } // File: contracts/external/0x/Exchange/interfaces/IExchange.sol /* Copyright 2018 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.7; contract IExchange is IExchangeCore, IMatchOrders, ISignatureValidator, ITransactions, IAssetProxyDispatcher, IWrapperFunctions {} // File: contracts/core/exchange-wrappers/lib/ZeroExOrderLibrary.sol /* Copyright 2018 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.7; /** * @title ZeroExOrderLibrary * @author Set Protocol * * This library contains functions and structs to assist with parsing 0x wrapper order data * * The layout of each wrapper order is in the table below. "ordersData" always refers to one or more byte strings, * each containing all of these columns concatenated together. Each of the parse methods (header/body) below takes * the entire ordersData along with an offset to parse the next (header/body) specified by the offset. This saves * from having to do redudant memCopies to isolate the bytes containing the data to parse. * * | Section | Data | Offset | Length | Contents | * |---------|-----------------------|---------------------|-----------------|-------------------------------| * | Header | signatureLength | 0 | 32 | Num Bytes of 0x Signature | * | | fillAmount | 32 | 64 | Taker asset fill amouint | * | Body | signature | 64 | signatureLength | Signature in bytes | * | | order | 64+signatureLength | 384 | ZeroEx Order | */ library ZeroExOrderLibrary { using LibBytes for bytes; using SafeMath for uint256; // ============ Structs ============ struct OrderHeader { uint256 signatureLength; uint256 fillAmount; bytes signature; } struct ZeroExOrderInformation { OrderHeader header; LibOrder.Order order; address makerToken; address takerToken; } // ============ Internal Functions ============ /* * Parses the header from order byte array * Can only be called by authorized contracts. * * @param _ordersData Byte array of order data * @param _offset Offset to start scanning for order header * @return OrderHeader Struct containing wrapper order header data */ function parseOrderHeader( bytes memory _ordersData, uint256 _offset ) internal pure returns (OrderHeader memory) { OrderHeader memory header; uint256 orderDataStart = _ordersData.contentAddress().add(_offset); assembly { mstore(header, mload(orderDataStart)) // signatureLength mstore(add(header, 32), mload(add(orderDataStart, 32))) // fillAmount } return header; } /* * Parses the bytes array into ZeroEx order * * | Data | Location | * |----------------------------|-------------------------------| * | makerAddress | 0 | * | takerAddress | 32 | * | feeRecipientAddress | 64 | * | senderAddress | 96 | * | makerAssetAmount | 128 | * | takerAssetAmount | 160 | * | makerFee | 192 | * | takerFee | 224 | * | expirationTimeSeconds | 256 | * | salt | 288 | * | makerToken | 320 | * | takerToken | 352 | * * @param _ordersData Byte array of (multiple) 0x wrapper orders * @param _offset Offset to start scanning for 0x order body * @return LibOrder.Order 0x order struct */ function parseZeroExOrder( bytes memory _ordersData, uint256 _offset ) internal pure returns (LibOrder.Order memory) { LibOrder.Order memory order; address makerTokenAddress; address takerTokenAddress; uint256 orderDataStart = _ordersData.contentAddress().add(_offset); assembly { mstore(order, mload(orderDataStart)) // maker mstore(add(order, 32), mload(add(orderDataStart, 32))) // taker mstore(add(order, 64), mload(add(orderDataStart, 64))) // feeRecipient mstore(add(order, 96), mload(add(orderDataStart, 96))) // senderAddress mstore(add(order, 128), mload(add(orderDataStart, 128))) // makerAssetAmount mstore(add(order, 160), mload(add(orderDataStart, 160))) // takerAssetAmount mstore(add(order, 192), mload(add(orderDataStart, 192))) // makerFee mstore(add(order, 224), mload(add(orderDataStart, 224))) // takerFee mstore(add(order, 256), mload(add(orderDataStart, 256))) // expirationUnixTimestampSec mstore(add(order, 288), mload(add(orderDataStart, 288))) // salt makerTokenAddress := mload(add(orderDataStart, 320)) // makerToken takerTokenAddress := mload(add(orderDataStart, 352)) // takerToken } order.makerAssetData = tokenAddressToAssetData(makerTokenAddress); order.takerAssetData = tokenAddressToAssetData(takerTokenAddress); return order; } /* * Parses the maker token from the ZeroEx order * * @param _ordersData Byte array of (multiple) 0x wrapper orders * @param _offset Offset to start scanning for 0x order body * @return makerTokenAddress */ function parseMakerTokenFromZeroExOrder( bytes memory _ordersData, uint256 _offset ) internal pure returns (address) { address makerTokenAddress; uint256 orderDataStart = _ordersData.contentAddress().add(_offset); assembly { makerTokenAddress := mload(add(orderDataStart, 320)) // makerToken } return makerTokenAddress; } /* * Parses the taker token from the ZeroEx order * * @param _ordersData Byte array of (multiple) 0x wrapper orders * @param _offset Offset to start scanning for 0x order body * @return takerTokenAddress */ function parseTakerTokenFromZeroExOrder( bytes memory _ordersData, uint256 _offset ) internal pure returns (address) { address takerTokenAddress; uint256 orderDataStart = _ordersData.contentAddress().add(_offset); assembly { takerTokenAddress := mload(add(orderDataStart, 352)) // takerToken } return takerTokenAddress; } /* * Encodes an ERC20 token address into 0x asset data * * @param _tokenAddress Address of token to encode into 0x asset data * @return bytes 0x asset data representation of a token */ function tokenAddressToAssetData( address _tokenAddress ) private pure returns (bytes memory) { bytes memory result = new bytes(36); // padded version of bytes4(keccak256("ERC20Token(address)")); bytes32 selector = 0xf47261b000000000000000000000000000000000000000000000000000000000; assembly { mstore(add(result, 32), selector) mstore(add(result, 36), _tokenAddress) } return result; } } // File: core/exchange-wrappers/ZeroExExchangeWrapper.sol /* Copyright 2018 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.5.7; /** * @title ZeroExExchangeWrapper * @author Set Protocol * * The ZeroExExchangeWrapper contract wrapper to interface with 0x V2 */ contract ZeroExExchangeWrapper { using LibBytes for bytes; using SafeMath for uint256; /* ============ State Variables ============ */ address public core; address public zeroExExchange; address public zeroExProxy; address public zeroExToken; address public setTransferProxy; /* ============ Constructor ============ */ /** * Initialize exchange wrapper with required addresses to facilitate 0x orders * * @param _core Deployed Core contract * @param _zeroExExchange 0x Exchange contract for filling orders * @param _zeroExProxy 0x Proxy contract for transferring * @param _zeroExToken ZRX token contract addressed used for 0x relayer fees * @param _setTransferProxy Set Protocol transfer proxy contract */ constructor( address _core, address _zeroExExchange, address _zeroExProxy, address _zeroExToken, address _setTransferProxy ) public { core = _core; zeroExExchange = _zeroExExchange; zeroExProxy = _zeroExProxy; zeroExToken = _zeroExToken; setTransferProxy = _setTransferProxy; // Approve transfer of 0x token from this wrapper in the event of zeroExOrder relayer fees ERC20Wrapper.approve( _zeroExToken, _zeroExProxy, CommonMath.maxUInt256() ); } /* ============ Public Functions ============ */ /** * Parses 0x exchange orders and executes them for Set component tokens * * * @param _exchangeData Standard exchange wrapper interface object containing exchange metadata * @param _ordersData Arbitrary bytes data for any information to pass to the exchange * @return ExchangeWrapperLibrary.ExchangeResults Struct containing component acquisition results */ function exchange( ExchangeWrapperLibrary.ExchangeData memory _exchangeData, bytes memory _ordersData ) public returns (ExchangeWrapperLibrary.ExchangeResults memory) { require( ICore(core).validModules(msg.sender), "ZeroExExchangeWrapper.exchange: Sender must be approved module" ); uint256 tradesCount = _exchangeData.orderCount; address[] memory sendTokens = new address[](tradesCount); address[] memory receiveTokens = new address[](tradesCount); uint256[] memory receiveTokenAmounts = new uint256[](tradesCount); uint256 scannedBytes = 0; for (uint256 i = 0; i < _exchangeData.orderCount; i++) { ZeroExOrderLibrary.ZeroExOrderInformation memory orderInformation; uint256 orderBodyStart; // Parse order i's information (orderInformation, orderBodyStart) = parseOrderInformation( _ordersData, scannedBytes ); // Track the send tokens to ensure any leftovers are returned to the user sendTokens[i] = orderInformation.takerToken; // Fill the order via the 0x exchange (receiveTokens[i], receiveTokenAmounts[i]) = fillZeroExOrder( _exchangeData.caller, orderInformation ); // Ensure the received token can be transfered via the Set transfer proxy ERC20Wrapper.ensureAllowance( receiveTokens[i], address(this), setTransferProxy, receiveTokenAmounts[i] ); // Update current bytes scannedBytes = orderBodyStart.add(384); } // Return leftover send tokens to the original caller ExchangeWrapperLibrary.returnLeftoverSendTokens( sendTokens, _exchangeData.caller ); return ExchangeWrapperLibrary.ExchangeResults({ receiveTokens: receiveTokens, receiveTokenAmounts: receiveTokenAmounts }); } /* ============ Private ============ */ /** * Parses and executes 0x order from orders data bytes * * @param _caller Address of user issuing or redeeming using 0x orders * @param _orderInformation Object with parsed 0x order, signature, header, and maker/taker tokens * @return address Address of set component (0x makerToken) in 0x order * @return uint256 Amount of 0x order makerTokenAmount received */ function fillZeroExOrder( address _caller, ZeroExOrderLibrary.ZeroExOrderInformation memory _orderInformation ) private returns (address, uint256) { LibOrder.Order memory order = _orderInformation.order; ZeroExOrderLibrary.OrderHeader memory header = _orderInformation.header; // Ensure the taker token is allowed to be transferred by ZeroEx Proxy ERC20Wrapper.ensureAllowance( _orderInformation.takerToken, address(this), zeroExProxy, order.takerAssetAmount ); // Calculate actual fill amount uint256 zeroExFillAmount = header.fillAmount; // Tranfer ZRX fee from taker if applicable if (order.takerFee > 0) { transferRelayerFee( order.takerFee, order.takerAssetAmount, _caller, zeroExFillAmount ); } // Fill 0x order via their Exchange contract LibFillResults.FillResults memory fillResults = IExchange(zeroExExchange).fillOrKillOrder( order, zeroExFillAmount, header.signature ); return ( _orderInformation.makerToken, fillResults.makerAssetFilledAmount ); } /** * Transfers fees from the caller to this wrapper in the event of taker relayer fees on the 0x order * * @param _takerFee Taker fee of the 0x order * @param _takerAssetAmount Taker asset of the original * @param _caller Address of original caller who is supploying ZRX * @param _fillAmount Amount of takerAssetAmount to fill to calculate partial fee */ function transferRelayerFee( uint256 _takerFee, uint256 _takerAssetAmount, address _caller, uint256 _fillAmount ) private { // Calculate amount of taker fee to transfer if fill quantity of 0x order is not for the full takerAssetAmount uint256 takerFeeToTransfer = CommonMath.getPartialAmount( _takerFee, _fillAmount, _takerAssetAmount ); // Transfer ZRX from the caller to this wrapper ERC20Wrapper.transferFrom( zeroExToken, _caller, address(this), takerFeeToTransfer ); } /** * Parses 0x order and returns order with offset in bytestring to parse next order * * @param _ordersData Arbitrary bytes data for any information to pass to the exchange * @param _offset Where to start the parsing of the _ordersData bytestring * @return ZeroExOrderInformation Object with parsed 0x order, signature, header, and maker/taker tokens * @return uint256 Tracks how many bytes in _ordersData have been parsed */ function parseOrderInformation( bytes memory _ordersData, uint256 _offset ) private pure returns (ZeroExOrderLibrary.ZeroExOrderInformation memory, uint256) { // Parse header of current wrapper order ZeroExOrderLibrary.OrderHeader memory header = ZeroExOrderLibrary.parseOrderHeader( _ordersData, _offset ); // Helper to reduce math, keeping the position of the start of the next 0x order body uint256 orderBodyStart = _offset.add(header.signatureLength).add(64); // Grab signature of current wrapper order after the header of length 64 and before the start of the body header.signature = _ordersData.slice( _offset.add(64), orderBodyStart ); // Parse 0x order of current wrapper order LibOrder.Order memory order = ZeroExOrderLibrary.parseZeroExOrder(_ordersData, orderBodyStart); address makerToken = ZeroExOrderLibrary.parseMakerTokenFromZeroExOrder(_ordersData, orderBodyStart); address takerToken = ZeroExOrderLibrary.parseTakerTokenFromZeroExOrder(_ordersData, orderBodyStart); ZeroExOrderLibrary.ZeroExOrderInformation memory orderInformation = ZeroExOrderLibrary.ZeroExOrderInformation({ header: header, order: order, makerToken: makerToken, takerToken: takerToken }); return (orderInformation, orderBodyStart); } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"constant":true,"inputs":[],"name":"zeroExExchange","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"setTransferProxy","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"components":[{"name":"caller","type":"address"},{"name":"orderCount","type":"uint256"}],"name":"_exchangeData","type":"tuple"},{"name":"_ordersData","type":"bytes"}],"name":"exchange","outputs":[{"components":[{"name":"receiveTokens","type":"address[]"},{"name":"receiveTokenAmounts","type":"uint256[]"}],"name":"","type":"tuple"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"zeroExToken","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"zeroExProxy","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"core","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_core","type":"address"},{"name":"_zeroExExchange","type":"address"},{"name":"_zeroExProxy","type":"address"},{"name":"_zeroExToken","type":"address"},{"name":"_setTransferProxy","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}]
Contract Creation Code
60806040523480156200001157600080fd5b5060405160a08062001a1a833981018060405262000033919081019062000222565b60008054600160a060020a0319908116600160a060020a038881169190911790925560018054821687841617905560028054821686841617905560038054821685841617905560048054909116918316919091179055620000bb8284620000a7640100000000620000c6810262000a521704565b64010000000062000a58620000cc82021704565b5050505050620003a2565b60001990565b6040517f095ea7b3000000000000000000000000000000000000000000000000000000008152600160a060020a0384169063095ea7b39062000115908590859060040162000348565b602060405180830381600087803b1580156200013057600080fd5b505af115801562000145573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506200016b9190810190620002a2565b506200017f640100000000620001c6810204565b620001c1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620001b89062000367565b60405180910390fd5b505050565b6000803d8015620001e05760208114620001ea57620001f6565b60019150620001f6565b60206000803e60005191505b50600114905090565b60006200020d825162000388565b9392505050565b60006200020d82516200039d565b600080600080600060a086880312156200023b57600080fd5b6000620002498888620001ff565b95505060206200025c88828901620001ff565b94505060406200026f88828901620001ff565b93505060606200028288828901620001ff565b92505060806200029588828901620001ff565b9150509295509295909350565b600060208284031215620002b557600080fd5b6000620002c3848462000214565b949350505050565b620002d68162000388565b82525050565b6000620002eb6026836200037f565b7f4552433230577261707065722e617070726f76653a204261642072657475726e81527f2076616c75650000000000000000000000000000000000000000000000000000602082015260400192915050565b620002d6816200039a565b60408101620003588285620002cb565b6200020d60208301846200033d565b602080825281016200037981620002dc565b92915050565b90815260200190565b6000600160a060020a03821662000379565b90565b151590565b61166880620003b26000396000f3fe608060405234801561001057600080fd5b50600436106100655760e060020a60003504630b2d45aa811461006a5780633f80cff814610088578063c58c1db814610090578063dfa08b6a146100b0578063e6d39541146100b8578063f2f4eb26146100c0575b600080fd5b6100726100c8565b60405161007f9190611420565b60405180910390f35b6100726100d7565b6100a361009e366004610fb5565b6100e6565b60405161007f919061151f565b61007261037a565b610072610389565b610072610398565b600154600160a060020a031681565b600454600160a060020a031681565b6100ee610d40565b6000546040517f5e633498000000000000000000000000000000000000000000000000000000008152600160a060020a0390911690635e6334989061013790339060040161142e565b60206040518083038186803b15801561014f57600080fd5b505afa158015610163573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506101879190810190610f97565b6101af5760405160e560020a62461bcd0281526004016101a6906114cf565b60405180910390fd5b6000836020015190506060816040519080825280602002602001820160405280156101e4578160200160208202803883390190505b509050606082604051908082528060200260200182016040528015610213578160200160208202803883390190505b509050606083604051908082528060200260200182016040528015610242578160200160208202803883390190505b5090506000805b886020015181101561034d5761025d610d5a565b60006102698a856103a7565b8092508193505050816060015187848151811061028257fe5b600160a060020a03909216602092830291909101909101528a516102a69083610489565b8785815181106102b257fe5b602002602001018786815181106102c557fe5b602002602001018281525082600160a060020a0316600160a060020a0316815250505061032f8684815181106102f757fe5b602002602001015130600460009054906101000a9004600160a060020a031688878151811061032257fe5b60200260200101516105ad565b6103418161018063ffffffff6105dd16565b93505050600101610249565b5061035c8489600001516105f6565b50604080518082019091529182526020820152925050505b92915050565b600354600160a060020a031681565b600254600160a060020a031681565b600054600160a060020a031681565b6103af610d5a565b60006103b9610d8f565b6103c3858561073b565b905060006103ef60406103e38460000151886105dd90919063ffffffff16565b9063ffffffff6105dd16565b905061041361040586604063ffffffff6105dd16565b87908363ffffffff61077016565b6040830152610420610db0565b61042a8783610807565b9050600061043888846108c6565b9050600061044689856108e6565b9050610450610d5a565b50604080516080810182529586526020860193909352600160a060020a0391821692850192909252166060830152909590945092505050565b600080610494610db0565b5060208301516104a2610d8f565b508351606085015160025460a08401516104ca92913091600160a060020a03909116906105ad565b602081015160e0830151156104ed576104ed8360e001518460a001518984610906565b6104f5610e35565b60015460408085015190517f64a3bc15000000000000000000000000000000000000000000000000000000008152600160a060020a03909216916364a3bc15916105459188918791600401611530565b608060405180830381600087803b15801561055f57600080fd5b505af1158015610573573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506105979190810190611007565b6040979097015196519698969750505050505050565b60006105ba8585856109b0565b9050818110156105d6576105d685846105d1610a52565b610a58565b5050505050565b6000828201838110156105ef57600080fd5b9392505050565b60005b825181101561073657600073eadada7c6943c223c0d4bea475a6dacc7368f8d663f7888aec85848151811061062a57fe5b6020026020010151306040518363ffffffff1660e060020a02815260040161065392919061143c565b60206040518083038186803b15801561066b57600080fd5b505af415801561067f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506106a39190810190611025565b9050801561072d5773eadada7c6943c223c0d4bea475a6dacc7368f8d663beabacc88584815181106106d157fe5b602002602001015185846040518463ffffffff1660e060020a0281526004016106fc9392919061148c565b60006040518083038186803b15801561071457600080fd5b505af4158015610728573d6000803e3d6000fd5b505050505b506001016105f9565b505050565b610743610d8f565b61074b610d8f565b600061075a846103e387610b19565b8051835260209081015190830152509392505050565b6060818311156107955760405160e560020a62461bcd0281526004016101a6906114df565b83518211156107b95760405160e560020a62461bcd0281526004016101a6906114ef565b8282036040519080825280601f01601f1916602001820160405280156107e6576020820181803883390190505b5090506105ef6107f582610b19565b846107ff87610b19565b018351610b1f565b61080f610db0565b610817610db0565b6000806000610829866103e389610b19565b9050805184526020810151602085015260408101516040850152606081015160608501526080810151608085015260a081015160a085015260c081015160c085015260e081015160e0850152610100810151610100850152610120810151610120850152610140810151925061016081015191506108a683610bc4565b6101408501526108b582610bc4565b610160850152509195945050505050565b60008060006108d8846103e387610b19565b610140015195945050505050565b60008060006108f8846103e387610b19565b610160015195945050505050565b6000610913858386610c19565b6003546040517f15dacbea00000000000000000000000000000000000000000000000000000000815291925073eadada7c6943c223c0d4bea475a6dacc7368f8d6916315dacbea9161097991600160a060020a0390911690879030908790600401611457565b60006040518083038186803b15801561099157600080fd5b505af41580156109a5573d6000803e3d6000fd5b505050505050505050565b6040517fdd62ed3e000000000000000000000000000000000000000000000000000000008152600090600160a060020a0385169063dd62ed3e906109fa908690869060040161143c565b60206040518083038186803b158015610a1257600080fd5b505afa158015610a26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610a4a9190810190611025565b949350505050565b60001990565b6040517f095ea7b3000000000000000000000000000000000000000000000000000000008152600160a060020a0384169063095ea7b390610a9f90859085906004016114b4565b602060405180830381600087803b158015610ab957600080fd5b505af1158015610acd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610af19190810190610f97565b50610afa610cc2565b6107365760405160e560020a62461bcd0281526004016101a6906114ff565b60200190565b6020811015610b49576001816020036101000a038019835116818551168082178652505050610736565b82821415610b5657610736565b82821115610b905760208103905080820181840181515b82851015610b88578451865260209586019590940193610b6d565b905250610736565b60208103905080820181840183515b81861215610bbb5782518252601f199283019290910190610b9f565b85525050505050565b604080516024808252606082810190935282919060208201818038833950507ff47261b00000000000000000000000000000000000000000000000000000000060208301525060248101939093525090919050565b6000808280610c2457fe5b848609905080610c5657610c4e83610c42878763ffffffff610cf716565b9063ffffffff610d1e16565b9150506105ef565b6000610c7e610c6b868863ffffffff610cf716565b610c4284620f424063ffffffff610cf716565b90506103e88110610ca45760405160e560020a62461bcd0281526004016101a69061150f565b610cb884610c42888863ffffffff610cf716565b9695505050505050565b6000803d8015610cd95760208114610ce257610cee565b60019150610cee565b60206000803e60005191505b50600114905090565b600082610d0657506000610374565b82820282848281610d1357fe5b04146105ef57600080fd5b6000808211610d2c57600080fd5b6000828481610d3757fe5b04949350505050565b604051806040016040528060608152602001606081525090565b604051806102200160405280610d6e610d8f565b8152602001610d7b610db0565b815260006020820181905260409091015290565b60405180606001604052806000815260200160008152602001606081525090565b6040518061018001604052806000600160a060020a031681526020016000600160a060020a031681526020016000600160a060020a031681526020016000600160a060020a0316815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160608152602001606081525090565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b60006105ef82356115be565b60006105ef82516115d2565b600082601f830112610e8657600080fd5b8135610e99610e9482611589565b611562565b91508082526020830160208301858383011115610eb557600080fd5b610ec08382846115e8565b50505092915050565b600060408284031215610edb57600080fd5b610ee56040611562565b90506000610ef38484610e5d565b8252506020610f0484848301610f7f565b60208301525092915050565b600060808284031215610f2257600080fd5b610f2c6080611562565b90506000610f3a8484610f8b565b8252506020610f4b84848301610f8b565b6020830152506040610f5f84828501610f8b565b6040830152506060610f7384828501610f8b565b60608301525092915050565b60006105ef82356115cf565b60006105ef82516115cf565b600060208284031215610fa957600080fd5b6000610a4a8484610e69565b60008060608385031215610fc857600080fd5b6000610fd48585610ec9565b925050604083013567ffffffffffffffff811115610ff157600080fd5b610ffd85828601610e75565b9150509250929050565b60006080828403121561101957600080fd5b6000610a4a8484610f10565b60006020828403121561103757600080fd5b6000610a4a8484610f8b565b600061104f8383611072565b505060200190565b600061104f8383611417565b61106c816115d7565b82525050565b61106c816115be565b6000611086826115b1565b61109081856115b5565b935061109b83610b19565b60005b828110156110c6576110b1868351611043565b95506110bc82610b19565b915060010161109e565b5093949350505050565b60006110db826115b1565b6110e581856115b5565b93506110f083610b19565b60005b828110156110c657611106868351611057565b955061111182610b19565b91506001016110f3565b6000611126826115b1565b61113081856115b5565b93506111408185602086016115f4565b61114981611624565b9093019392505050565b6000611160603e836115b5565b7f5a65726f457845786368616e6765577261707065722e65786368616e67653a2081527f53656e646572206d75737420626520617070726f766564206d6f64756c650000602082015260400192915050565b60006111bf601a836115b5565b7f46524f4d5f4c4553535f5448414e5f544f5f5245515549524544000000000000815260200192915050565b60006111f8601c836115b5565b7f544f5f4c4553535f5448414e5f4c454e4754485f524551554952454400000000815260200192915050565b60006112316026836115b5565b7f4552433230577261707065722e617070726f76653a204261642072657475726e81527f2076616c75650000000000000000000000000000000000000000000000000000602082015260400192915050565b6000611290603a836115b5565b7f436f6d6d6f6e4d6174682e6765745061727469616c416d6f756e743a20526f7581527f6e64696e67206572726f72206578636565647320626f756e6473000000000000602082015260400192915050565b80516040808452600091908401906112fa828261107b565b9150506020830151848203602086015261131482826110d0565b95945050505050565b80516000906101808401906113328582611072565b5060208301516113456020860182611072565b5060408301516113586040860182611072565b50606083015161136b6060860182611072565b50608083015161137e6080860182611417565b5060a083015161139160a0860182611417565b5060c08301516113a460c0860182611417565b5060e08301516113b760e0860182611417565b506101008301516113cc610100860182611417565b506101208301516113e1610120860182611417565b506101408301518482036101408601526113fb828261111b565b915050610160830151848203610160860152611314828261111b565b61106c816115cf565b602081016103748284611072565b602081016103748284611063565b6040810161144a8285611072565b6105ef6020830184611072565b608081016114658287611072565b6114726020830186611072565b61147f6040830185611072565b6113146060830184611417565b6060810161149a8286611072565b6114a76020830185611072565b610a4a6040830184611417565b604081016114c28285611072565b6105ef6020830184611417565b6020808252810161037481611153565b60208082528101610374816111b2565b60208082528101610374816111eb565b6020808252810161037481611224565b6020808252810161037481611283565b602080825281016105ef81846112e2565b60608082528101611541818661131d565b90506115506020830185611417565b8181036040830152611314818461111b565b60405181810167ffffffffffffffff8111828210171561158157600080fd5b604052919050565b600067ffffffffffffffff8211156115a057600080fd5b506020601f91909101601f19160190565b5190565b90815260200190565b6000600160a060020a038216610374565b90565b151590565b6000610374826000610374826115be565b82818337506000910152565b60005b8381101561160f5781810151838201526020016115f7565b8381111561161e576000848401525b50505050565b601f01601f19169056fea265627a7a72305820e93d9cc4e962d61b0eb9c715faa69abe238b951e8d8d1fee047923af4cadac1d6c6578706572696d656e74616cf50037000000000000000000000000f55186cc537e7067ea616f2aae007b4427a120c8000000000000000000000000080bf510fcbf18b91105470639e956102293771200000000000000000000000095e6f48254609a6ee006f7d493c8e5fb97094cef000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498000000000000000000000000882d80d3a191859d64477eb78cca46599307ec1c
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100655760e060020a60003504630b2d45aa811461006a5780633f80cff814610088578063c58c1db814610090578063dfa08b6a146100b0578063e6d39541146100b8578063f2f4eb26146100c0575b600080fd5b6100726100c8565b60405161007f9190611420565b60405180910390f35b6100726100d7565b6100a361009e366004610fb5565b6100e6565b60405161007f919061151f565b61007261037a565b610072610389565b610072610398565b600154600160a060020a031681565b600454600160a060020a031681565b6100ee610d40565b6000546040517f5e633498000000000000000000000000000000000000000000000000000000008152600160a060020a0390911690635e6334989061013790339060040161142e565b60206040518083038186803b15801561014f57600080fd5b505afa158015610163573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506101879190810190610f97565b6101af5760405160e560020a62461bcd0281526004016101a6906114cf565b60405180910390fd5b6000836020015190506060816040519080825280602002602001820160405280156101e4578160200160208202803883390190505b509050606082604051908082528060200260200182016040528015610213578160200160208202803883390190505b509050606083604051908082528060200260200182016040528015610242578160200160208202803883390190505b5090506000805b886020015181101561034d5761025d610d5a565b60006102698a856103a7565b8092508193505050816060015187848151811061028257fe5b600160a060020a03909216602092830291909101909101528a516102a69083610489565b8785815181106102b257fe5b602002602001018786815181106102c557fe5b602002602001018281525082600160a060020a0316600160a060020a0316815250505061032f8684815181106102f757fe5b602002602001015130600460009054906101000a9004600160a060020a031688878151811061032257fe5b60200260200101516105ad565b6103418161018063ffffffff6105dd16565b93505050600101610249565b5061035c8489600001516105f6565b50604080518082019091529182526020820152925050505b92915050565b600354600160a060020a031681565b600254600160a060020a031681565b600054600160a060020a031681565b6103af610d5a565b60006103b9610d8f565b6103c3858561073b565b905060006103ef60406103e38460000151886105dd90919063ffffffff16565b9063ffffffff6105dd16565b905061041361040586604063ffffffff6105dd16565b87908363ffffffff61077016565b6040830152610420610db0565b61042a8783610807565b9050600061043888846108c6565b9050600061044689856108e6565b9050610450610d5a565b50604080516080810182529586526020860193909352600160a060020a0391821692850192909252166060830152909590945092505050565b600080610494610db0565b5060208301516104a2610d8f565b508351606085015160025460a08401516104ca92913091600160a060020a03909116906105ad565b602081015160e0830151156104ed576104ed8360e001518460a001518984610906565b6104f5610e35565b60015460408085015190517f64a3bc15000000000000000000000000000000000000000000000000000000008152600160a060020a03909216916364a3bc15916105459188918791600401611530565b608060405180830381600087803b15801561055f57600080fd5b505af1158015610573573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506105979190810190611007565b6040979097015196519698969750505050505050565b60006105ba8585856109b0565b9050818110156105d6576105d685846105d1610a52565b610a58565b5050505050565b6000828201838110156105ef57600080fd5b9392505050565b60005b825181101561073657600073eadada7c6943c223c0d4bea475a6dacc7368f8d663f7888aec85848151811061062a57fe5b6020026020010151306040518363ffffffff1660e060020a02815260040161065392919061143c565b60206040518083038186803b15801561066b57600080fd5b505af415801561067f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506106a39190810190611025565b9050801561072d5773eadada7c6943c223c0d4bea475a6dacc7368f8d663beabacc88584815181106106d157fe5b602002602001015185846040518463ffffffff1660e060020a0281526004016106fc9392919061148c565b60006040518083038186803b15801561071457600080fd5b505af4158015610728573d6000803e3d6000fd5b505050505b506001016105f9565b505050565b610743610d8f565b61074b610d8f565b600061075a846103e387610b19565b8051835260209081015190830152509392505050565b6060818311156107955760405160e560020a62461bcd0281526004016101a6906114df565b83518211156107b95760405160e560020a62461bcd0281526004016101a6906114ef565b8282036040519080825280601f01601f1916602001820160405280156107e6576020820181803883390190505b5090506105ef6107f582610b19565b846107ff87610b19565b018351610b1f565b61080f610db0565b610817610db0565b6000806000610829866103e389610b19565b9050805184526020810151602085015260408101516040850152606081015160608501526080810151608085015260a081015160a085015260c081015160c085015260e081015160e0850152610100810151610100850152610120810151610120850152610140810151925061016081015191506108a683610bc4565b6101408501526108b582610bc4565b610160850152509195945050505050565b60008060006108d8846103e387610b19565b610140015195945050505050565b60008060006108f8846103e387610b19565b610160015195945050505050565b6000610913858386610c19565b6003546040517f15dacbea00000000000000000000000000000000000000000000000000000000815291925073eadada7c6943c223c0d4bea475a6dacc7368f8d6916315dacbea9161097991600160a060020a0390911690879030908790600401611457565b60006040518083038186803b15801561099157600080fd5b505af41580156109a5573d6000803e3d6000fd5b505050505050505050565b6040517fdd62ed3e000000000000000000000000000000000000000000000000000000008152600090600160a060020a0385169063dd62ed3e906109fa908690869060040161143c565b60206040518083038186803b158015610a1257600080fd5b505afa158015610a26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610a4a9190810190611025565b949350505050565b60001990565b6040517f095ea7b3000000000000000000000000000000000000000000000000000000008152600160a060020a0384169063095ea7b390610a9f90859085906004016114b4565b602060405180830381600087803b158015610ab957600080fd5b505af1158015610acd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610af19190810190610f97565b50610afa610cc2565b6107365760405160e560020a62461bcd0281526004016101a6906114ff565b60200190565b6020811015610b49576001816020036101000a038019835116818551168082178652505050610736565b82821415610b5657610736565b82821115610b905760208103905080820181840181515b82851015610b88578451865260209586019590940193610b6d565b905250610736565b60208103905080820181840183515b81861215610bbb5782518252601f199283019290910190610b9f565b85525050505050565b604080516024808252606082810190935282919060208201818038833950507ff47261b00000000000000000000000000000000000000000000000000000000060208301525060248101939093525090919050565b6000808280610c2457fe5b848609905080610c5657610c4e83610c42878763ffffffff610cf716565b9063ffffffff610d1e16565b9150506105ef565b6000610c7e610c6b868863ffffffff610cf716565b610c4284620f424063ffffffff610cf716565b90506103e88110610ca45760405160e560020a62461bcd0281526004016101a69061150f565b610cb884610c42888863ffffffff610cf716565b9695505050505050565b6000803d8015610cd95760208114610ce257610cee565b60019150610cee565b60206000803e60005191505b50600114905090565b600082610d0657506000610374565b82820282848281610d1357fe5b04146105ef57600080fd5b6000808211610d2c57600080fd5b6000828481610d3757fe5b04949350505050565b604051806040016040528060608152602001606081525090565b604051806102200160405280610d6e610d8f565b8152602001610d7b610db0565b815260006020820181905260409091015290565b60405180606001604052806000815260200160008152602001606081525090565b6040518061018001604052806000600160a060020a031681526020016000600160a060020a031681526020016000600160a060020a031681526020016000600160a060020a0316815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160608152602001606081525090565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b60006105ef82356115be565b60006105ef82516115d2565b600082601f830112610e8657600080fd5b8135610e99610e9482611589565b611562565b91508082526020830160208301858383011115610eb557600080fd5b610ec08382846115e8565b50505092915050565b600060408284031215610edb57600080fd5b610ee56040611562565b90506000610ef38484610e5d565b8252506020610f0484848301610f7f565b60208301525092915050565b600060808284031215610f2257600080fd5b610f2c6080611562565b90506000610f3a8484610f8b565b8252506020610f4b84848301610f8b565b6020830152506040610f5f84828501610f8b565b6040830152506060610f7384828501610f8b565b60608301525092915050565b60006105ef82356115cf565b60006105ef82516115cf565b600060208284031215610fa957600080fd5b6000610a4a8484610e69565b60008060608385031215610fc857600080fd5b6000610fd48585610ec9565b925050604083013567ffffffffffffffff811115610ff157600080fd5b610ffd85828601610e75565b9150509250929050565b60006080828403121561101957600080fd5b6000610a4a8484610f10565b60006020828403121561103757600080fd5b6000610a4a8484610f8b565b600061104f8383611072565b505060200190565b600061104f8383611417565b61106c816115d7565b82525050565b61106c816115be565b6000611086826115b1565b61109081856115b5565b935061109b83610b19565b60005b828110156110c6576110b1868351611043565b95506110bc82610b19565b915060010161109e565b5093949350505050565b60006110db826115b1565b6110e581856115b5565b93506110f083610b19565b60005b828110156110c657611106868351611057565b955061111182610b19565b91506001016110f3565b6000611126826115b1565b61113081856115b5565b93506111408185602086016115f4565b61114981611624565b9093019392505050565b6000611160603e836115b5565b7f5a65726f457845786368616e6765577261707065722e65786368616e67653a2081527f53656e646572206d75737420626520617070726f766564206d6f64756c650000602082015260400192915050565b60006111bf601a836115b5565b7f46524f4d5f4c4553535f5448414e5f544f5f5245515549524544000000000000815260200192915050565b60006111f8601c836115b5565b7f544f5f4c4553535f5448414e5f4c454e4754485f524551554952454400000000815260200192915050565b60006112316026836115b5565b7f4552433230577261707065722e617070726f76653a204261642072657475726e81527f2076616c75650000000000000000000000000000000000000000000000000000602082015260400192915050565b6000611290603a836115b5565b7f436f6d6d6f6e4d6174682e6765745061727469616c416d6f756e743a20526f7581527f6e64696e67206572726f72206578636565647320626f756e6473000000000000602082015260400192915050565b80516040808452600091908401906112fa828261107b565b9150506020830151848203602086015261131482826110d0565b95945050505050565b80516000906101808401906113328582611072565b5060208301516113456020860182611072565b5060408301516113586040860182611072565b50606083015161136b6060860182611072565b50608083015161137e6080860182611417565b5060a083015161139160a0860182611417565b5060c08301516113a460c0860182611417565b5060e08301516113b760e0860182611417565b506101008301516113cc610100860182611417565b506101208301516113e1610120860182611417565b506101408301518482036101408601526113fb828261111b565b915050610160830151848203610160860152611314828261111b565b61106c816115cf565b602081016103748284611072565b602081016103748284611063565b6040810161144a8285611072565b6105ef6020830184611072565b608081016114658287611072565b6114726020830186611072565b61147f6040830185611072565b6113146060830184611417565b6060810161149a8286611072565b6114a76020830185611072565b610a4a6040830184611417565b604081016114c28285611072565b6105ef6020830184611417565b6020808252810161037481611153565b60208082528101610374816111b2565b60208082528101610374816111eb565b6020808252810161037481611224565b6020808252810161037481611283565b602080825281016105ef81846112e2565b60608082528101611541818661131d565b90506115506020830185611417565b8181036040830152611314818461111b565b60405181810167ffffffffffffffff8111828210171561158157600080fd5b604052919050565b600067ffffffffffffffff8211156115a057600080fd5b506020601f91909101601f19160190565b5190565b90815260200190565b6000600160a060020a038216610374565b90565b151590565b6000610374826000610374826115be565b82818337506000910152565b60005b8381101561160f5781810151838201526020016115f7565b8381111561161e576000848401525b50505050565b601f01601f19169056fea265627a7a72305820e93d9cc4e962d61b0eb9c715faa69abe238b951e8d8d1fee047923af4cadac1d6c6578706572696d656e74616cf50037
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000f55186cc537e7067ea616f2aae007b4427a120c8000000000000000000000000080bf510fcbf18b91105470639e956102293771200000000000000000000000095e6f48254609a6ee006f7d493c8e5fb97094cef000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498000000000000000000000000882d80d3a191859d64477eb78cca46599307ec1c
-----Decoded View---------------
Arg [0] : _core (address): 0xf55186CC537E7067EA616F2aaE007b4427a120C8
Arg [1] : _zeroExExchange (address): 0x080bf510FCbF18b91105470639e9561022937712
Arg [2] : _zeroExProxy (address): 0x95E6F48254609A6ee006F7D493c8e5fB97094ceF
Arg [3] : _zeroExToken (address): 0xE41d2489571d322189246DaFA5ebDe1F4699F498
Arg [4] : _setTransferProxy (address): 0x882d80D3a191859d64477eb78Cca46599307ec1C
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 000000000000000000000000f55186cc537e7067ea616f2aae007b4427a120c8
Arg [1] : 000000000000000000000000080bf510fcbf18b91105470639e9561022937712
Arg [2] : 00000000000000000000000095e6f48254609a6ee006f7d493c8e5fb97094cef
Arg [3] : 000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498
Arg [4] : 000000000000000000000000882d80d3a191859d64477eb78cca46599307ec1c
Deployed Bytecode Sourcemap
76280:9293:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;76280:9293:0;;;;;;-1:-1:-1;;;76280:9293:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;76465:29;;;:::i;:::-;;;;;;;;;;;;;;;;76567:31;;;:::i;78267:2187::-;;;;;;;;;:::i;:::-;;;;;;;;76534:26;;;:::i;76501:::-;;;:::i;76439:19::-;;;:::i;76465:29::-;;;-1:-1:-1;;;;;76465:29:0;;:::o;76567:31::-;;;-1:-1:-1;;;;;76567:31:0;;:::o;78267:2187::-;78428:45;;:::i;:::-;78519:4;;78513:36;;;;;-1:-1:-1;;;;;78519:4:0;;;;78513:24;;:36;;78538:10;;78513:36;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;78513:36:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;78513:36:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;78513:36:0;;;;;;;;;78491:148;;;;-1:-1:-1;;;;;78491:148:0;;;;;;;;;;;;;;;;;78652:19;78674:13;:24;;;78652:46;;78709:27;78753:11;78739:26;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;78739:26:0;;78709:56;;78776:30;78823:11;78809:26;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;78809:26:0;;78776:59;;78846:36;78899:11;78885:26;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;78885:26:0;-1:-1:-1;78846:65:0;-1:-1:-1;78924:20:0;;78959:1125;78983:13;:24;;;78979:1;:28;78959:1125;;;79029:65;;:::i;:::-;79109:22;79229:97;79269:11;79299:12;79229:21;:97::i;:::-;79192:134;;;;;;;;79446:16;:27;;;79430:10;79441:1;79430:13;;;;;;;;-1:-1:-1;;;;;79430:43:0;;;:13;;;;;;;;;;;:43;79620:20;;79586:104;;79659:16;79586:15;:104::i;:::-;79542:13;79556:1;79542:16;;;;;;;;;;;;;79560:19;79580:1;79560:22;;;;;;;;;;;;;79541:149;;;;;-1:-1:-1;;;;;79541:149:0;-1:-1:-1;;;;;79541:149:0;;;;;;79794:186;79841:13;79855:1;79841:16;;;;;;;;;;;;;;79884:4;79908:16;;;;;;;;;-1:-1:-1;;;;;79908:16:0;79943:19;79963:1;79943:22;;;;;;;;;;;;;;79794:28;:186::i;:::-;80049:23;:14;80068:3;80049:23;:18;:23;:::i;:::-;80034:38;-1:-1:-1;;;79009:3:0;;78959:1125;;;;80159:118;80221:10;80246:13;:20;;;80159:47;:118::i;:::-;-1:-1:-1;80297:149:0;;;;;;;;;;;;;;;;;-1:-1:-1;;;78267:2187:0;;;;;:::o;76534:26::-;;;-1:-1:-1;;;;;76534:26:0;;:::o;76501:::-;;;-1:-1:-1;;;;;76501:26:0;;:::o;76439:19::-;;;-1:-1:-1;;;;;76439:19:0;;:::o;84040:1530::-;84188:48;;:::i;:::-;84238:7;84313:44;;:::i;:::-;84360:94;84410:11;84436:7;84360:35;:94::i;:::-;84313:141;;84562:22;84587:43;84627:2;84587:35;84599:6;:22;;;84587:7;:11;;:35;;;;:::i;:::-;:39;:43;:39;:43;:::i;:::-;84562:68;-1:-1:-1;84777:87:0;84809:15;:7;84821:2;84809:15;:11;:15;:::i;:::-;84777:11;;84839:14;84777:87;:17;:87;:::i;:::-;84758:16;;;:106;84929:27;;:::i;:::-;84959:64;84995:11;85008:14;84959:35;:64::i;:::-;84929:94;;85034:18;85055:78;85105:11;85118:14;85055:49;:78::i;:::-;85034:99;;85144:18;85165:78;85215:11;85228:14;85165:49;:78::i;:::-;85144:99;;85256:65;;:::i;:::-;-1:-1:-1;85324:184:0;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;85324:184:0;;;;;;;;;;;;;;;;;;;-1:-1:-1;84040:1530:0;-1:-1:-1;;;84040:1530:0:o;80981:1367::-;81151:7;81160;81185:27;;:::i;:::-;-1:-1:-1;81215:23:0;;;;81249:44;;:::i;:::-;-1:-1:-1;81296:24:0;;81456:28;;;;81527:11;;81553:22;;;;81413:173;;81456:28;81507:4;;-1:-1:-1;;;;;81527:11:0;;;;81413:28;:173::i;:::-;81667:17;;;;81754:14;;;;:18;81750:219;;81789:168;81826:5;:14;;;81859:5;:22;;;81900:7;81926:16;81789:18;:168::i;:::-;82035:45;;:::i;:::-;82093:14;;82190:16;;;;;82083:134;;;;;-1:-1:-1;;;;;82093:14:0;;;;82083:41;;:134;;82139:5;;82159:16;;82083:134;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;82083:134:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;82083:134:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;82083:134:0;;;;;;;;;82252:28;;;;;;82295:34;;82252:28;;82295:34;;-1:-1:-1;;;;;;;80981:1367:0:o;11359:428::-;11530:24;11557:35;11567:6;11575;11583:8;11557:9;:35::i;:::-;11530:62;;11626:9;11607:16;:28;11603:177;;;11652:116;11678:6;11703:8;11730:23;:21;:23::i;:::-;11652:7;:116::i;:::-;11359:428;;;;;:::o;1587:150::-;1645:7;1677:5;;;1701:6;;;;1693:15;;;;;;1728:1;1587:150;-1:-1:-1;;;1587:150:0:o;41588:609::-;41733:9;41728:462;41752:11;:18;41748:1;:22;41728:462;;;41871:26;41900:12;:22;41923:11;41935:1;41923:14;;;;;;;;;;;;;;41947:4;41900:53;;;;;-1:-1:-1;;;41900:53:0;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;41900:53:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;41900:53:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;41900:53:0;;;;;;;;;41871:82;-1:-1:-1;41972:22:0;;41968:211;;42015:12;:21;42059:11;42071:1;42059:14;;;;;;;;;;;;;;42096:7;42126:18;42015:148;;;;;-1:-1:-1;;;42015:148:0;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;42015:148:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;42015:148:0;;;;41968:211;-1:-1:-1;41772:3:0;;41728:462;;;;41588:609;;:::o;69746:526::-;69890:18;;:::i;:::-;69926:25;;:::i;:::-;69964:22;69989:41;70022:7;69989:28;:11;:26;:28::i;:41::-;70092:21;;70067:47;;70208:2;70188:23;;;70182:30;70164:15;;;70157:56;-1:-1:-1;70067:47:0;69746:526;-1:-1:-1;;;69746:526:0:o;39118:695::-;39225:19;39292:2;39284:4;:10;;39262:86;;;;-1:-1:-1;;;;;39262:86:0;;;;;;;;;39491:1;:8;39485:2;:14;;39359:196;;;;-1:-1:-1;;;;;39359:196:0;;;;;;;;;39651:4;39646:2;:9;39636:20;;;;;;;;;;;;;;;;;;;;;;;;;21:6:-1;;104:10;39636:20:0;87:34:-1;135:17;;-1:-1;39636:20:0;;39627:29;;39667:114;39689:23;:6;:21;:23::i;:::-;39748:4;39727:18;:1;:16;:18::i;:::-;:25;39767:6;:13;39667:7;:114::i;71569:1614::-;71713:21;;:::i;:::-;71752:27;;:::i;:::-;71790:25;71826;71864:22;71889:41;71922:7;71889:28;:11;:26;:28::i;:41::-;71864:66;;71997:14;71991:21;71974:5;71967:46;72097:2;72081:14;72077:23;72071:30;72065:2;72058:5;72054:14;72047:55;72177:2;72161:14;72157:23;72151:30;72145:2;72138:5;72134:14;72127:55;72264:2;72248:14;72244:23;72238:30;72232:2;72225:5;72221:14;72214:55;72352:3;72336:14;72332:24;72326:31;72320:3;72313:5;72309:15;72302:56;72443:3;72427:14;72423:24;72417:31;72411:3;72404:5;72400:15;72393:56;72534:3;72518:14;72514:24;72508:31;72502:3;72495:5;72491:15;72484:56;72617:3;72601:14;72597:24;72591:31;72585:3;72578:5;72574:15;72567:56;72700:3;72684:14;72680:24;72674:31;72668:3;72661:5;72657:15;72650:56;72801:3;72785:14;72781:24;72775:31;72769:3;72762:5;72758:15;72751:56;72877:3;72861:14;72857:24;72851:31;72830:52;;72962:3;72946:14;72942:24;72936:31;72915:52;;73032:42;73056:17;73032:23;:42::i;:::-;73009:20;;;:65;73108:42;73132:17;73108:23;:42::i;:::-;73085:20;;;:65;-1:-1:-1;73085:20:0;;71569:1614;-1:-1:-1;;;;;71569:1614:0:o;73461:450::-;73619:7;73644:25;73682:22;73707:41;73740:7;73707:28;:11;:26;:28::i;:41::-;73832:3;73812:24;73806:31;;73461:450;-1:-1:-1;;;;;73461:450:0:o;74191:::-;74349:7;74374:25;74412:22;74437:41;74470:7;74437:28;:11;:26;:28::i;:41::-;74562:3;74542:24;74536:31;;74191:450;-1:-1:-1;;;;;74191:450:0:o;82827:680::-;83135:26;83164:120;83206:9;83230:11;83256:17;83164:27;:120::i;:::-;83394:11;;83354:145;;;;;83135:149;;-1:-1:-1;83354:12:0;;:25;;:145;;-1:-1:-1;;;;;83394:11:0;;;;83420:7;;83450:4;;83135:149;;83354:145;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;83354:145:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;83354:145:0;;;;82827:680;;;;;:::o;8451:235::-;8636:42;;;;;8604:7;;-1:-1:-1;;;;;8636:24:0;;;;;:42;;8661:6;;8669:8;;8636:42;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;8636:42:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;8636:42:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;8636:42:0;;;;;;;;;8629:49;8451:235;-1:-1:-1;;;;8451:235:0:o;2910:124::-;-1:-1:-1;;2910:124:0;:::o;10610:356::-;10748:43;;;;;-1:-1:-1;;;;;10748:22:0;;;;;:43;;10771:8;;10781:9;;10748:43;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;10748:43:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;10748:43:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;10748:43:0;;;;;;;;;;10878:14;:12;:14::i;:::-;10856:102;;;;-1:-1:-1;;;;;10856:102:0;;;;;;;;32480:237;32665:2;32654:14;;32480:237::o;34537:4266::-;34695:2;34686:6;:11;34682:4114;;;34989:1;34979:6;34975:2;34971:15;34966:3;34962:25;34958:33;35041:4;35037:9;35028:6;35022:13;35018:29;35091:4;35084;35078:11;35074:22;35133:1;35130;35127:8;35121:4;35114:22;34927:224;;;;;;35258:4;35248:6;:14;35244:61;;;35283:7;;35244:61;36011:4;36002:6;:13;35998:2787;;;36343:2;36335:6;36331:15;36321:25;;36392:6;36384;36380:19;36443:6;36437:4;36433:17;36756:4;36750:11;36964:202;36982:4;36974:6;36971:16;36964:202;;;37031:13;;37018:27;;37093:2;37130:13;;;;37081:15;;;;36964:202;;;37238:18;;-1:-1:-1;36045:1230:0;;;37525:2;37517:6;37513:15;37503:25;;37574:6;37566;37562:19;37625:6;37619:4;37615:17;37941:6;37935:13;38464:195;38481:4;38475;38471:15;38464:195;;;38530:11;;38517:25;;-1:-1:-1;;38576:13:0;;;;38623;;;;38464:195;;;38732:19;;-1:-1:-1;;34537:4266:0;;;:::o;74884:522::-;75057:13;;;75067:2;75057:13;;;75005:12;75057:13;;;;;;75005:12;;75057:13;;;;21:6:-1;;104:10;75057:13:0;87:34:-1;-1:-1;;75174:66:0;75296:2;75284:15;;75277:33;-1:-1:-1;75343:2:0;75331:15;;75324:38;;;;-1:-1:-1;75284:15:0;;74884:522;-1:-1:-1;74884:522:0:o;3960:909::-;4132:7;4229:17;4280:12;4249:44;;;;;4268:10;4256;4249:44;4229:64;-1:-1:-1;4353:14:0;4349:98;;4391:44;4422:12;4391:26;:10;4406;4391:26;:14;:26;:::i;:::-;:30;:44;:30;:44;:::i;:::-;4384:51;;;;;4349:98;4498:33;4534:54;4561:26;:10;4576;4561:26;:14;:26;:::i;:::-;4534:22;:9;4548:7;4534:22;:13;:22;:::i;:54::-;4498:90;;4707:4;4679:25;:32;4657:140;;;;-1:-1:-1;;;;;4657:140:0;;;;;;;;;4817:44;4848:12;4817:26;:10;4832;4817:26;:14;:26;:::i;:44::-;4810:51;3960:909;-1:-1:-1;;;;;;3960:909:0:o;12009:885::-;12088:4;;12279:14;12359:59;;;;12473:4;12468:226;;;;12272:514;;12359:59;12402:1;12387:16;;12359:59;;12468:226;12575:4;12570:3;12565;12550:30;12675:3;12669:10;12654:25;;12272:514;-1:-1:-1;12885:1:0;12870:16;;-1:-1:-1;12009:885:0;:::o;340:433::-;398:7;642:6;638:47;;-1:-1:-1;672:1:0;665:8;;638:47;709:5;;;713:1;709;:5;:1;733:5;;;;;:10;725:19;;;;;908:303;966:7;1065:1;1061;:5;1053:14;;;;;;1078:9;1094:1;1090;:5;;;;;;;908:303;-1:-1:-1;;;;908:303:0:o;76280:9293::-;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;-1:-1:-1;;;;;76280:9293:0;;;;;;-1:-1:-1;;;;;76280:9293:0;;;;;;-1:-1:-1;;;;;76280:9293:0;;;;;;-1:-1:-1;;;;;76280:9293:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;5:118:-1:-;;72:46;110:6;97:20;72:46;;130:116;;205:36;233:6;227:13;205:36;;254:440;;355:3;348:4;340:6;336:17;332:27;322:2;;373:1;370;363:12;322:2;410:6;397:20;432:64;447:48;488:6;447:48;;;432:64;;;423:73;;516:6;509:5;502:21;552:4;544:6;540:17;585:4;578:5;574:16;620:3;611:6;606:3;602:16;599:25;596:2;;;637:1;634;627:12;596:2;647:41;681:6;676:3;671;647:41;;;315:379;;;;;;;;751:478;;869:4;857:9;852:3;848:19;844:30;841:2;;;887:1;884;877:12;841:2;905:20;920:4;905:20;;;896:29;-1:-1;977:1;1008:49;1053:3;1033:9;1008:49;;;984:74;;-1:-1;1125:2;1158:49;1203:3;1179:22;;;1158:49;;;1151:4;1144:5;1140:16;1133:75;1079:140;835:394;;;;;1276:865;;1405:4;1393:9;1388:3;1384:19;1380:30;1377:2;;;1423:1;1420;1413:12;1377:2;1441:20;1456:4;1441:20;;;1432:29;-1:-1;1529:1;1560:60;1616:3;1596:9;1560:60;;;1536:85;;-1:-1;1700:2;1733:60;1789:3;1765:22;;;1733:60;;;1726:4;1719:5;1715:16;1708:86;1642:163;1863:2;1896:60;1952:3;1943:6;1932:9;1928:22;1896:60;;;1889:4;1882:5;1878:16;1871:86;1815:153;2026:2;2059:60;2115:3;2106:6;2095:9;2091:22;2059:60;;;2052:4;2045:5;2041:16;2034:86;1978:153;1371:770;;;;;2148:118;;2215:46;2253:6;2240:20;2215:46;;2273:122;;2351:39;2382:6;2376:13;2351:39;;2402:257;;2514:2;2502:9;2493:7;2489:23;2485:32;2482:2;;;2530:1;2527;2520:12;2482:2;2565:1;2582:61;2635:7;2615:9;2582:61;;2666:528;;;2825:2;2813:9;2804:7;2800:23;2796:32;2793:2;;;2841:1;2838;2831:12;2793:2;2876:1;2893:82;2967:7;2947:9;2893:82;;;2883:92;;2855:126;3040:2;3029:9;3025:18;3012:32;3064:18;3056:6;3053:30;3050:2;;;3096:1;3093;3086:12;3050:2;3116:62;3170:7;3161:6;3150:9;3146:22;3116:62;;;3106:72;;2991:193;2787:407;;;;;;3201:322;;3345:3;3333:9;3324:7;3320:23;3316:33;3313:2;;;3362:1;3359;3352:12;3313:2;3397:1;3414:93;3499:7;3479:9;3414:93;;3530:263;;3645:2;3633:9;3624:7;3620:23;3616:32;3613:2;;;3661:1;3658;3651:12;3613:2;3696:1;3713:64;3769:7;3749:9;3713:64;;3801:173;;3888:46;3930:3;3922:6;3888:46;;;-1:-1;;3963:4;3954:14;;3881:93;3983:173;;4070:46;4112:3;4104:6;4070:46;;4164:142;4255:45;4294:5;4255:45;;;4250:3;4243:58;4237:69;;;4313:110;4386:31;4411:5;4386:31;;4723:585;;4854:50;4898:5;4854:50;;;4917:76;4986:6;4981:3;4917:76;;;4910:83;;5013:52;5059:5;5013:52;;;5086:1;5071:215;5096:6;5093:1;5090:13;5071:215;;;5143:63;5202:3;5193:6;5187:13;5143:63;;;5136:70;;5223:56;5272:6;5223:56;;;5213:66;-1:-1;5118:1;5111:9;5071:215;;;-1:-1;5299:3;;4833:475;-1:-1;;;;4833:475;5347:585;;5478:50;5522:5;5478:50;;;5541:76;5610:6;5605:3;5541:76;;;5534:83;;5637:52;5683:5;5637:52;;;5710:1;5695:215;5720:6;5717:1;5714:13;5695:215;;;5767:63;5826:3;5817:6;5811:13;5767:63;;;5760:70;;5847:56;5896:6;5847:56;;;5837:66;-1:-1;5742:1;5735:9;5695:215;;5940:315;;6036:34;6064:5;6036:34;;;6082:60;6135:6;6130:3;6082:60;;;6075:67;;6147:52;6192:6;6187:3;6180:4;6173:5;6169:16;6147:52;;;6220:29;6242:6;6220:29;;;6211:39;;;;6016:239;-1:-1;;;6016:239;6605:465;;6765:67;6829:2;6824:3;6765:67;;;6865:66;6845:87;;6966:66;6961:2;6952:12;;6945:88;7061:2;7052:12;;6751:319;-1:-1;;6751:319;7079:364;;7239:67;7303:2;7298:3;7239:67;;;7339:66;7319:87;;7434:2;7425:12;;7225:218;-1:-1;;7225:218;7452:364;;7612:67;7676:2;7671:3;7612:67;;;7712:66;7692:87;;7807:2;7798:12;;7598:218;-1:-1;;7598:218;7825:465;;7985:67;8049:2;8044:3;7985:67;;;8085:66;8065:87;;8186:66;8181:2;8172:12;;8165:88;8281:2;8272:12;;7971:319;-1:-1;;7971:319;8299:465;;8459:67;8523:2;8518:3;8459:67;;;8559:66;8539:87;;8660:66;8655:2;8646:12;;8639:88;8755:2;8746:12;;8445:319;-1:-1;;8445:319;8873:731;9112:22;;9038:4;9147:37;;;8873:731;;9029:14;;;;9199:98;9029:14;9112:22;9199:98;;;9191:106;;9058:251;9396:4;9389:5;9385:16;9379:23;9448:3;9442:4;9438:14;9431:4;9426:3;9422:14;9415:38;9468:98;9561:4;9548:11;9468:98;;;9460:106;9011:593;-1:-1;;;;;9011:593;9664:2263;9885:22;;9664:2263;;9811:5;9802:15;;;9913:61;9806:3;9885:22;9913:61;;;9832:148;10060:4;10053:5;10049:16;10043:23;10072:62;10128:4;10123:3;10119:14;10106:11;10072:62;;;9990:150;10227:4;10220:5;10216:16;10210:23;10239:62;10295:4;10290:3;10286:14;10273:11;10239:62;;;10150:157;10388:4;10381:5;10377:16;10371:23;10400:62;10456:4;10451:3;10447:14;10434:11;10400:62;;;10317:151;10552:4;10545:5;10541:16;10535:23;10564:62;10620:4;10615:3;10611:14;10598:11;10564:62;;;10478:154;10716:4;10709:5;10705:16;10699:23;10728:62;10784:4;10779:3;10775:14;10762:11;10728:62;;;10642:154;10872:4;10865:5;10861:16;10855:23;10884:62;10940:4;10935:3;10931:14;10918:11;10884:62;;;10806:146;11028:4;11021:5;11017:16;11011:23;11040:62;11096:4;11091:3;11087:14;11074:11;11040:62;;;10962:146;11197:5;11190;11186:17;11180:24;11210:63;11266:5;11261:3;11257:15;11244:11;11210:63;;;11118:161;11351:5;11344;11340:17;11334:24;11364:63;11420:5;11415:3;11411:15;11398:11;11364:63;;;11289:144;11515:5;11508;11504:17;11498:24;11569:3;11563:4;11559:14;11551:5;11546:3;11542:15;11535:39;11589:66;11650:4;11637:11;11589:66;;;11581:74;;11443:224;11749:5;11742;11738:17;11732:24;11803:3;11797:4;11793:14;11785:5;11780:3;11776:15;11769:39;11823:66;11884:4;11871:11;11823:66;;11934:110;12007:31;12032:5;12007:31;;12313:213;12431:2;12416:18;;12445:71;12420:9;12489:6;12445:71;;12533:229;12659:2;12644:18;;12673:79;12648:9;12725:6;12673:79;;12769:324;12915:2;12900:18;;12929:71;12904:9;12973:6;12929:71;;;13011:72;13079:2;13068:9;13064:18;13055:6;13011:72;;13455:587;13665:3;13650:19;;13680:79;13654:9;13732:6;13680:79;;;13770:80;13846:2;13835:9;13831:18;13822:6;13770:80;;;13861;13937:2;13926:9;13922:18;13913:6;13861:80;;;13952;14028:2;14017:9;14013:18;14004:6;13952:80;;14049:467;14231:2;14216:18;;14245:79;14220:9;14297:6;14245:79;;;14335:80;14411:2;14400:9;14396:18;14387:6;14335:80;;;14426;14502:2;14491:9;14487:18;14478:6;14426:80;;14523:324;14669:2;14654:18;;14683:71;14658:9;14727:6;14683:71;;;14765:72;14833:2;14822:9;14818:18;14809:6;14765:72;;14854:407;15045:2;15059:47;;;15030:18;;15120:131;15030:18;15120:131;;15268:407;15459:2;15473:47;;;15444:18;;15534:131;15444:18;15534:131;;15682:407;15873:2;15887:47;;;15858:18;;15948:131;15858:18;15948:131;;16096:407;16287:2;16301:47;;;16272:18;;16362:131;16272:18;16362:131;;16510:407;16701:2;16715:47;;;16686:18;;16776:131;16686:18;16776:131;;16924:389;17106:2;17120:47;;;17091:18;;17181:122;17091:18;17289:6;17181:122;;17320:651;17554:2;17568:47;;;17539:18;;17629:104;17539:18;17719:6;17629:104;;;17621:112;;17744:72;17812:2;17801:9;17797:18;17788:6;17744:72;;;17864:9;17858:4;17854:20;17849:2;17838:9;17834:18;17827:48;17889:72;17956:4;17947:6;17889:72;;17978:256;18040:2;18034:9;18066:17;;;18141:18;18126:34;;18162:22;;;18123:62;18120:2;;;18198:1;18195;18188:12;18120:2;18214;18207:22;18018:216;;-1:-1;18018:216;18241:258;;18384:18;18376:6;18373:30;18370:2;;;18416:1;18413;18406:12;18370:2;-1:-1;18489:4;18460;18437:17;;;;-1:-1;;18433:33;18479:15;;18307:192;18762:103;18848:12;;18832:33;19331:168;19439:19;;;19488:4;19479:14;;19432:67;20188:105;;-1:-1;;;;;20369:54;;20257:31;20352:76;20435:79;20504:5;20487:27;20633:92;20706:13;20699:21;;20682:43;20953:129;;21040:37;21071:5;21089:121;21168:37;21199:5;21168:37;;21340:145;21421:6;21416:3;21411;21398:30;-1:-1;21477:1;21459:16;;21452:27;21391:94;21494:268;21559:1;21566:101;21580:6;21577:1;21574:13;21566:101;;;21647:11;;;21641:18;21628:11;;;21621:39;21602:2;21595:10;21566:101;;;21682:6;21679:1;21676:13;21673:2;;;21747:1;21738:6;21733:3;21729:16;21722:27;21673:2;21543:219;;;;;21770:97;21858:2;21838:14;-1:-1;;21834:28;;21818:49
Swarm Source
bzzr://e93d9cc4e962d61b0eb9c715faa69abe238b951e8d8d1fee047923af4cadac1d
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 27 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.