aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-05-25 03:29:45 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-06-08 06:36:18 +0800
commit9b82e2df58cfd7f4dc9954fa93167450919f457f (patch)
tree8b84f49b930ef7053dd34ad10894fc7f57c0e033
parent3d65341080177bdd436e7628a76e65774b947a38 (diff)
downloaddexon-sol-tools-9b82e2df58cfd7f4dc9954fa93167450919f457f.tar.gz
dexon-sol-tools-9b82e2df58cfd7f4dc9954fa93167450919f457f.tar.zst
dexon-sol-tools-9b82e2df58cfd7f4dc9954fa93167450919f457f.zip
Foundation for TestLibAssetProxyDecoder
-rw-r--r--packages/contracts/compiler.json1
-rw-r--r--packages/contracts/package.json2
-rw-r--r--packages/contracts/src/contracts/current/test/TestLibAssetProxyDecoder/TestLibAssetProxyDecoder.sol50
-rw-r--r--packages/contracts/src/utils/artifacts.ts2
-rw-r--r--packages/contracts/src/utils/types.ts1
-rw-r--r--packages/contracts/test/asset_proxy/decoder.ts72
-rw-r--r--packages/contracts/test/libraries/lib_mem.ts2
-rw-r--r--packages/migrations/artifacts/2.0.0/TestLibAssetProxyDecoder.json88
8 files changed, 216 insertions, 2 deletions
diff --git a/packages/contracts/compiler.json b/packages/contracts/compiler.json
index a11f2a2c0..639849cd7 100644
--- a/packages/contracts/compiler.json
+++ b/packages/contracts/compiler.json
@@ -29,6 +29,7 @@
"MixinAuthorizable",
"MultiSigWallet",
"MultiSigWalletWithTimeLock",
+ "TestLibAssetProxyDecoder",
"TestAssetProxyDispatcher",
"TestLibBytes",
"TestLibMem",
diff --git a/packages/contracts/package.json b/packages/contracts/package.json
index 009fe87ec..43c33e7d3 100644
--- a/packages/contracts/package.json
+++ b/packages/contracts/package.json
@@ -30,7 +30,7 @@
"test:circleci": "yarn test"
},
"config": {
- "abis": "../migrations/artifacts/2.0.0/@(AssetProxyOwner|DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC721Proxy|Exchange|MixinAuthorizable|MultiSigWallet|MultiSigWalletWithTimeLock|TestAssetProxyDispatcher|TestLibBytes|TestLibMem|TestLibs|TestSignatureValidator|TokenRegistry|Whitelist|WETH9|ZRXToken).json"
+ "abis": "../migrations/artifacts/2.0.0/@(AssetProxyOwner|DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC721Proxy|Exchange|MixinAuthorizable|MultiSigWallet|MultiSigWalletWithTimeLock|TestAssetProxyDispatcher|TestLibAssetProxyDecoder|TestLibBytes|TestLibMem|TestLibs|TestSignatureValidator|TokenRegistry|Whitelist|WETH9|ZRXToken).json"
},
"repository": {
"type": "git",
diff --git a/packages/contracts/src/contracts/current/test/TestLibAssetProxyDecoder/TestLibAssetProxyDecoder.sol b/packages/contracts/src/contracts/current/test/TestLibAssetProxyDecoder/TestLibAssetProxyDecoder.sol
new file mode 100644
index 000000000..ac7cd63ab
--- /dev/null
+++ b/packages/contracts/src/contracts/current/test/TestLibAssetProxyDecoder/TestLibAssetProxyDecoder.sol
@@ -0,0 +1,50 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "../../utils/LibAssetProxyDecoder/LibAssetProxyDecoder.sol";
+
+contract TestLibAssetProxyDecoder is
+ LibAssetProxyDecoder
+{
+
+ /// @dev Decodes ERC721 Asset Proxy data
+ function publicDecodeERC20Data(bytes memory proxyData)
+ public
+ pure
+ returns (uint8, address)
+ {
+ return decodeERC20Data(proxyData);
+ }
+
+ /// @dev Decodes ERC721 Asset Proxy data
+ function publicDecodeERC721Data(bytes memory proxyData)
+ internal
+ pure
+ returns (
+ uint8,
+ address,
+ uint256,
+ bytes memory
+ )
+ {
+ return decodeERC721Data(proxyData);
+ }
+}
diff --git a/packages/contracts/src/utils/artifacts.ts b/packages/contracts/src/utils/artifacts.ts
index 1b47f1d41..44de43a95 100644
--- a/packages/contracts/src/utils/artifacts.ts
+++ b/packages/contracts/src/utils/artifacts.ts
@@ -10,6 +10,7 @@ import * as MixinAuthorizable from '../artifacts/MixinAuthorizable.json';
import * as MultiSigWallet from '../artifacts/MultiSigWallet.json';
import * as MultiSigWalletWithTimeLock from '../artifacts/MultiSigWalletWithTimeLock.json';
import * as TestAssetProxyDispatcher from '../artifacts/TestAssetProxyDispatcher.json';
+import * as TestLibAssetProxyDecoder from '../artifacts/TestLibAssetProxyDecoder.json';
import * as TestLibBytes from '../artifacts/TestLibBytes.json';
import * as TestLibMem from '../artifacts/TestLibMem.json';
import * as TestLibs from '../artifacts/TestLibs.json';
@@ -31,6 +32,7 @@ export const artifacts = {
MultiSigWallet: (MultiSigWallet as any) as ContractArtifact,
MultiSigWalletWithTimeLock: (MultiSigWalletWithTimeLock as any) as ContractArtifact,
TestAssetProxyDispatcher: (TestAssetProxyDispatcher as any) as ContractArtifact,
+ TestLibAssetProxyDecoder: (TestLibAssetProxyDecoder as any) as ContractArtifact,
TestLibBytes: (TestLibBytes as any) as ContractArtifact,
TestLibMem: (TestLibMem as any) as ContractArtifact,
TestLibs: (TestLibs as any) as ContractArtifact,
diff --git a/packages/contracts/src/utils/types.ts b/packages/contracts/src/utils/types.ts
index cc6f00b95..70abb2643 100644
--- a/packages/contracts/src/utils/types.ts
+++ b/packages/contracts/src/utils/types.ts
@@ -90,6 +90,7 @@ export enum ContractName {
AccountLevels = 'AccountLevels',
EtherDelta = 'EtherDelta',
Arbitrage = 'Arbitrage',
+ TestLibAssetProxyDecoder = 'TestLibAssetProxyDecoder',
TestAssetProxyDispatcher = 'TestAssetProxyDispatcher',
TestLibMem = 'TestLibMem',
TestLibs = 'TestLibs',
diff --git a/packages/contracts/test/asset_proxy/decoder.ts b/packages/contracts/test/asset_proxy/decoder.ts
new file mode 100644
index 000000000..74e7547d3
--- /dev/null
+++ b/packages/contracts/test/asset_proxy/decoder.ts
@@ -0,0 +1,72 @@
+import { LogWithDecodedArgs, TransactionReceiptWithDecodedLogs, ZeroEx } from '0x.js';
+import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
+import { BigNumber } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import BN = require('bn.js');
+import * as chai from 'chai';
+import ethUtil = require('ethereumjs-util');
+import * as Web3 from 'web3';
+
+import { TestLibAssetProxyDecoderContract } from '../../src/contract_wrappers/generated/test_lib_asset_proxy_decoder';
+import { artifacts } from '../../src/utils/artifacts';
+import { chaiSetup } from '../../src/utils/chai_setup';
+import { constants } from '../../src/utils/constants';
+import { AssetProxyId } from '../../src/utils/types';
+import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper';
+
+chaiSetup.configure();
+const expect = chai.expect;
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+
+describe.only('AssetProxyDecoder', () => {
+ let owner: string;
+ let testAssetProxyDecoder: TestLibAssetProxyDecoderContract;
+
+ before(async () => {
+ // Setup accounts & addresses
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ owner = accounts[0];
+ // Deploy TestLibMem
+ testAssetProxyDecoder = await TestLibAssetProxyDecoderContract.deployFrom0xArtifactAsync(
+ artifacts.TestLibAssetProxyDecoder,
+ provider,
+ txDefaults,
+ );
+ });
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+
+ describe('LibAssetProxyDecoder', () => {
+ /*it('should )', async () => {
+ await testAssetProxyDecoder.test1.sendTransactionAsync();
+ });
+
+ it('should )', async () => {
+ await testLibMem.test2.sendTransactionAsync();
+ });
+
+ it('should )', async () => {
+ await testLibMem.test3.sendTransactionAsync();
+ });
+
+ it('should )', async () => {
+ await testLibMem.test4.sendTransactionAsync();
+ });
+
+ it('should )', async () => {
+ await testLibMem.test5.sendTransactionAsync();
+ });
+
+ it('should )', async () => {
+ await testLibMem.test6.sendTransactionAsync();
+ });
+
+ it('should )', async () => {
+ return expect(testLibMem.test7.sendTransactionAsync()).to.be.rejectedWith(constants.REVERT);
+ });*/
+ });
+});
diff --git a/packages/contracts/test/libraries/lib_mem.ts b/packages/contracts/test/libraries/lib_mem.ts
index c861484f3..6ce4ab9b6 100644
--- a/packages/contracts/test/libraries/lib_mem.ts
+++ b/packages/contracts/test/libraries/lib_mem.ts
@@ -18,7 +18,7 @@ chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-describe.only('LibMem', () => {
+describe('LibMem', () => {
let owner: string;
let testLibMem: TestLibMemContract;
diff --git a/packages/migrations/artifacts/2.0.0/TestLibAssetProxyDecoder.json b/packages/migrations/artifacts/2.0.0/TestLibAssetProxyDecoder.json
new file mode 100644
index 000000000..0437766c7
--- /dev/null
+++ b/packages/migrations/artifacts/2.0.0/TestLibAssetProxyDecoder.json
@@ -0,0 +1,88 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "TestLibAssetProxyDecoder",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "proxyData",
+ "type": "bytes"
+ }
+ ],
+ "name": "publicDecodeERC20Data",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint8"
+ },
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x608060405234801561001057600080fd5b506103a7806100206000396000f3006080604052600436106100275763ffffffff60e060020a600035041663bd27c22d811461002c575b600080fd5b34801561003857600080fd5b5061004c610047366004610208565b610063565b60405161005a9291906102a9565b60405180910390f35b60008061006f83610078565b91509150915091565b6000808251601514606060405190810160405280602281526020017f4d65746164617461206d75737420686176652061206c656e677468206f662032815260200160f160020a611897028152509015156100f15760405160e560020a62461bcd0281526004016100e89190610291565b60405180910390fd5b5082600081518110151561010157fe5b016020015160f860020a90819004810204915061011f836001610126565b9050915091565b60008160140183511015606060405190810160405280602b81526020017f4c656e677468206d7573742062652067726561746572207468616e206f722065815260200160a960020a6a38bab0b6103a3790191817028152509015156101a15760405160e560020a62461bcd0281526004016100e89190610291565b50500160140151600160a060020a031690565b6000601f820183136101c557600080fd5b81356101d86101d3826102ea565b6102c4565b915080825260208301602083018583830111156101f457600080fd5b6101ff838284610327565b50505092915050565b60006020828403121561021a57600080fd5b81356001604060020a0381111561023057600080fd5b61023c848285016101b4565b949350505050565b61024d81610315565b82525050565b600061025e82610311565b808452610272816020860160208601610333565b61027b81610363565b9093016020019392505050565b61024d81610321565b602080825281016102a28184610253565b9392505050565b604081016102b78285610288565b6102a26020830184610244565b6040518181016001604060020a03811182821017156102e257600080fd5b604052919050565b60006001604060020a0382111561030057600080fd5b506020601f91909101601f19160190565b5190565b600160a060020a031690565b60ff1690565b82818337506000910152565b60005b8381101561034e578181015183820152602001610336565b8381111561035d576000848401525b50505050565b601f01601f1916905600a265627a7a7230582008b76108b6bf36a2766e799f617e47a5feab326e99d46ea5c5bcb8d7dfc682db6c6578706572696d656e74616cf50037",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x3A7 DUP1 PUSH2 0x20 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x27 JUMPI PUSH4 0xFFFFFFFF PUSH1 0xE0 PUSH1 0x2 EXP PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0xBD27C22D DUP2 EQ PUSH2 0x2C JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x38 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x4C PUSH2 0x47 CALLDATASIZE PUSH1 0x4 PUSH2 0x208 JUMP JUMPDEST PUSH2 0x63 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x5A SWAP3 SWAP2 SWAP1 PUSH2 0x2A9 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x6F DUP4 PUSH2 0x78 JUMP JUMPDEST SWAP2 POP SWAP2 POP SWAP2 POP SWAP2 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP3 MLOAD PUSH1 0x15 EQ PUSH1 0x60 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x22 DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0x4D65746164617461206D75737420686176652061206C656E677468206F662032 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0xF1 PUSH1 0x2 EXP PUSH2 0x1897 MUL DUP2 MSTORE POP SWAP1 ISZERO ISZERO PUSH2 0xF1 JUMPI PUSH1 0x40 MLOAD PUSH1 0xE5 PUSH1 0x2 EXP PUSH3 0x461BCD MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xE8 SWAP2 SWAP1 PUSH2 0x291 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST POP DUP3 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x101 JUMPI INVALID JUMPDEST ADD PUSH1 0x20 ADD MLOAD PUSH1 0xF8 PUSH1 0x2 EXP SWAP1 DUP2 SWAP1 DIV DUP2 MUL DIV SWAP2 POP PUSH2 0x11F DUP4 PUSH1 0x1 PUSH2 0x126 JUMP JUMPDEST SWAP1 POP SWAP2 POP SWAP2 JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x14 ADD DUP4 MLOAD LT ISZERO PUSH1 0x60 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x2B DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0x4C656E677468206D7573742062652067726561746572207468616E206F722065 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0xA9 PUSH1 0x2 EXP PUSH11 0x38BAB0B6103A3790191817 MUL DUP2 MSTORE POP SWAP1 ISZERO ISZERO PUSH2 0x1A1 JUMPI PUSH1 0x40 MLOAD PUSH1 0xE5 PUSH1 0x2 EXP PUSH3 0x461BCD MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xE8 SWAP2 SWAP1 PUSH2 0x291 JUMP JUMPDEST POP POP ADD PUSH1 0x14 ADD MLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x1C5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x1D8 PUSH2 0x1D3 DUP3 PUSH2 0x2EA JUMP JUMPDEST PUSH2 0x2C4 JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH2 0x1F4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1FF DUP4 DUP3 DUP5 PUSH2 0x327 JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x21A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT ISZERO PUSH2 0x230 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x23C DUP5 DUP3 DUP6 ADD PUSH2 0x1B4 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH2 0x24D DUP2 PUSH2 0x315 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x25E DUP3 PUSH2 0x311 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH2 0x272 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0x333 JUMP JUMPDEST PUSH2 0x27B DUP2 PUSH2 0x363 JUMP JUMPDEST SWAP1 SWAP4 ADD PUSH1 0x20 ADD SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x24D DUP2 PUSH2 0x321 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2A2 DUP2 DUP5 PUSH2 0x253 JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH2 0x2B7 DUP3 DUP6 PUSH2 0x288 JUMP JUMPDEST PUSH2 0x2A2 PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x244 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x2E2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP3 GT ISZERO PUSH2 0x300 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH1 0x1F NOT AND ADD SWAP1 JUMP JUMPDEST MLOAD SWAP1 JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND SWAP1 JUMP JUMPDEST PUSH1 0xFF AND SWAP1 JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x34E JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x336 JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0x35D JUMPI PUSH1 0x0 DUP5 DUP5 ADD MSTORE JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x1F ADD PUSH1 0x1F NOT AND SWAP1 JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 ADDMOD 0xb7 PUSH2 0x8B6 0xbf CALLDATASIZE LOG2 PUSH23 0x6E799F617E47A5FEAB326E99D46EA5C5BCB8D7DFC682DB PUSH13 0x6578706572696D656E74616CF5 STOP CALLDATACOPY ",
+ "sourceMap": "709:592:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;709:592:0;;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600436106100275763ffffffff60e060020a600035041663bd27c22d811461002c575b600080fd5b34801561003857600080fd5b5061004c610047366004610208565b610063565b60405161005a9291906102a9565b60405180910390f35b60008061006f83610078565b91509150915091565b6000808251601514606060405190810160405280602281526020017f4d65746164617461206d75737420686176652061206c656e677468206f662032815260200160f160020a611897028152509015156100f15760405160e560020a62461bcd0281526004016100e89190610291565b60405180910390fd5b5082600081518110151561010157fe5b016020015160f860020a90819004810204915061011f836001610126565b9050915091565b60008160140183511015606060405190810160405280602b81526020017f4c656e677468206d7573742062652067726561746572207468616e206f722065815260200160a960020a6a38bab0b6103a3790191817028152509015156101a15760405160e560020a62461bcd0281526004016100e89190610291565b50500160140151600160a060020a031690565b6000601f820183136101c557600080fd5b81356101d86101d3826102ea565b6102c4565b915080825260208301602083018583830111156101f457600080fd5b6101ff838284610327565b50505092915050565b60006020828403121561021a57600080fd5b81356001604060020a0381111561023057600080fd5b61023c848285016101b4565b949350505050565b61024d81610315565b82525050565b600061025e82610311565b808452610272816020860160208601610333565b61027b81610363565b9093016020019392505050565b61024d81610321565b602080825281016102a28184610253565b9392505050565b604081016102b78285610288565b6102a26020830184610244565b6040518181016001604060020a03811182821017156102e257600080fd5b604052919050565b60006001604060020a0382111561030057600080fd5b506020601f91909101601f19160190565b5190565b600160a060020a031690565b60ff1690565b82818337506000910152565b60005b8381101561034e578181015183820152602001610336565b8381111561035d576000848401525b50505050565b601f01601f1916905600a265627a7a7230582008b76108b6bf36a2766e799f617e47a5feab326e99d46ea5c5bcb8d7dfc682db6c6578706572696d656e74616cf50037",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x27 JUMPI PUSH4 0xFFFFFFFF PUSH1 0xE0 PUSH1 0x2 EXP PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0xBD27C22D DUP2 EQ PUSH2 0x2C JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x38 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x4C PUSH2 0x47 CALLDATASIZE PUSH1 0x4 PUSH2 0x208 JUMP JUMPDEST PUSH2 0x63 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x5A SWAP3 SWAP2 SWAP1 PUSH2 0x2A9 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x6F DUP4 PUSH2 0x78 JUMP JUMPDEST SWAP2 POP SWAP2 POP SWAP2 POP SWAP2 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP3 MLOAD PUSH1 0x15 EQ PUSH1 0x60 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x22 DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0x4D65746164617461206D75737420686176652061206C656E677468206F662032 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0xF1 PUSH1 0x2 EXP PUSH2 0x1897 MUL DUP2 MSTORE POP SWAP1 ISZERO ISZERO PUSH2 0xF1 JUMPI PUSH1 0x40 MLOAD PUSH1 0xE5 PUSH1 0x2 EXP PUSH3 0x461BCD MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xE8 SWAP2 SWAP1 PUSH2 0x291 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST POP DUP3 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x101 JUMPI INVALID JUMPDEST ADD PUSH1 0x20 ADD MLOAD PUSH1 0xF8 PUSH1 0x2 EXP SWAP1 DUP2 SWAP1 DIV DUP2 MUL DIV SWAP2 POP PUSH2 0x11F DUP4 PUSH1 0x1 PUSH2 0x126 JUMP JUMPDEST SWAP1 POP SWAP2 POP SWAP2 JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x14 ADD DUP4 MLOAD LT ISZERO PUSH1 0x60 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x2B DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0x4C656E677468206D7573742062652067726561746572207468616E206F722065 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0xA9 PUSH1 0x2 EXP PUSH11 0x38BAB0B6103A3790191817 MUL DUP2 MSTORE POP SWAP1 ISZERO ISZERO PUSH2 0x1A1 JUMPI PUSH1 0x40 MLOAD PUSH1 0xE5 PUSH1 0x2 EXP PUSH3 0x461BCD MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xE8 SWAP2 SWAP1 PUSH2 0x291 JUMP JUMPDEST POP POP ADD PUSH1 0x14 ADD MLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x1C5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x1D8 PUSH2 0x1D3 DUP3 PUSH2 0x2EA JUMP JUMPDEST PUSH2 0x2C4 JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH2 0x1F4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1FF DUP4 DUP3 DUP5 PUSH2 0x327 JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x21A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT ISZERO PUSH2 0x230 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x23C DUP5 DUP3 DUP6 ADD PUSH2 0x1B4 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH2 0x24D DUP2 PUSH2 0x315 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x25E DUP3 PUSH2 0x311 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH2 0x272 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0x333 JUMP JUMPDEST PUSH2 0x27B DUP2 PUSH2 0x363 JUMP JUMPDEST SWAP1 SWAP4 ADD PUSH1 0x20 ADD SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x24D DUP2 PUSH2 0x321 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2A2 DUP2 DUP5 PUSH2 0x253 JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH2 0x2B7 DUP3 DUP6 PUSH2 0x288 JUMP JUMPDEST PUSH2 0x2A2 PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x244 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x2E2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP3 GT ISZERO PUSH2 0x300 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH1 0x1F NOT AND ADD SWAP1 JUMP JUMPDEST MLOAD SWAP1 JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND SWAP1 JUMP JUMPDEST PUSH1 0xFF AND SWAP1 JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x34E JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x336 JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0x35D JUMPI PUSH1 0x0 DUP5 DUP5 ADD MSTORE JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x1F ADD PUSH1 0x1F NOT AND SWAP1 JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 ADDMOD 0xb7 PUSH2 0x8B6 0xbf CALLDATASIZE LOG2 PUSH23 0x6E799F617E47A5FEAB326E99D46EA5C5BCB8D7DFC682DB PUSH13 0x6578706572696D656E74616CF5 STOP CALLDATACOPY ",
+ "sourceMap": "709:592:0:-;;;;;;;;;-1:-1:-1;;;709:592:0;;;;;;;;;;;;;823:170;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;823:170:0;;;;;;;;;;;;;;;;;;;;;;;;;;;923:5;930:7;960:26;976:9;960:15;:26::i;:::-;953:33;;;;823:170;;;:::o;965:393:1:-;1074:13;1101;1160:9;:16;1180:2;1160:22;1196:29;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1196:29:1;;;1139:96;;;;;;;-1:-1:-1;;;;;1139:96:1;;;;;;;;;;;;;;;;;;;1261:9;1271:1;1261:12;;;;;;;;;;;;;;-1:-1:-1;;;1261:12:1;;;;;;1255:19;;-1:-1:-1;1292:25:1;1304:9;1315:1;1292:11;:25::i;:::-;1284:33;-1:-1:-1;965:393:1;;;:::o;2204:868:2:-;2325:14;2388:5;2396:2;2388:10;2376:1;:8;:22;;2440;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;2440:22:2;;;2355:117;;;;;;;-1:-1:-1;;;;;2355:117:2;;;;;;;;;;-1:-1:-1;;2974:13:2;2719:2;2974:13;2968:20;-1:-1:-1;;;;;2964:69:2;;2204:868::o;6:440:-1:-;;100:4;88:17;;84:27;-1:-1;74:2;;125:1;122;115:12;74:2;162:6;149:20;184:64;199:48;240:6;199:48;;;184:64;;;175:73;;268:6;261:5;254:21;304:4;296:6;292:17;337:4;330:5;326:16;372:3;363:6;358:3;354:16;351:25;348:2;;;389:1;386;379:12;348:2;399:41;433:6;428:3;423;399:41;;;67:379;;;;;;;;454:345;;567:2;555:9;546:7;542:23;538:32;535:2;;;583:1;580;573:12;535:2;618:31;;-1:-1;;;;;658:30;;655:2;;;701:1;698;691:12;655:2;721:62;775:7;766:6;755:9;751:22;721:62;;;711:72;529:270;-1:-1;;;;529:270;806:110;879:31;904:5;879:31;;;874:3;867:44;861:55;;;923:292;;1021:35;1050:5;1021:35;;;1073:6;1068:3;1061:19;1085:63;1141:6;1134:4;1129:3;1125:14;1118:4;1111:5;1107:16;1085:63;;;1180:29;1202:6;1180:29;;;1160:50;;;1173:4;1160:50;;1001:214;-1:-1;;;1001:214;1222:104;1291:29;1314:5;1291:29;;1333:273;1457:2;1471:47;;;1442:18;;1532:64;1442:18;1582:6;1532:64;;;1524:72;1428:178;-1:-1;;;1428:178;1613:286;1745:2;1730:18;;1759:57;1734:9;1789:6;1759:57;;;1827:62;1885:2;1874:9;1870:18;1861:6;1827:62;;1906:256;1968:2;1962:9;1994:17;;;-1:-1;;;;;2054:34;;2090:22;;;2051:62;2048:2;;;2126:1;2123;2116:12;2048:2;2142;2135:22;1946:216;;-1:-1;1946:216;2169:258;;-1:-1;;;;;2304:6;2301:30;2298:2;;;2344:1;2341;2334:12;2298:2;-1:-1;2417:4;2388;2365:17;;;;-1:-1;;2361:33;2407:15;;2235:192;2434:88;2505:12;;2489:33;2529:128;-1:-1;;;;;2598:54;;2581:76;2664:88;2742:4;2731:16;;2714:38;2760:145;2841:6;2836:3;2831;2818:30;-1:-1;2897:1;2879:16;;2872:27;2811:94;2914:268;2979:1;2986:101;3000:6;2997:1;2994:13;2986:101;;;3067:11;;;3061:18;3048:11;;;3041:39;3022:2;3015:10;2986:101;;;3102:6;3099:1;3096:13;3093:2;;;3167:1;3158:6;3153:3;3149:16;3142:27;3093:2;2963:219;;;;;3190:97;3278:2;3258:14;-1:-1;;3254:28;;3238:49"
+ }
+ }
+ },
+ "sources": {
+ "current/test/TestLibAssetProxyDecoder/TestLibAssetProxyDecoder.sol": {
+ "id": 0
+ },
+ "current/utils/LibAssetProxyDecoder/LibAssetProxyDecoder.sol": {
+ "id": 1
+ },
+ "current/utils/LibBytes/LibBytes.sol": {
+ "id": 2
+ },
+ "current/utils/LibMem/LibMem.sol": {
+ "id": 3
+ }
+ },
+ "sourceCodes": {
+ "current/test/TestLibAssetProxyDecoder/TestLibAssetProxyDecoder.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../../utils/LibAssetProxyDecoder/LibAssetProxyDecoder.sol\";\n\ncontract TestLibAssetProxyDecoder is\n LibAssetProxyDecoder\n{\n\n /// @dev Decodes ERC721 Asset Proxy data\n function publicDecodeERC20Data(bytes memory proxyData)\n public\n pure\n returns (uint8, address)\n {\n return decodeERC20Data(proxyData);\n }\n\n /// @dev Decodes ERC721 Asset Proxy data\n function publicDecodeERC721Data(bytes memory proxyData)\n internal\n pure\n returns (\n uint8,\n address,\n uint256,\n bytes memory\n )\n {\n return decodeERC721Data(proxyData);\n }\n}\n",
+ "current/utils/LibAssetProxyDecoder/LibAssetProxyDecoder.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../LibBytes/LibBytes.sol\";\n\ncontract LibAssetProxyDecoder is\n LibBytes\n{\n\n string constant INVALID_ERC20_METADATA_LENGTH = \"Metadata must have a length of 21.\";\n string constant INVALID_ERC721_METADATA_LENGTH = \"Metadata must have a length of at least 53.\";\n\n /// @dev Decodes ERC721 Asset Proxy data\n function decodeERC20Data(bytes memory proxyData)\n internal\n pure\n returns (\n uint8 proxyId,\n address token\n )\n {\n require(\n proxyData.length == 21,\n INVALID_ERC20_METADATA_LENGTH\n );\n proxyId = uint8(proxyData[0]);\n token = readAddress(proxyData, 1);\n\n return (proxyId, token);\n }\n\n /// @dev Decodes ERC721 Asset Proxy data\n function decodeERC721Data(bytes memory proxyData)\n internal\n pure\n returns (\n uint8 proxyId,\n address token,\n uint256 tokenId,\n bytes memory data\n )\n {\n require(\n proxyData.length >= 53,\n INVALID_ERC721_METADATA_LENGTH\n );\n proxyId = uint8(proxyData[0]);\n token = readAddress(proxyData, 1);\n tokenId = readUint256(proxyData, 21);\n if (proxyData.length > 53) {\n data = readBytes(proxyData, 53);\n }\n\n return (proxyId, token, tokenId, data);\n }\n}\n",
+ "current/utils/LibBytes/LibBytes.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.4.24;\n\nimport \"../LibMem/LibMem.sol\";\n\ncontract LibBytes is\n LibMem\n{\n\n // Revert reasons\n string constant GTE_20_LENGTH_REQUIRED = \"Length must be greater than or equal to 20.\";\n string constant GTE_32_LENGTH_REQUIRED = \"Length must be greater than or equal to 32.\";\n\n /// @dev Tests equality of two byte arrays.\n /// @param lhs First byte array to compare.\n /// @param rhs Second byte array to compare.\n /// @return True if arrays are the same. False otherwise.\n function areBytesEqual(bytes memory lhs, bytes memory rhs)\n internal\n pure\n returns (bool equal)\n {\n assembly {\n // Get the number of words occupied by <lhs>\n let lenFullWords := div(add(mload(lhs), 0x1F), 0x20)\n\n // Add 1 to the number of words, to account for the length field\n lenFullWords := add(lenFullWords, 0x1)\n\n // Test equality word-by-word.\n // Terminates early if there is a mismatch.\n for {let i := 0} lt(i, lenFullWords) {i := add(i, 1)} {\n let lhsWord := mload(add(lhs, mul(i, 0x20)))\n let rhsWord := mload(add(rhs, mul(i, 0x20)))\n equal := eq(lhsWord, rhsWord)\n if eq(equal, 0) {\n // Break\n i := lenFullWords\n }\n }\n }\n\n return equal;\n }\n\n /// @dev Reads an address from a position in a byte array.\n /// @param b Byte array containing an address.\n /// @param index Index in byte array of address.\n /// @return address from byte array.\n function readAddress(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (address result)\n {\n require(\n b.length >= index + 20, // 20 is length of address\n GTE_20_LENGTH_REQUIRED\n );\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Read address from array memory\n assembly {\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 20-byte mask to obtain address\n result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff)\n }\n return result;\n }\n\n /// @dev Writes an address into a specific position in a byte array.\n /// @param b Byte array to insert address into.\n /// @param index Index in byte array of address.\n /// @param input Address to put into byte array.\n function writeAddress(\n bytes memory b,\n uint256 index,\n address input\n )\n internal\n pure\n {\n require(\n b.length >= index + 20, // 20 is length of address\n GTE_20_LENGTH_REQUIRED\n );\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Store address into array memory\n assembly {\n // The address occupies 20 bytes and mstore stores 32 bytes.\n // First fetch the 32-byte word where we'll be storing the address, then\n // apply a mask so we have only the bytes in the word that the address will not occupy.\n // Then combine these bytes with the address and store the 32 bytes back to memory with mstore.\n\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 12-byte mask to obtain extra bytes occupying word of memory where we'll store the address\n let neighbors := and(mload(add(b, index)), 0xffffffffffffffffffffffff0000000000000000000000000000000000000000)\n\n // Store the neighbors and address into memory\n mstore(add(b, index), xor(input, neighbors))\n }\n }\n\n /// @dev Reads a bytes32 value from a position in a byte array.\n /// @param b Byte array containing a bytes32 value.\n /// @param index Index in byte array of bytes32 value.\n /// @return bytes32 value from byte array.\n function readBytes32(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes32 result)\n {\n require(\n b.length >= index + 32,\n GTE_32_LENGTH_REQUIRED\n );\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n result := mload(add(b, index))\n }\n return result;\n }\n\n /// @dev Writes a bytes32 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes32 to put into byte array.\n function writeBytes32(\n bytes memory b,\n uint256 index,\n bytes32 input\n )\n internal\n pure\n {\n require(\n b.length >= index + 32,\n GTE_32_LENGTH_REQUIRED\n );\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n mstore(add(b, index), input)\n }\n }\n\n /// @dev Reads a uint256 value from a position in a byte array.\n /// @param b Byte array containing a uint256 value.\n /// @param index Index in byte array of uint256 value.\n /// @return uint256 value from byte array.\n function readUint256(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (uint256 result)\n {\n return uint256(readBytes32(b, index));\n }\n\n /// @dev Writes a uint256 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input uint256 to put into byte array.\n function writeUint256(\n bytes memory b,\n uint256 index,\n uint256 input\n )\n internal\n pure\n {\n writeBytes32(b, index, bytes32(input));\n }\n\n /// @dev Reads a uint256 value from a position in a byte array.\n /// @param b Byte array containing a uint256 value.\n /// @param index Index in byte array of uint256 value.\n /// @return uint256 value from byte array.\n function readBytes(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes memory result)\n {\n // Read length of nested bytes\n require(\n b.length >= index + 32,\n GTE_32_LENGTH_REQUIRED\n );\n uint256 nestedBytesLength = readUint256(b, index);\n\n // Assert length of <b> is valid, given\n // length of nested bytes\n require(\n b.length >= index + 32 + nestedBytesLength,\n GTE_32_LENGTH_REQUIRED\n );\n\n // Allocate memory and copy value to result\n result = new bytes(nestedBytesLength);\n memcpy(\n getMemAddress(result) + 32, // +32 skips array length\n getMemAddress(b) + index + 32, // +32 skips array length\n nestedBytesLength\n );\n\n return result;\n }\n\n /// @dev Writes a uint256 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input uint256 to put into byte array.\n function writeBytes(\n bytes memory b,\n uint256 index,\n bytes memory input\n )\n internal\n pure\n {\n // Read length of nested bytes\n require(\n b.length >= index + 32 /* 32 bytes to store length */ + input.length,\n GTE_32_LENGTH_REQUIRED\n );\n\n // Copy <input> into <b>\n memcpy(\n getMemAddress(b) + index,\n getMemAddress(input),\n input.length + 32 /* 32 bytes to store length */\n );\n }\n}\n",
+ "current/utils/LibMem/LibMem.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.4.24;\n\ncontract LibMem {\n\n function getMemAddress(bytes memory input)\n internal\n pure\n returns (uint256 address_)\n {\n assembly {\n address_ := input\n }\n return address_;\n }\n\n /// @dev Writes a uint256 into a specific position in a byte array.\n /// @param dest memory adress to copy bytes to\n function memcpy(\n uint256 dest,\n uint256 source,\n uint256 length\n )\n internal\n pure\n {\n // Base cases\n if(length == 0) return;\n if(source == dest) return;\n\n // Copy bytes from source to dest\n assembly {\n // Compute number of complete words to copy + remaining bytes\n let lenFullWords := div(add(length, 0x1F), 0x20)\n let remainder := mod(length, 0x20)\n if gt(remainder, 0) {\n lenFullWords := sub(lenFullWords, 1)\n }\n\n // Copy full words from source to dest\n let offset := 0\n let maxOffset := mul(0x20, lenFullWords)\n for {offset := 0} lt(offset, maxOffset) {offset := add(offset, 0x20)} {\n mstore(add(dest, offset), mload(add(source, offset)))\n }\n\n // Copy remaining bytes\n if gt(remainder, 0) {\n // Read a full word from source, containing X bytes to copy to dest.\n // We only want to keep the X bytes, zeroing out the remaining bytes.\n // We accomplish this by a right shift followed by a left shift.\n // Example:\n // Suppose a word of 8 bits has all 1's: [11111111]\n // Let X = 7 (we want to copy the first 7 bits)\n // Apply a right shift of 1: [01111111]\n // Apply a left shift of 1: [11111110]\n let sourceShiftFactor := exp(2, mul(8, sub(0x20, remainder)))\n let sourceWord := mload(add(source, offset))\n let sourceBytes := mul(div(sourceWord, sourceShiftFactor), sourceShiftFactor)\n\n // Read a full word from dest, containing (32-X) bytes to retain.\n // We need to zero out the remaining bytes to be overwritten by source,\n // while retaining the (32-X) bytes we don't want to overwrite.\n // We accomplish this by a left shift followed by a right shift.\n // Example:\n // Suppose a word of 8 bits has all 1's: [11111111]\n // Let X = 7 (we want to free the first 7 bits, and retain the last bit)\n // Apply a left shift of 1: [11111110]\n // Apply a right shift of 1: [01111111]\n let destShiftFactor := exp(2, mul(8, remainder))\n let destWord := mload(add(dest, offset))\n let destBytes := div(mul(destWord, destShiftFactor), destShiftFactor)\n\n // Combine the source and dest bytes. There should be no overlap:\n // The source bytes run from [0..X-1] and the dest bytes from [X..31].\n // Example:\n // Following the example from above, we have [11111110]\n // from the source word and [01111111] from the dest word.\n // Combine these words using <or> to get [11111111].\n let combinedDestWord := or(sourceBytes, destBytes)\n\n // Store the combined word into dest\n mstore(add(dest, offset), combinedDestWord)\n }\n }\n }\n}\n"
+ },
+ "sourceTreeHashHex": "0x8431fff2ae9424603c06a10d9c4649edf92a798a8969fe69339fc0063b7ad144",
+ "compiler": {
+ "name": "solc",
+ "version": "0.4.24",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 0
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file