aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-05-27 00:54:56 +0800
committerGitHub <noreply@github.com>2017-05-27 00:54:56 +0800
commitb897bdab79fe566ffc8c19c6ec9f1bb7260fa95e (patch)
tree65abedae4adfa1694db877a8e041e57c29a547f9
parentf338c68f126cba0f1b49c2928f276158b64d8ee7 (diff)
parent5d4c2dcb2950747c7cb2d95df340c23c981d70d3 (diff)
downloaddexon-sol-tools-b897bdab79fe566ffc8c19c6ec9f1bb7260fa95e.tar
dexon-sol-tools-b897bdab79fe566ffc8c19c6ec9f1bb7260fa95e.tar.gz
dexon-sol-tools-b897bdab79fe566ffc8c19c6ec9f1bb7260fa95e.tar.bz2
dexon-sol-tools-b897bdab79fe566ffc8c19c6ec9f1bb7260fa95e.tar.lz
dexon-sol-tools-b897bdab79fe566ffc8c19c6ec9f1bb7260fa95e.tar.xz
dexon-sol-tools-b897bdab79fe566ffc8c19c6ec9f1bb7260fa95e.tar.zst
dexon-sol-tools-b897bdab79fe566ffc8c19c6ec9f1bb7260fa95e.zip
Merge pull request #14 from 0xProject/implementFirstExchangeMethod
Implement first exchange method
-rw-r--r--.gitignore2
-rw-r--r--circle.yml6
-rw-r--r--package.json28
-rw-r--r--src/artifacts/EtherToken.json339
-rw-r--r--src/artifacts/Exchange.json985
-rw-r--r--src/artifacts/Mintable.json189
-rw-r--r--src/artifacts/Proxy.json267
-rw-r--r--src/artifacts/Token.json176
-rw-r--r--src/artifacts/TokenRegistry.json1002
-rw-r--r--src/ts/0x.js.ts27
-rw-r--r--src/ts/contract_wrappers/contract_wrapper.ts48
-rw-r--r--src/ts/contract_wrappers/exchange_wrapper.ts37
-rw-r--r--src/ts/globals.d.ts33
-rw-r--r--src/ts/types.ts21
-rw-r--r--src/ts/utils/assert.ts21
-rw-r--r--src/ts/utils/constants.ts2
-rw-r--r--src/ts/utils/utils.ts7
-rw-r--r--src/ts/web3_wrapper.ts69
-rw-r--r--test/0x.js_test.ts (renamed from test/0x.js.ts)0
-rw-r--r--test/contract_wrapper_test.ts98
-rw-r--r--test/utils/blockchain_lifecycle.ts20
-rw-r--r--test/utils/constants.ts5
-rw-r--r--test/utils/rpc.ts48
-rw-r--r--test/utils/web3_factory.ts23
-rw-r--r--webpack.config.js26
25 files changed, 3439 insertions, 40 deletions
diff --git a/.gitignore b/.gitignore
index 3c6a1ab6f..4e1909a58 100644
--- a/.gitignore
+++ b/.gitignore
@@ -59,8 +59,6 @@ typings/
# built library using in commonjs module syntax
lib
-# built library using es6 module syntax to enable webpack and rollup tree shaking
-lib-esm
# UMD bundles that export the global variable
_bundles
diff --git a/circle.yml b/circle.yml
index 65db7c29a..cce012832 100644
--- a/circle.yml
+++ b/circle.yml
@@ -4,4 +4,10 @@ machine:
test:
override:
+ - node node_modules/ethereumjs-testrpc/bin/testrpc:
+ background: true
+ - git clone git@github.com:0xProject/contracts.git ../contracts
+ - cd ../contracts; git checkout 38c2b4c; npm install && npm run migrate
+ - npm run update_contracts
- npm run test:coverage
+ - npm run lint
diff --git a/package.json b/package.json
index e6281afae..d83c1d095 100644
--- a/package.json
+++ b/package.json
@@ -10,17 +10,21 @@
"exchange"
],
"scripts": {
- "clean": "shx rm -rf _bundles lib lib-esm",
+ "clean": "shx rm -rf _bundles lib",
"build:bundle": "webpack",
- "build:commonjs": "tsc",
- "build:es6": "tsc -m es6 --outDir lib-esm",
+ "build:commonjs": "tsc; copyfiles -u 2 ./src/artifacts/*.json ../0x.js/lib/src/artifacts;",
"build": "npm run clean && run-p build:*",
"lint": "tslint src/ts/**/*",
- "test": "run-s clean build:commonjs && mocha lib/test/**/*.js",
+ "test": "run-s clean build:commonjs && mocha lib/test/**/*_test.js",
"test:coverage": "nyc npm run test --all",
"docs:json": "typedoc --json docs/index.json .",
"docs:generate": "typedoc --out docs .",
- "docs:open": "opn docs/index.html"
+ "docs:open": "opn docs/index.html",
+ "update_contracts": "for i in ${npm_package_config_artifacts}; do copyfiles -u 4 ../contracts/build/contracts/$i.json ../0x.js/src/artifacts; done;",
+ "testrpc": "testrpc -p 8545 --networkId 50"
+ },
+ "config": {
+ "artifacts": "Proxy Exchange TokenRegistry Token Mintable EtherToken"
},
"repository": {
"type": "git",
@@ -33,31 +37,43 @@
"devDependencies": {
"@types/bignumber.js": "^4.0.2",
"@types/chai": "^3.5.2",
+ "@types/chai-as-promised": "0.0.30",
+ "@types/jsonschema": "^1.1.1",
+ "@types/lodash": "^4.14.64",
"@types/mocha": "^2.2.41",
"@types/node": "^7.0.22",
"awesome-typescript-loader": "^3.1.3",
"bignumber.js": "^4.0.2",
"chai": "^3.5.0",
+ "chai-as-promised": "^6.0.0",
"chai-bignumber": "^2.0.0",
+ "copyfiles": "^1.2.0",
+ "ethereumjs-testrpc": "^3.0.5",
+ "json-loader": "^0.5.4",
"mocha": "^3.4.1",
"npm-run-all": "^4.0.2",
"nyc": "^10.3.2",
"opn-cli": "^3.1.0",
+ "request": "^2.81.0",
+ "request-promise-native": "^1.0.4",
"shx": "^0.2.2",
"source-map-support": "^0.4.15",
"tslint": "^5.3.2",
"tslint-config-0xproject": "^0.0.2",
"typedoc": "^0.7.1",
"typescript": "^2.3.3",
- "web3-typescript-typings": "0.0.3",
+ "web3-provider-engine": "^12.1.0",
+ "web3-typescript-typings": "0.0.8",
"webpack": "^2.6.0"
},
"dependencies": {
"bignumber.js": "^4.0.2",
+ "es6-promisify": "^5.0.0",
"ethereumjs-abi": "^0.6.4",
"ethereumjs-util": "^5.1.1",
"jsonschema": "^1.1.1",
"lodash": "^4.17.4",
+ "truffle-contract": "^2.0.0",
"web3": "^0.19.0"
}
}
diff --git a/src/artifacts/EtherToken.json b/src/artifacts/EtherToken.json
new file mode 100644
index 000000000..0593cdc95
--- /dev/null
+++ b/src/artifacts/EtherToken.json
@@ -0,0 +1,339 @@
+{
+ "contract_name": "EtherToken",
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "name",
+ "outputs": [
+ {
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_spender",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "approve",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "totalSupply",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "transferFrom",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "amount",
+ "type": "uint256"
+ }
+ ],
+ "name": "withdraw",
+ "outputs": [],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "decimals",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint8"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ }
+ ],
+ "name": "balanceOf",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "symbol",
+ "outputs": [
+ {
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "transfer",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [],
+ "name": "deposit",
+ "outputs": [],
+ "payable": true,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "name": "_spender",
+ "type": "address"
+ }
+ ],
+ "name": "allowance",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Transfer",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_spender",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Approval",
+ "type": "event"
+ }
+ ],
+ "unlinked_binary": "0x606060405234610000575b61072d806100196000396000f300606060405236156100935763ffffffff60e060020a60003504166306fdde038114610098578063095ea7b31461012557806318160ddd1461015557806323b872dd146101745780632e1a7d4d146101aa578063313ce567146101bc57806370a08231146101df57806395d89b411461020a578063a9059cbb14610297578063d0e30db0146102c7578063dd62ed3e146102d1575b610000565b34610000576100a5610302565b6040805160208082528351818301528351919283929083019185019080838382156100eb575b8051825260208311156100eb57601f1990920191602091820191016100cb565b505050905090810190601f1680156101175780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3461000057610141600160a060020a0360043516602435610339565b604080519115158252519081900360200190f35b34610000576101626103a4565b60408051918252519081900360200190f35b3461000057610141600160a060020a03600435811690602435166044356103aa565b604080519115158252519081900360200190f35b34610000576101ba6004356104a7565b005b34610000576101c9610527565b6040805160ff9092168252519081900360200190f35b3461000057610162600160a060020a036004351661052c565b60408051918252519081900360200190f35b34610000576100a561054b565b6040805160208082528351818301528351919283929083019185019080838382156100eb575b8051825260208311156100eb57601f1990920191602091820191016100cb565b505050905090810190601f1680156101175780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3461000057610141600160a060020a0360043516602435610582565b604080519115158252519081900360200190f35b6101ba610634565b005b3461000057610162600160a060020a0360043581169060243516610683565b60408051918252519081900360200190f35b60408051808201909152600b81527f457468657220546f6b656e000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260016020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60025481565b600160a060020a0383166000908152602081905260408120546103cd90836106b0565b600160a060020a03808616600090815260208181526040808320949094556001815283822033909316825291909152205461040890836106b0565b600160a060020a0380861660009081526001602090815260408083203385168452825280832094909455918616815290819052205461044790836106c9565b600160a060020a038085166000818152602081815260409182902094909455805186815290519193928816927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35060015b9392505050565b600160a060020a0333166000908152602081905260409020546104ca90826106b0565b600160a060020a0333166000908152602081905260409020556002546104f090826106b0565b600255604051600160a060020a0333169082156108fc029083906000818181858888f19350505050151561052357610000565b5b50565b601281565b600160a060020a0381166000908152602081905260409020545b919050565b60408051808201909152600481527f5745544800000000000000000000000000000000000000000000000000000000602082015281565b600160a060020a0333166000908152602081905260408120546105a590836106b0565b600160a060020a0333811660009081526020819052604080822093909355908516815220546105d490836106c9565b600160a060020a03808516600081815260208181526040918290209490945580518681529051919333909316927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35060015b92915050565b600160a060020a03331660009081526020819052604090205461065790346106c9565b600160a060020a03331660009081526020819052604090205560025461067d90346106c9565b6002555b565b600160a060020a038083166000908152600160209081526040808320938516835292905220545b92915050565b60006106be838311156106f1565b508082035b92915050565b60008282016106e68482108015906106e15750838210155b6106f1565b8091505b5092915050565b80151561052357610000565b5b505600a165627a7a72305820b28cd5acca9bda15cda19b84401b1834ed21ef11cbefcfb3b7a366fe2680aa8e0029",
+ "networks": {
+ "42": {
+ "links": {},
+ "events": {
+ "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Transfer",
+ "type": "event"
+ },
+ "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_spender",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Approval",
+ "type": "event"
+ }
+ },
+ "updated_at": 1495042008609,
+ "address": "0xd5cbb5c0d14718a844b1e4cd141878a0e2a71760"
+ },
+ "50": {
+ "links": {},
+ "events": {
+ "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Transfer",
+ "type": "event"
+ },
+ "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_spender",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Approval",
+ "type": "event"
+ }
+ },
+ "updated_at": 1495030736786,
+ "address": "0x48bacb9266a570d521063ef5dd96e61686dbe788"
+ }
+ },
+ "schema_version": "0.0.5",
+ "updated_at": 1495042008609
+} \ No newline at end of file
diff --git a/src/artifacts/Exchange.json b/src/artifacts/Exchange.json
new file mode 100644
index 000000000..2c02bda11
--- /dev/null
+++ b/src/artifacts/Exchange.json
@@ -0,0 +1,985 @@
+{
+ "contract_name": "Exchange",
+ "abi": [
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "orderAddresses",
+ "type": "address[5]"
+ },
+ {
+ "name": "orderValues",
+ "type": "uint256[6]"
+ },
+ {
+ "name": "cancelValueT",
+ "type": "uint256"
+ }
+ ],
+ "name": "cancel",
+ "outputs": [
+ {
+ "name": "cancelledValueT",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "denominator",
+ "type": "uint256"
+ },
+ {
+ "name": "numerator",
+ "type": "uint256"
+ },
+ {
+ "name": "target",
+ "type": "uint256"
+ }
+ ],
+ "name": "isRoundingError",
+ "outputs": [
+ {
+ "name": "isError",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "bytes32"
+ }
+ ],
+ "name": "filled",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "bytes32"
+ }
+ ],
+ "name": "cancelled",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "name": "fillValue",
+ "type": "uint256"
+ },
+ {
+ "name": "target",
+ "type": "uint256"
+ }
+ ],
+ "name": "getPartialValue",
+ "outputs": [
+ {
+ "name": "partialValue",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "orderAddresses",
+ "type": "address[5][]"
+ },
+ {
+ "name": "orderValues",
+ "type": "uint256[6][]"
+ },
+ {
+ "name": "cancelValuesT",
+ "type": "uint256[]"
+ }
+ ],
+ "name": "batchCancel",
+ "outputs": [
+ {
+ "name": "success",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "orderAddresses",
+ "type": "address[5][]"
+ },
+ {
+ "name": "orderValues",
+ "type": "uint256[6][]"
+ },
+ {
+ "name": "fillValueT",
+ "type": "uint256"
+ },
+ {
+ "name": "shouldCheckTransfer",
+ "type": "bool"
+ },
+ {
+ "name": "v",
+ "type": "uint8[]"
+ },
+ {
+ "name": "r",
+ "type": "bytes32[]"
+ },
+ {
+ "name": "s",
+ "type": "bytes32[]"
+ }
+ ],
+ "name": "fillUpTo",
+ "outputs": [
+ {
+ "name": "filledValueT",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "a",
+ "type": "uint256"
+ },
+ {
+ "name": "b",
+ "type": "uint256"
+ }
+ ],
+ "name": "min",
+ "outputs": [
+ {
+ "name": "min",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "pubKey",
+ "type": "address"
+ },
+ {
+ "name": "hash",
+ "type": "bytes32"
+ },
+ {
+ "name": "v",
+ "type": "uint8"
+ },
+ {
+ "name": "r",
+ "type": "bytes32"
+ },
+ {
+ "name": "s",
+ "type": "bytes32"
+ }
+ ],
+ "name": "isValidSignature",
+ "outputs": [
+ {
+ "name": "isValid",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "orderAddresses",
+ "type": "address[5]"
+ },
+ {
+ "name": "orderValues",
+ "type": "uint256[6]"
+ },
+ {
+ "name": "fillValueT",
+ "type": "uint256"
+ },
+ {
+ "name": "shouldCheckTransfer",
+ "type": "bool"
+ },
+ {
+ "name": "v",
+ "type": "uint8"
+ },
+ {
+ "name": "r",
+ "type": "bytes32"
+ },
+ {
+ "name": "s",
+ "type": "bytes32"
+ }
+ ],
+ "name": "fill",
+ "outputs": [
+ {
+ "name": "filledValueT",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "orderAddresses",
+ "type": "address[5][]"
+ },
+ {
+ "name": "orderValues",
+ "type": "uint256[6][]"
+ },
+ {
+ "name": "fillValuesT",
+ "type": "uint256[]"
+ },
+ {
+ "name": "shouldCheckTransfer",
+ "type": "bool"
+ },
+ {
+ "name": "v",
+ "type": "uint8[]"
+ },
+ {
+ "name": "r",
+ "type": "bytes32[]"
+ },
+ {
+ "name": "s",
+ "type": "bytes32[]"
+ }
+ ],
+ "name": "batchFill",
+ "outputs": [
+ {
+ "name": "success",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "orderAddresses",
+ "type": "address[5][]"
+ },
+ {
+ "name": "orderValues",
+ "type": "uint256[6][]"
+ },
+ {
+ "name": "fillValuesT",
+ "type": "uint256[]"
+ },
+ {
+ "name": "v",
+ "type": "uint8[]"
+ },
+ {
+ "name": "r",
+ "type": "bytes32[]"
+ },
+ {
+ "name": "s",
+ "type": "bytes32[]"
+ }
+ ],
+ "name": "batchFillOrKill",
+ "outputs": [
+ {
+ "name": "success",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "PROXY",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "orderHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "getUnavailableValueT",
+ "outputs": [
+ {
+ "name": "unavailableValueT",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "orderAddresses",
+ "type": "address[5]"
+ },
+ {
+ "name": "orderValues",
+ "type": "uint256[6]"
+ }
+ ],
+ "name": "getOrderHash",
+ "outputs": [
+ {
+ "name": "orderHash",
+ "type": "bytes32"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "ZRX",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "orderAddresses",
+ "type": "address[5]"
+ },
+ {
+ "name": "orderValues",
+ "type": "uint256[6]"
+ },
+ {
+ "name": "fillValueT",
+ "type": "uint256"
+ },
+ {
+ "name": "v",
+ "type": "uint8"
+ },
+ {
+ "name": "r",
+ "type": "bytes32"
+ },
+ {
+ "name": "s",
+ "type": "bytes32"
+ }
+ ],
+ "name": "fillOrKill",
+ "outputs": [
+ {
+ "name": "success",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "name": "_zrx",
+ "type": "address"
+ },
+ {
+ "name": "_proxy",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "type": "constructor"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "maker",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "taker",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "feeRecipient",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "tokenM",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "tokenT",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "filledBy",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "valueM",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "valueT",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "feeM",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "feeT",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "expiration",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "filledValueT",
+ "type": "uint256"
+ },
+ {
+ "indexed": true,
+ "name": "tokens",
+ "type": "bytes32"
+ },
+ {
+ "indexed": false,
+ "name": "orderHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "LogFill",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "maker",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "feeRecipient",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "tokenM",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "tokenT",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "valueM",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "valueT",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "feeM",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "feeT",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "expiration",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "cancelledValueT",
+ "type": "uint256"
+ },
+ {
+ "indexed": true,
+ "name": "tokens",
+ "type": "bytes32"
+ },
+ {
+ "indexed": false,
+ "name": "orderHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "LogCancel",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "errorId",
+ "type": "uint8"
+ },
+ {
+ "indexed": true,
+ "name": "orderHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "LogError",
+ "type": "event"
+ }
+ ],
+ "unlinked_binary": "0x60606040523461000057604051604080611daa8339810160405280516020909101515b60008054600160a060020a03808516600160a060020a03199283161790925560018054928416929091169190911790555b50505b611d45806100656000396000f300606060405236156100d55763ffffffff60e060020a60003504166308eb4e9881146100da57806314df96ee1461014a578063288cdc91146101745780632ac1262214610196578063441b1b44146101b857806350ec2a6a146101e057806359b257201461032a5780637ae2b5c7146104e95780638163681e1461050e578063909f617e1461054a578063914ff398146105d4578063a2e855a5146107ce578063a8c92d48146109c0578063aae62507146109e9578063cfc4d0ec14610a0b578063d40fa8bf14610a79578063ddefdb9014610aa2575b610000565b34610000576040805160a08181019092526101389160049160a4918390600590839083908082843750506040805160c08181019092529496958181019594509250600691508390839080828437509395505092359250610b27915050565b60408051918252519081900360200190f35b3461000057610160600435602435604435610e9f565b604080519115158252519081900360200190f35b3461000057610138600435610ebe565b60408051918252519081900360200190f35b3461000057610138600435610ed0565b60408051918252519081900360200190f35b3461000057610138600435602435604435610ee2565b60408051918252519081900360200190f35b346100005761016060048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610257576040805160a0818101909252908084028701906005908390839080828437505050918352505060019091019060200161021b565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156102ca576040805160c0818101909252908084028701906006908390839080828437505050918352505060019091019060200161028e565b50505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750949650610f0195505050505050565b604080519115158252519081900360200190f35b346100005761013860048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156103a1576040805160a08181019092529080840287019060059083908390808284375050509183525050600190910190602001610365565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610414576040805160c081810190925290808402870190600690839083908082843750505091835250506001909101906020016103d8565b5050604080516020878301358901803582810280850184019095528084529799893599838101351515999198506060019650929450810192829185019084908082843750506040805187358901803560208181028481018201909552818452989a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989a998901989297509082019550935083925085019084908082843750949650610f6c95505050505050565b60408051918252519081900360200190f35b3461000057610138600435602435611075565b60408051918252519081900360200190f35b3461000057610160600160a060020a036004351660243560ff6044351660643560843561108f565b604080519115158252519081900360200190f35b34610000576040805160a08181019092526101389160049160a4918390600590839083908082843750506040805160c08181019092529496958181019594509250600691508390839080828437509395505083359360208101351515935060ff60408201351692506060810135915060800135611144565b60408051918252519081900360200190f35b346100005761016060048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561064b576040805160a0818101909252908084028701906005908390839080828437505050918352505060019091019060200161060f565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156106be576040805160c08181019092529080840287019060069083908390808284375050509183525050600190910190602001610682565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375050604080516020808901358a01803580830284810184018652818552999b8b3515159b909a950198509296508101945090925082919085019084908082843750506040805187358901803560208181028481018201909552818452989a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989a9989019892975090820195509350839250850190849080828437509496506116a395505050505050565b604080519115158252519081900360200190f35b346100005761016060048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610845576040805160a08181019092529080840287019060059083908390808284375050509183525050600190910190602001610809565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156108b8576040805160c0818101909252908084028701906006908390839080828437505050918352505060019091019060200161087c565b50505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750506040805187358901803560208181028481018201909552818452989a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989a99890198929750908201955093508392508501908490808284375094965061175295505050505050565b604080519115158252519081900360200190f35b34610000576109cd611806565b60408051600160a060020a039092168252519081900360200190f35b3461000057610138600435611815565b60408051918252519081900360200190f35b34610000576040805160a08181019092526101389160049160a4918390600590839083908082843750506040805160c0818101909252949695818101959450925060069150839083908082843750939550611841945050505050565b60408051918252519081900360200190f35b34610000576109cd6118fb565b60408051600160a060020a039092168252519081900360200190f35b34610000576040805160a08181019092526101609160049160a4918390600590839083908082843750506040805160c08181019092529496958181019594509250600691508390839080828437509395505083359360ff60208201351693506040810135925060600135905061190a565b604080519115158252519081900360200190f35b604080516101608181018352600080835260208301819052828401819052606083018190526080830181905260a0830181905260c0830181905260e083018190526101008301819052610120830181905261014083018190528351918201909352829080878360209081029190910151600160a060020a031682520187600160209081029190910151600160a060020a031682520187600260209081029190910151600160a060020a031682520187600360209081029190910151600160a060020a031682520187600460209081029190910151600160a060020a03168252018660006020908102919091015182520186600160209081029190910151825201866002602090810291909101518252018660036020908102919091015182520186600460200201518152602001610c5e8888611841565b600019168152509150610c8833600160a060020a03168360000151600160a060020a031614611934565b6101208201514210610cbd57610140820151604051600490600080516020611cfa83398151915290600090a360009250610e96565b610cd88260c00151610cd3846101400151611815565b611944565b9050610ce48482611075565b9250821515610d1657610140820151604051600590600080516020611cfa83398151915290600090a360009250610e96565b610140820151600090815260036020526040902054610d35908461195d565b600360008461014001516000191660001916815260200190815260200160002081905550816040015182606001516040518083600160a060020a0316600160a060020a0316606060020a02815260140182600160a060020a0316600160a060020a0316606060020a028152601401925050506040518091039020600019168260800151600160a060020a03168360000151600160a060020a03167f4565177cd5184f550db0ab57b1d5bc808f8e8ba0adcb13fb257f1e7cf019a2b6856040015186606001518760a001518860c001518960e001518a61010001518b61012001518d8d6101400151604051808a600160a060020a0316600160a060020a0316815260200189600160a060020a0316600160a060020a031681526020018881526020018781526020018681526020018581526020018481526020018381526020018260001916600019168152602001995050505050505050505060405180910390a45b50509392505050565b60006103e882108015610eb457508383830915155b90505b9392505050565b60026020526000908152604090205481565b60036020526000908152604090205481565b6000610eb4610ef18484611985565b856119b1565b90505b9392505050565b6000805b8451811015610f5f57610f55858281518110156100005790602001906020020151858381518110156100005790602001906020020151858481518110156100005790602001906020020151610b27565b505b600101610f05565b600191505b509392505050565b6000805b885181101561106857610fcb8960008151811015610000576020908102909101015160036020020151600160a060020a03168a83815181101561000057602090810291909101015160600151600160a060020a031614611934565b6110508261104b8b84815181101561000057906020019060200201518b85815181101561000057906020019060200201516110068c88611944565b8b8b88815181101561000057906020019060200201518b89815181101561000057906020019060200201518b8a81518110156100005790602001906020020151611144565b61195d565b91508682141561105f57611068565b5b600101610f70565b5b50979650505050505050565b600081831015611086575081611089565b50805b92915050565b604080517f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c8101869052815190819003603c018120600082815260208381018552928401819052835191825260ff8716828401528184018690526060820185905292516001926080808401939192601f198101928190039091019086866161da5a03f11561000057505060206040510351600160a060020a031686600160a060020a03161490505b95945050505050565b604080516101608181018352600080835260208301819052828401819052606083018190526080830181905260a0830181905260c0830181905260e0830181905261010083018190526101208301819052610140830181905283519182019093528290808b8360209081029190910151600160a060020a03168252018b600160209081029190910151600160a060020a03168252018b600260209081029190910151600160a060020a03168252018b600360209081029190910151600160a060020a03168252018b600460209081029190910151600160a060020a03168252018a6000602090810291909101518252018a6001602090810291909101518252018a6002602090810291909101518252018a6003602090810291909101518252018a60046020020151815260200161127b8c8c611841565b905260208101519092506112b890600160a060020a031615806112b3575033600160a060020a03168360200151600160a060020a0316145b611934565b61012082015142106112ec57610140820151604051600090600080516020611cfa833981519152908290a360009250611696565b6113078260c00151610cd3846101400151611815565b611944565b90506113138882611075565b925082151561134557610140820151604051600190600080516020611cfa83398151915290600090a360009250611696565b6113588260c00151848460a00151610e9f565b1561138657610140820151604051600290600080516020611cfa83398151915290600090a360009250611696565b86801561139a575061139882846119ee565b155b156113c857610140820151604051600390600080516020611cfa83398151915290600090a360009250611696565b6113e66112b3836000015184610140015189898961108f565b611934565b610140820151600090815260026020526040902054611405908461195d565b6101408301516000908152600260205260409081902091909155820151825160c084015160a0850151611451936112b393909290913391611447918a90610ee2565b611b57565b611934565b61146d6112b3836060015133856000015187611b57565b611934565b6080820151600160a060020a03161561151f5760008260e0015111156114d0576114d06112b3600060009054906101000a9004600160a060020a0316846000015185608001516114478760c00151898960e00151610ee2565b611b57565b611934565b5b6000826101000151111561151f5761151f6112b3600060009054906101000a9004600160a060020a03163385608001516114478760c0015189896101000151610ee2565b611b57565b611934565b5b5b816040015182606001516040518083600160a060020a0316600160a060020a0316606060020a02815260140182600160a060020a0316600160a060020a0316606060020a028152601401925050506040518091039020600019168260800151600160a060020a03168360000151600160a060020a03167fcf8bd4f6ec4f39997290cf18413805f1f190eebd60e32ffc174b56d07a355beb856020015186604001518760600151338960a001518a60c001518b60e001518c61010001518d61012001518f8f6101400151604051808c600160a060020a0316600160a060020a031681526020018b600160a060020a0316600160a060020a031681526020018a600160a060020a0316600160a060020a0316815260200189600160a060020a0316600160a060020a0316815260200188815260200187815260200186815260200185815260200184815260200183815260200182600019166000191681526020019b50505050505050505050505060405180910390a45b5050979650505050505050565b6000805b88518110156117415761173789828151811015610000579060200190602002015189838151811015610000579060200190602002015189848151811015610000579060200190602002015189898681518110156100005790602001906020020151898781518110156100005790602001906020020151898881518110156100005790602001906020020151611144565b505b6001016116a7565b600191505b50979650505050505050565b6000805b87518110156117f6576117ed6112b389838151811015610000579060200190602002015189848151811015610000579060200190602002015189858151811015610000579060200190602002015189868151811015610000579060200190602002015189878151811015610000579060200190602002015189888151811015610000579060200190602002015161190a565b611934565b5b600101611756565b600191505b509695505050505050565b600154600160a060020a031681565b6000818152600260209081526040808320546003909252822054611839919061195d565b90505b919050565b81516020808401516040808601516060808801516080808a01518951978a01518a870151948b0151928b015160a08c01518851606060020a30600160a060020a03908116820283529d8e16810260148301529a8d168b026028820152978c168a02603c890152948b16890260508801529990911690960260648501526078840196909652609883019490945260b882015260d881019390935260f88301939093526101188201529051908190036101380190205b92915050565b600054600160a060020a031681565b60006119268561192089898960008a8a8a611144565b14611934565b5060015b9695505050505050565b80151561194057610000565b5b50565b600061195283831115611934565b508082035b92915050565b600082820161197a8482108015906112b35750838210155b611934565b8091505b5092915050565b600082820261197a8415806112b3575083858381156100005704145b611934565b8091505b5092915050565b600060006119c160008411611934565b828481156100005704905061197a838581156100005706828502018514611934565b8091505b5092915050565b60006000600060006000339350611a0e8760c00151878960a00151610ee2565b925082611a2388604001518960000151611bf5565b1080611a3f575082611a3d88604001518960000151611c6e565b105b80611a56575085611a54886060015186611bf5565b105b80611a6d575085611a6b886060015186611c6e565b105b15611a7b5760009450611b4d565b6080870151600160a060020a031615611b4757611aa18760c00151878960e00151610ee2565b9150611ab78760c0015187896101000151610ee2565b60005488519192508391611ad491600160a060020a031690611bf5565b1080611af9575060005487518391611af791600160a060020a0390911690611c6e565b105b80611b1957506000548190611b1790600160a060020a031686611bf5565b105b80611b3957506000548190611b3790600160a060020a031686611c6e565b105b15611b475760009450611b4d565b5b600194505b5050505092915050565b600154604080516000602091820181905282517f15dacbea000000000000000000000000000000000000000000000000000000008152600160a060020a03898116600483015288811660248301528781166044830152606482018790529351919493909316926315dacbea92608480830193919282900301818787803b156100005760325a03f115610000575050604051519150505b949350505050565b600082600160a060020a03166370a08231836000604051602001526040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b156100005760325a03f115610000575050604051519150505b92915050565b600154604080516000602091820181905282517fdd62ed3e000000000000000000000000000000000000000000000000000000008152600160a060020a03868116600483015294851660248201529251909386169263dd62ed3e92604480830193919282900301818787803b156100005760325a03f115610000575050604051519150505b92915050560036d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e90a165627a7a72305820c38121e5be6034e2506e831cd8172fb06c61260660ac3820aa8e51797ba32ef10029",
+ "networks": {
+ "42": {
+ "links": {},
+ "events": {
+ "0xcf8bd4f6ec4f39997290cf18413805f1f190eebd60e32ffc174b56d07a355beb": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "maker",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "taker",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "feeRecipient",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "tokenM",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "tokenT",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "filledBy",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "valueM",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "valueT",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "feeM",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "feeT",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "expiration",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "filledValueT",
+ "type": "uint256"
+ },
+ {
+ "indexed": true,
+ "name": "tokens",
+ "type": "bytes32"
+ },
+ {
+ "indexed": false,
+ "name": "orderHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "LogFill",
+ "type": "event"
+ },
+ "0x4565177cd5184f550db0ab57b1d5bc808f8e8ba0adcb13fb257f1e7cf019a2b6": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "maker",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "feeRecipient",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "tokenM",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "tokenT",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "valueM",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "valueT",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "feeM",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "feeT",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "expiration",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "cancelledValueT",
+ "type": "uint256"
+ },
+ {
+ "indexed": true,
+ "name": "tokens",
+ "type": "bytes32"
+ },
+ {
+ "indexed": false,
+ "name": "orderHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "LogCancel",
+ "type": "event"
+ },
+ "0x36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e90": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "errorId",
+ "type": "uint8"
+ },
+ {
+ "indexed": true,
+ "name": "orderHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "LogError",
+ "type": "event"
+ }
+ },
+ "updated_at": 1495042008606,
+ "address": "0x9ce1a5e2311f9b8b8e6b40ed20b5b090de4a4c4d"
+ },
+ "50": {
+ "links": {},
+ "events": {
+ "0xcf8bd4f6ec4f39997290cf18413805f1f190eebd60e32ffc174b56d07a355beb": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "maker",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "taker",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "feeRecipient",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "tokenM",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "tokenT",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "filledBy",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "valueM",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "valueT",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "feeM",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "feeT",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "expiration",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "filledValueT",
+ "type": "uint256"
+ },
+ {
+ "indexed": true,
+ "name": "tokens",
+ "type": "bytes32"
+ },
+ {
+ "indexed": false,
+ "name": "orderHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "LogFill",
+ "type": "event"
+ },
+ "0x4565177cd5184f550db0ab57b1d5bc808f8e8ba0adcb13fb257f1e7cf019a2b6": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "maker",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "feeRecipient",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "tokenM",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "tokenT",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "valueM",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "valueT",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "feeM",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "feeT",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "expiration",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "cancelledValueT",
+ "type": "uint256"
+ },
+ {
+ "indexed": true,
+ "name": "tokens",
+ "type": "bytes32"
+ },
+ {
+ "indexed": false,
+ "name": "orderHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "LogCancel",
+ "type": "event"
+ },
+ "0x36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e90": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "errorId",
+ "type": "uint8"
+ },
+ {
+ "indexed": true,
+ "name": "orderHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "LogError",
+ "type": "event"
+ }
+ },
+ "updated_at": 1495030736784,
+ "address": "0xb69e673309512a9d726f87304c6984054f87a93b"
+ }
+ },
+ "schema_version": "0.0.5",
+ "updated_at": 1495042008606
+}
diff --git a/src/artifacts/Mintable.json b/src/artifacts/Mintable.json
new file mode 100644
index 000000000..026f294f2
--- /dev/null
+++ b/src/artifacts/Mintable.json
@@ -0,0 +1,189 @@
+{
+ "contract_name": "Mintable",
+ "abi": [
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_spender",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "approve",
+ "outputs": [
+ {
+ "name": "success",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "totalSupply",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "transferFrom",
+ "outputs": [
+ {
+ "name": "success",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ }
+ ],
+ "name": "balanceOf",
+ "outputs": [
+ {
+ "name": "balance",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "mint",
+ "outputs": [],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "transfer",
+ "outputs": [
+ {
+ "name": "success",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "name": "_spender",
+ "type": "address"
+ }
+ ],
+ "name": "allowance",
+ "outputs": [
+ {
+ "name": "remaining",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Transfer",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_spender",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Approval",
+ "type": "event"
+ }
+ ],
+ "unlinked_binary": "0x606060405234610000575b6104e7806100196000396000f300606060405236156100675763ffffffff60e060020a600035041663095ea7b3811461006c57806318160ddd1461009c57806323b872dd146100bb57806370a08231146100f1578063a0712d681461011c578063a9059cbb1461012e578063dd62ed3e1461015e575b610000565b3461000057610088600160a060020a036004351660243561018f565b604080519115158252519081900360200190f35b34610000576100a96101fa565b60408051918252519081900360200190f35b3461000057610088600160a060020a0360043581169060243516604435610200565b604080519115158252519081900360200190f35b34610000576100a9600160a060020a036004351661030d565b60408051918252519081900360200190f35b346100005761012c60043561032c565b005b3461000057610088600160a060020a0360043516602435610393565b604080519115158252519081900360200190f35b34610000576100a9600160a060020a0360043581169060243516610456565b60408051918252519081900360200190f35b600160a060020a03338116600081815260016020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60025481565b600160a060020a0383166000908152602081905260408120548290108015906102505750600160a060020a0380851660009081526001602090815260408083203390941683529290522054829010155b80156102755750600160a060020a038316600090815260208190526040902054828101115b1561030157600160a060020a0380841660008181526020818152604080832080548801905588851680845281842080548990039055600183528184203390961684529482529182902080548790039055815186815291519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3506001610305565b5060005b5b9392505050565b600160a060020a0381166000908152602081905260409020545b919050565b68056bc75e2d6310000081111561034257610000565b600160a060020a033316600090815260208190526040902054610366908290610483565b600160a060020a03331660009081526020819052604090205560025461038c9082610483565b6002555b50565b600160a060020a0333166000908152602081905260408120548290108015906103d55750600160a060020a038316600090815260208190526040902054828101115b1561044757600160a060020a0333811660008181526020818152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35060016101f4565b5060006101f4565b5b92915050565b600160a060020a038083166000908152600160209081526040808320938516835292905220545b92915050565b60008282016104a084821080159061049b5750838210155b6104ab565b8091505b5092915050565b80151561039057610000565b5b505600a165627a7a72305820cf19b2935b2a852369d6ff6508a8c5c3b184b660a7d117af9fd1c7224bdb1d2f0029",
+ "networks": {},
+ "schema_version": "0.0.5",
+ "updated_at": 1495030728122
+} \ No newline at end of file
diff --git a/src/artifacts/Proxy.json b/src/artifacts/Proxy.json
new file mode 100644
index 000000000..0d6faef35
--- /dev/null
+++ b/src/artifacts/Proxy.json
@@ -0,0 +1,267 @@
+{
+ "contract_name": "Proxy",
+ "abi": [
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "name": "from",
+ "type": "address"
+ },
+ {
+ "name": "to",
+ "type": "address"
+ },
+ {
+ "name": "value",
+ "type": "uint256"
+ }
+ ],
+ "name": "transferFrom",
+ "outputs": [
+ {
+ "name": "success",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "target",
+ "type": "address"
+ }
+ ],
+ "name": "addAuthorizedAddress",
+ "outputs": [
+ {
+ "name": "success",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "name": "authorities",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "target",
+ "type": "address"
+ }
+ ],
+ "name": "removeAuthorizedAddress",
+ "outputs": [
+ {
+ "name": "success",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "owner",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "authorized",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getAuthorizedAddresses",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address[]"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "transferOwnership",
+ "outputs": [],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "caller",
+ "type": "address"
+ }
+ ],
+ "name": "LogAuthorizedAddressAdded",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "caller",
+ "type": "address"
+ }
+ ],
+ "name": "LogAuthorizedAddressRemoved",
+ "type": "event"
+ }
+ ],
+ "unlinked_binary": "0x60606040525b60008054600160a060020a03191633600160a060020a03161790555b5b610701806100316000396000f300606060405236156100725763ffffffff60e060020a60003504166315dacbea811461007757806342f1181e146100b3578063494503d4146100e0578063707129391461010c5780638da5cb5b14610139578063b918161114610162578063d39de6e91461018f578063f2fde38b146101f7575b610000565b346100005761009f600160a060020a0360043581169060243581169060443516606435610212565b604080519115158252519081900360200190f35b346100005761009f600160a060020a03600435166102d8565b604080519115158252519081900360200190f35b34610000576100f06004356103f5565b60408051600160a060020a039092168252519081900360200190f35b346100005761009f600160a060020a0360043516610425565b604080519115158252519081900360200190f35b34610000576100f06105ee565b60408051600160a060020a039092168252519081900360200190f35b346100005761009f600160a060020a03600435166105fd565b604080519115158252519081900360200190f35b346100005761019c610612565b60408051602080825283518183015283519192839290830191858101910280838382156101e4575b8051825260208311156101e457601f1990920191602091820191016101c4565b5050509050019250505060405180910390f35b3461000057610210600160a060020a036004351661067d565b005b600160a060020a03331660009081526001602052604081205460ff16151561023957610000565b604080516000602091820181905282517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a0388811660048301528781166024830152604482018790529351938916936323b872dd9360648084019491938390030190829087803b156100005760325a03f11561000057505060405151151590506102cb57610000565b5060015b5b949350505050565b6000805433600160a060020a039081169116146102f457610000565b600160a060020a038216600090815260016020526040902054829060ff161561031c57610000565b600160a060020a0383166000908152600160208190526040909120805460ff191682179055600280549182018082559091908281838015829011610385576000838152602090206103859181019083015b80821115610381576000815560010161036d565b5090565b5b505050916000526020600020900160005b81546101009190910a600160a060020a0381810219909216878316918202179092556040513390911692507f94bb87f4c15c4587ff559a7584006fa01ddf9299359be6b512b94527aa961aca90600090a3600191505b5b505b919050565b600281815481101561000057906000526020600020900160005b915054906101000a9004600160a060020a031681565b60008054819033600160a060020a0390811691161461044357610000565b600160a060020a038316600090815260016020526040902054839060ff16151561046c57610000565b600160a060020a0384166000908152600160205260408120805460ff1916905591505b6002548210156105a75783600160a060020a0316600283815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316141561059b576002805460001981019081101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600283815481101561000057906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a031602179055506001600281818054905003915081815481835581811511610591576000838152602090206105919181019083015b80821115610381576000815560010161036d565b5090565b5b505050506105a7565b5b60019091019061048f565b604051600160a060020a0333811691908616907ff5b347a1e40749dd050f5f07fbdbeb7e3efa9756903044dd29401fd1d4bb4a1c90600090a3600192505b5b505b50919050565b600054600160a060020a031681565b60016020526000908152604090205460ff1681565b60408051602081810183526000825260028054845181840281018401909552808552929392909183018282801561067257602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610654575b505050505090505b90565b60005433600160a060020a0390811691161461069857610000565b600160a060020a038116156106d0576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b5b505600a165627a7a723058209cd95460fca24868b66555c9516a21cd9ea580df9649543a663b057f4de4808b0029",
+ "networks": {
+ "42": {
+ "links": {},
+ "events": {
+ "0x94bb87f4c15c4587ff559a7584006fa01ddf9299359be6b512b94527aa961aca": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "caller",
+ "type": "address"
+ }
+ ],
+ "name": "LogAuthorizedAddressAdded",
+ "type": "event"
+ },
+ "0xf5b347a1e40749dd050f5f07fbdbeb7e3efa9756903044dd29401fd1d4bb4a1c": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "caller",
+ "type": "address"
+ }
+ ],
+ "name": "LogAuthorizedAddressRemoved",
+ "type": "event"
+ }
+ },
+ "updated_at": 1495042008598,
+ "address": "0x72a2820f45b3e977897a63f2a726c21754f3730d"
+ },
+ "50": {
+ "links": {},
+ "events": {
+ "0x94bb87f4c15c4587ff559a7584006fa01ddf9299359be6b512b94527aa961aca": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "caller",
+ "type": "address"
+ }
+ ],
+ "name": "LogAuthorizedAddressAdded",
+ "type": "event"
+ },
+ "0xf5b347a1e40749dd050f5f07fbdbeb7e3efa9756903044dd29401fd1d4bb4a1c": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "caller",
+ "type": "address"
+ }
+ ],
+ "name": "LogAuthorizedAddressRemoved",
+ "type": "event"
+ }
+ },
+ "updated_at": 1495030736781,
+ "address": "0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c"
+ }
+ },
+ "schema_version": "0.0.5",
+ "updated_at": 1495042008598
+} \ No newline at end of file
diff --git a/src/artifacts/Token.json b/src/artifacts/Token.json
new file mode 100644
index 000000000..3bbcead41
--- /dev/null
+++ b/src/artifacts/Token.json
@@ -0,0 +1,176 @@
+{
+ "contract_name": "Token",
+ "abi": [
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_spender",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "approve",
+ "outputs": [
+ {
+ "name": "success",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "totalSupply",
+ "outputs": [
+ {
+ "name": "supply",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "transferFrom",
+ "outputs": [
+ {
+ "name": "success",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ }
+ ],
+ "name": "balanceOf",
+ "outputs": [
+ {
+ "name": "balance",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "transfer",
+ "outputs": [
+ {
+ "name": "success",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "name": "_spender",
+ "type": "address"
+ }
+ ],
+ "name": "allowance",
+ "outputs": [
+ {
+ "name": "remaining",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Transfer",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_spender",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Approval",
+ "type": "event"
+ }
+ ],
+ "unlinked_binary": "0x606060405234610000575b6101d1806100196000396000f3006060604052361561005c5763ffffffff60e060020a600035041663095ea7b3811461006157806318160ddd1461009157806323b872dd146100b057806370a08231146100e6578063a9059cbb14610061578063dd62ed3e14610141575b610000565b346100005761007d600160a060020a0360043516602435610172565b604080519115158252519081900360200190f35b346100005761009e61017b565b60408051918252519081900360200190f35b346100005761007d600160a060020a0360043581169060243516604435610181565b604080519115158252519081900360200190f35b346100005761009e600160a060020a036004351661018b565b60408051918252519081900360200190f35b346100005761007d600160a060020a0360043516602435610172565b604080519115158252519081900360200190f35b346100005761009e600160a060020a0360043581169060243516610172565b60408051918252519081900360200190f35b60005b92915050565b60005b90565b60005b9392505050565b60005b919050565b60005b92915050565b60005b929150505600a165627a7a7230582031ad84562e693d05c7c6f36cc87a07055903923d08faf214a07c4e7c3b2d4a8f0029",
+ "networks": {},
+ "schema_version": "0.0.5",
+ "updated_at": 1495030728125
+} \ No newline at end of file
diff --git a/src/artifacts/TokenRegistry.json b/src/artifacts/TokenRegistry.json
new file mode 100644
index 000000000..f9f4fafbc
--- /dev/null
+++ b/src/artifacts/TokenRegistry.json
@@ -0,0 +1,1002 @@
+{
+ "contract_name": "TokenRegistry",
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_name",
+ "type": "string"
+ }
+ ],
+ "name": "getTokenAddressByName",
+ "outputs": [
+ {
+ "name": "tokenAddress",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_token",
+ "type": "address"
+ },
+ {
+ "name": "_ipfsHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "setTokenIpfsHash",
+ "outputs": [],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_symbol",
+ "type": "string"
+ }
+ ],
+ "name": "getTokenAddressBySymbol",
+ "outputs": [
+ {
+ "name": "tokenAddress",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_token",
+ "type": "address"
+ }
+ ],
+ "name": "removeToken",
+ "outputs": [],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_token",
+ "type": "address"
+ }
+ ],
+ "name": "getTokenMetaData",
+ "outputs": [
+ {
+ "name": "tokenAddress",
+ "type": "address"
+ },
+ {
+ "name": "name",
+ "type": "string"
+ },
+ {
+ "name": "symbol",
+ "type": "string"
+ },
+ {
+ "name": "url",
+ "type": "string"
+ },
+ {
+ "name": "decimals",
+ "type": "uint8"
+ },
+ {
+ "name": "ipfsHash",
+ "type": "bytes32"
+ },
+ {
+ "name": "swarmHash",
+ "type": "bytes32"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "owner",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_token",
+ "type": "address"
+ },
+ {
+ "name": "_url",
+ "type": "string"
+ }
+ ],
+ "name": "setTokenUrl",
+ "outputs": [],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_token",
+ "type": "address"
+ },
+ {
+ "name": "_name",
+ "type": "string"
+ },
+ {
+ "name": "_symbol",
+ "type": "string"
+ },
+ {
+ "name": "_url",
+ "type": "string"
+ },
+ {
+ "name": "_decimals",
+ "type": "uint8"
+ },
+ {
+ "name": "_ipfsHash",
+ "type": "bytes32"
+ },
+ {
+ "name": "_swarmHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "addToken",
+ "outputs": [],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_token",
+ "type": "address"
+ },
+ {
+ "name": "_name",
+ "type": "string"
+ }
+ ],
+ "name": "setTokenName",
+ "outputs": [],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "tokens",
+ "outputs": [
+ {
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "name": "name",
+ "type": "string"
+ },
+ {
+ "name": "symbol",
+ "type": "string"
+ },
+ {
+ "name": "url",
+ "type": "string"
+ },
+ {
+ "name": "decimals",
+ "type": "uint8"
+ },
+ {
+ "name": "ipfsHash",
+ "type": "bytes32"
+ },
+ {
+ "name": "swarmHash",
+ "type": "bytes32"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "name": "tokenAddresses",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_name",
+ "type": "string"
+ }
+ ],
+ "name": "getTokenByName",
+ "outputs": [
+ {
+ "name": "tokenAddress",
+ "type": "address"
+ },
+ {
+ "name": "name",
+ "type": "string"
+ },
+ {
+ "name": "symbol",
+ "type": "string"
+ },
+ {
+ "name": "url",
+ "type": "string"
+ },
+ {
+ "name": "decimals",
+ "type": "uint8"
+ },
+ {
+ "name": "ipfsHash",
+ "type": "bytes32"
+ },
+ {
+ "name": "swarmHash",
+ "type": "bytes32"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_token",
+ "type": "address"
+ },
+ {
+ "name": "_swarmHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "setTokenSwarmHash",
+ "outputs": [],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getTokenAddresses",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address[]"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_symbol",
+ "type": "string"
+ }
+ ],
+ "name": "getTokenBySymbol",
+ "outputs": [
+ {
+ "name": "tokenAddress",
+ "type": "address"
+ },
+ {
+ "name": "name",
+ "type": "string"
+ },
+ {
+ "name": "symbol",
+ "type": "string"
+ },
+ {
+ "name": "url",
+ "type": "string"
+ },
+ {
+ "name": "decimals",
+ "type": "uint8"
+ },
+ {
+ "name": "ipfsHash",
+ "type": "bytes32"
+ },
+ {
+ "name": "swarmHash",
+ "type": "bytes32"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_token",
+ "type": "address"
+ },
+ {
+ "name": "_symbol",
+ "type": "string"
+ }
+ ],
+ "name": "setTokenSymbol",
+ "outputs": [],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "transferOwnership",
+ "outputs": [],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "name",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "symbol",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "url",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "decimals",
+ "type": "uint8"
+ },
+ {
+ "indexed": false,
+ "name": "ipfsHash",
+ "type": "bytes32"
+ },
+ {
+ "indexed": false,
+ "name": "swarmHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "LogAddToken",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "name",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "symbol",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "url",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "decimals",
+ "type": "uint8"
+ },
+ {
+ "indexed": false,
+ "name": "ipfsHash",
+ "type": "bytes32"
+ },
+ {
+ "indexed": false,
+ "name": "swarmHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "LogRemoveToken",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "oldName",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "newName",
+ "type": "string"
+ }
+ ],
+ "name": "LogTokenNameChange",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "oldSymbol",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "newSymbol",
+ "type": "string"
+ }
+ ],
+ "name": "LogTokenSymbolChange",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "oldUrl",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "newUrl",
+ "type": "string"
+ }
+ ],
+ "name": "LogTokenUrlChange",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "oldIpfsHash",
+ "type": "bytes32"
+ },
+ {
+ "indexed": false,
+ "name": "newIpfsHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "LogTokenIpfsHashChange",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "oldSwarmHash",
+ "type": "bytes32"
+ },
+ {
+ "indexed": false,
+ "name": "newSwarmHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "LogTokenSwarmHashChange",
+ "type": "event"
+ }
+ ],
+ "unlinked_binary": "0x60606040525b60008054600160a060020a03191633600160a060020a03161790555b5b6128d2806100316000396000f300606060405236156100d55763ffffffff60e060020a6000350416632fbfeba981146100da57806334ed557f146101495780633550b6d9146101675780635fa7b584146101d65780637abccac9146101f15780638da5cb5b1461039f57806391914b30146103c85780639a84d0c414610427578063c370c86d14610510578063e48603391461056f578063e5df8b8414610732578063e73fc0c31461075e578063eaabd05e14610946578063ee8c24b814610964578063efa74f1f146109cc578063f036417f14610bb4578063f2fde38b14610c13575b610000565b346100005761012d600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843750949650610c2e95505050505050565b60408051600160a060020a039092168252519081900360200190f35b3461000057610165600160a060020a0360043516602435610ca1565b005b346100005761012d600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843750949650610d5295505050505050565b60408051600160a060020a039092168252519081900360200190f35b3461000057610165600160a060020a0360043516610dc5565b005b346100005761020a600160a060020a036004351661139e565b60408051600160a060020a038916815260ff8516608082015260a0810184905260c0810183905260e060208083018281528a5192840192909252895192939192918401916060850191610100860191908c01908083838215610287575b80518252602083111561028757601f199092019160209182019101610267565b505050905090810190601f1680156102b35780820380516001836020036101000a031916815260200191505b5084810383528951815289516020918201918b019080838382156102f2575b8051825260208311156102f257601f1990920191602091820191016102d2565b505050905090810190601f16801561031e5780820380516001836020036101000a031916815260200191505b5084810382528851815288516020918201918a0190808383821561035d575b80518252602083111561035d57601f19909201916020918201910161033d565b505050905090810190601f1680156103895780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b346100005761012d611661565b60408051600160a060020a039092168252519081900360200190f35b346100005760408051602060046024803582810135601f8101859004850286018501909652858552610165958335600160a060020a0316959394604494939290920191819084018382808284375094965061167095505050505050565b005b346100005760408051602060046024803582810135601f8101859004850286018501909652858552610165958335600160a060020a0316959394604494939290920191819084018382808284375050604080516020601f89358b0180359182018390048302840183019094528083529799988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979998810197919650918201945092508291508401838280828437509496505060ff853516946020810135945060400135925061189e915050565b005b346100005760408051602060046024803582810135601f8101859004850286018501909652858552610165958335600160a060020a03169593946044949392909201918190840183828082843750949650611ebe95505050505050565b005b3461000057610588600160a060020a03600435166121f7565b60408051600160a060020a038916815260ff8516608082015260a0810184905260c0810183905260e06020820181815289546002610100600183161581026000190190921604928401839052929390929084019160608501918501908b9080156106335780601f1061060857610100808354040283529160200191610633565b820191906000526020600020905b81548152906001019060200180831161061657829003601f168201915b505084810383528954600260001961010060018416150201909116048082526020909101908a9080156106a75780601f1061067c576101008083540402835291602001916106a7565b820191906000526020600020905b81548152906001019060200180831161068a57829003601f168201915b505084810382528854600260001961010060018416150201909116048082526020909101908990801561071b5780601f106106f05761010080835404028352916020019161071b565b820191906000526020600020905b8154815290600101906020018083116106fe57829003601f168201915b50509a505050505050505050505060405180910390f35b346100005761012d60043561223b565b60408051600160a060020a039092168252519081900360200190f35b346100005761020a600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375094965061226b95505050505050565b60408051600160a060020a038916815260ff8516608082015260a0810184905260c0810183905260e060208083018281528a5192840192909252895192939192918401916060850191610100860191908c01908083838215610287575b80518252602083111561028757601f199092019160209182019101610267565b505050905090810190601f1680156102b35780820380516001836020036101000a031916815260200191505b5084810383528951815289516020918201918b019080838382156102f2575b8051825260208311156102f257601f1990920191602091820191016102d2565b505050905090810190601f16801561031e5780820380516001836020036101000a031916815260200191505b5084810382528851815288516020918201918a0190808383821561035d575b80518252602083111561035d57601f19909201916020918201910161033d565b505050905090810190601f1680156103895780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b3461000057610165600160a060020a0360043516602435612339565b005b34610000576109716123ea565b60408051602080825283518183015283519192839290830191858101910280838382156109b9575b8051825260208311156109b957601f199092019160209182019101610999565b5050509050019250505060405180910390f35b346100005761020a600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375094965061245595505050505050565b60408051600160a060020a038916815260ff8516608082015260a0810184905260c0810183905260e060208083018281528a5192840192909252895192939192918401916060850191610100860191908c01908083838215610287575b80518252602083111561028757601f199092019160209182019101610267565b505050905090810190601f1680156102b35780820380516001836020036101000a031916815260200191505b5084810383528951815289516020918201918b019080838382156102f2575b8051825260208311156102f257601f1990920191602091820191016102d2565b505050905090810190601f16801561031e5780820380516001836020036101000a031916815260200191505b5084810382528851815288516020918201918a0190808383821561035d575b80518252602083111561035d57601f19909201916020918201910161033d565b505050905090810190601f1680156103895780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b346100005760408051602060046024803582810135601f8101859004850286018501909652858552610165958335600160a060020a0316959394604494939290920191819084018382808284375094965061252395505050505050565b005b3461000057610165600160a060020a036004351661285b565b005b60006003826040518082805190602001908083835b60208310610c625780518252601f199092019160209182019101610c43565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054600160a060020a0316925050505b919050565b6000805433600160a060020a03908116911614610cbd57610000565b600160a060020a0380841660009081526001602052604090205484911615610d4957600160a060020a038416600081815260016020908152604091829020600581015483519485529184019190915282820186905290519093507fe46a8f26cfc48c12e40cf50c1063e5913b2a17da6aa396f9b008b2dfd6f273b59181900360600190a1600582018390555b5b5b505b505050565b60006002826040518082805190602001908083835b60208310610c625780518252601f199092019160209182019101610c43565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054600160a060020a0316925050505b919050565b60008054819033600160a060020a03908116911614610de357610000565b600160a060020a0380841660009081526001602052604090205484911615610d4957600092505b600454831015610f225783600160a060020a0316600484815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a03161415610f16576004805460001981019081101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600484815481101561000057906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a031602179055506001600481818054905003915081815481835581811511610f0c57600083815260209020610f0c9181019083015b80821115610f085760008155600101610ef4565b5090565b5b50505050610f22565b5b600190920191610e0a565b600160a060020a03808516600090815260016020818152604092839020805460048201546005830154600684015487519390981680845260ff9092166080840181905260a0840182905260c0840189905260e09584018681528588018054600299811615610100908102600019019091168a9004988701899052969c507fc9ec69d3b744b4ec70f035ed0a15ed7029e668bfb9f326e657878b2b38a90da29a949990988d019760038e0197939694959493918401916060850191908501908b90801561102f5780601f106110045761010080835404028352916020019161102f565b820191906000526020600020905b81548152906001019060200180831161101257829003601f168201915b505084810383528954600260001961010060018416150201909116048082526020909101908a9080156110a35780601f10611078576101008083540402835291602001916110a3565b820191906000526020600020905b81548152906001019060200180831161108657829003601f168201915b50508481038252885460026000196101006001841615020190911604808252602090910190899080156111175780601f106110ec57610100808354040283529160200191611117565b820191906000526020600020905b8154815290600101906020018083116110fa57829003601f168201915b50509a505050505050505050505060405180910390a1600282600201604051808280546001816001161561010002031660029004801561118e5780601f1061116c57610100808354040283529182019161118e565b820191906000526020600020905b81548152906001019060200180831161117a575b5050915050908152602001604051809103902060006101000a815490600160a060020a03021916905560038260010160405180828054600181600116156101000203166002900480156112185780601f106111f6576101008083540402835291820191611218565b820191906000526020600020905b815481529060010190602001808311611204575b50509283525050604080519182900360209081019092208054600160a060020a0319908116909155600160a060020a03871660009081526001938490529182208054909116815580830180548382559193909160029181161561010002600019011604601f81901061128a57506112bc565b601f0160209004906000526020600020908101906112bc91905b80821115610f085760008155600101610ef4565b5090565b5b5060028201805460018160011615610100020316600290046000825580601f106112e75750611319565b601f01602090049060005260206000209081019061131991905b80821115610f085760008155600101610ef4565b5090565b5b5060038201805460018160011615610100020316600290046000825580601f106113445750611376565b601f01602090049060005260206000209081019061137691905b80821115610f085760008155600101610ef4565b5090565b5b505060048101805460ff191690556000600582018190556006909101555b5b5b505b505050565b604080516020818101835260008083528351808301855281815284518084018652828152855160e08181018852848252875180870189528581528287015287518087018952858152828901528751808701895285815260608301526080820185905260a0820185905260c08201859052600160a060020a03898116865260018088528987208a519384018b528054909216835281810180548b51601f6002948316156101000260001901909216939093049081018a90048a0283018a01909b528a82529699959794968a968796879695949385820193909290918301828280156114c95780601f1061149e576101008083540402835291602001916114c9565b820191906000526020600020905b8154815290600101906020018083116114ac57829003601f168201915b5050509183525050600282810180546040805160206001841615610100026000190190931694909404601f8101839004830285018301909152808452938101939083018282801561155b5780601f106115305761010080835404028352916020019161155b565b820191906000526020600020905b81548152906001019060200180831161153e57829003601f168201915b505050918352505060038201805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529382019392918301828280156115ef5780601f106115c4576101008083540402835291602001916115ef565b820191906000526020600020905b8154815290600101906020018083116115d257829003601f168201915b5050509183525050600482015460ff1660208083019190915260058301546040808401919091526006909301546060928301528351908401519284015191840151608085015160a086015160c0870151939e50949c50929a509850909650909450925090505b50919395979092949650565b600054600160a060020a031681565b6000805433600160a060020a0390811691161461168c57610000565b600160a060020a0380841660009081526001602052604090205484911615610d4957600160a060020a03841660008181526001602081815260409283902083519485526060918501828152600382018054600295811615610100026000190116949094049286018390529096507f6b45310c970f5d74814e429bdacd69c748dcb086cd38b6ddb7c2029be609e16894899489939192919083019060808401908690801561177a5780601f1061174f5761010080835404028352916020019161177a565b820191906000526020600020905b81548152906001019060200180831161175d57829003601f168201915b5050838103825284518152845160209182019186019080838382156117ba575b8051825260208311156117ba57601f19909201916020918201910161179a565b505050905090810190601f1680156117e65780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a182826003019080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061184457805160ff1916838001178555611871565b82800160010185558215611871579182015b82811115611871578251825591602001919060010190611856565b5b506118929291505b80821115610f085760008155600101610ef4565b5090565b50505b5b5b505b505050565b60005433600160a060020a039081169116146118b957610000565b600160a060020a038088166000908152600160205260409020548891161515611eb1576040805160e081018252600160a060020a03808b1680835260208084018c81528486018c9052606085018b905260ff8a16608086015260a0850189905260c0850188905260009283526001808352958320855181549516600160a060020a0319909516949094178455518051848701805481865294849020969795969095601f600291871615610100026000190190961604850184900481019491939092019083901061199457805160ff19168380011785556119c1565b828001600101855582156119c1579182015b828111156119c15782518255916020019190600101906119a6565b5b506119e29291505b80821115610f085760008155600101610ef4565b5090565b50506040820151816002019080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611a3657805160ff1916838001178555611a63565b82800160010185558215611a63579182015b82811115611a63578251825591602001919060010190611a48565b5b50611a849291505b80821115610f085760008155600101610ef4565b5090565b50506060820151816003019080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611ad857805160ff1916838001178555611b05565b82800160010185558215611b05579182015b82811115611b05578251825591602001919060010190611aea565b5b50611b269291505b80821115610f085760008155600101610ef4565b5090565b505060808201516004828101805460ff191660ff9093169290921790915560a0830151600583015560c0909201516006909101558054600181018083558281838015829011611b9a57600083815260209020611b9a9181019083015b80821115610f085760008155600101610ef4565b5090565b5b505050916000526020600020900160005b8a909190916101000a815481600160a060020a030219169083600160a060020a0316021790555050876002876040518082805190602001908083835b60208310611c075780518252601f199092019160209182019101611be8565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184208054600160a060020a031916600160a060020a039690961695909517909455505088518a926003928b9290918291908401908083835b60208310611c875780518252601f199092019160209182019101611c68565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060006101000a815481600160a060020a030219169083600160a060020a031602179055507f469f18a43061267ac6162ca1cec0c14a425189c7a19f52d6dc04419f3c12bb24888888888888886040518088600160a060020a0316600160a060020a031681526020018060200180602001806020018760ff1660ff1681526020018660001916600019168152602001856000191660001916815260200184810384528a818151815260200191508051906020019080838360008314611d99575b805182526020831115611d9957601f199092019160209182019101611d79565b505050905090810190601f168015611dc55780820380516001836020036101000a031916815260200191505b5084810383528951815289516020918201918b01908083838215611e04575b805182526020831115611e0457601f199092019160209182019101611de4565b505050905090810190601f168015611e305780820380516001836020036101000a031916815260200191505b5084810382528851815288516020918201918a01908083838215611e6f575b805182526020831115611e6f57601f199092019160209182019101611e4f565b505050905090810190601f168015611e9b5780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390a15b5b5b505b50505050505050565b6000805433600160a060020a03908116911614611eda57610000565b600160a060020a0380841660009081526001602052604090205484911615610d4957600160a060020a038416600081815260016020818152604092839020835194855260609185018281528184018054600295811615610100026000190116949094049286018390529096507f4a6dbfc867b179991dec22ff19960f0a94d8d9d891fc556f547764670340e8ae948994899391929190830190608084019086908015611fc75780601f10611f9c57610100808354040283529160200191611fc7565b820191906000526020600020905b815481529060010190602001808311611faa57829003601f168201915b505083810382528451815284516020918201918601908083838215612007575b80518252602083111561200757601f199092019160209182019101611fe7565b505050905090810190601f1680156120335780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a160038260010160405180828054600181600116156101000203166002900480156120a45780601f106120825761010080835404028352918201916120a4565b820191906000526020600020905b815481529060010190602001808311612090575b5050928352505060405190819003602090810182208054600160a060020a031916905584518692600392879282918401908083835b602083106120f85780518252601f1990920191602091820191016120d9565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060006101000a815481600160a060020a030219169083600160a060020a0316021790555082826001019080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061184457805160ff1916838001178555611871565b82800160010185558215611871579182015b82811115611871578251825591602001919060010190611856565b5b506118929291505b80821115610f085760008155600101610ef4565b5090565b50505b5b5b505b505050565b60016020819052600091825260409091208054600482015460058301546006840154600160a060020a0390931694840193600281019360039091019260ff16919087565b600481815481101561000057906000526020600020900160005b915054906101000a9004600160a060020a031681565b600060206040519081016040528060008152506020604051908101604052806000815250602060405190810160405280600081525060006000600060006003896040518082805190602001908083835b602083106122da5780518252601f1990920191602091820191016122bb565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054600160a060020a0316925061231e915082905061139e565b97509750975097509750975097505b50919395979092949650565b6000805433600160a060020a0390811691161461235557610000565b600160a060020a0380841660009081526001602052604090205484911615610d4957600160a060020a038416600081815260016020908152604091829020600681015483519485529184019190915282820186905290519093507fa9fd216856477e73d11c1a9140fa3d425fce2e10a5475a996440b31c2e8f1ea49181900360600190a1600682018390555b5b5b505b505050565b60408051602081810183526000825260048054845181840281018401909552808552929392909183018282801561244a57602002820191906000526020600020905b8154600160a060020a0316815260019091019060200180831161242c575b505050505090505b90565b600060206040519081016040528060008152506020604051908101604052806000815250602060405190810160405280600081525060006000600060006002896040518082805190602001908083835b602083106122da5780518252601f1990920191602091820191016122bb565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054600160a060020a0316925061231e915082905061139e565b97509750975097509750975097505b50919395979092949650565b6000805433600160a060020a0390811691161461253f57610000565b600160a060020a0380841660009081526001602052604090205484911615610d4957600160a060020a0384166000818152600160208181526040928390208351948552606091850182815260028083018054958616156101000260001901909516049286018390529096507f53d878a6530e56c9bc96548fa0a8cae4f1d1f49c86b0e934c086b992ebb6998f94899489939192919083019060808401908690801561262b5780601f106126005761010080835404028352916020019161262b565b820191906000526020600020905b81548152906001019060200180831161260e57829003601f168201915b50508381038252845181528451602091820191860190808383821561266b575b80518252602083111561266b57601f19909201916020918201910161264b565b505050905090810190601f1680156126975780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a160028260020160405180828054600181600116156101000203166002900480156127085780601f106126e6576101008083540402835291820191612708565b820191906000526020600020905b8154815290600101906020018083116126f4575b5050928352505060405190819003602090810182208054600160a060020a031916905584518692600292879282918401908083835b6020831061275c5780518252601f19909201916020918201910161273d565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060006101000a815481600160a060020a030219169083600160a060020a0316021790555082826002019080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061184457805160ff1916838001178555611871565b82800160010185558215611871579182015b82811115611871578251825591602001919060010190611856565b5b506118929291505b80821115610f085760008155600101610ef4565b5090565b50505b5b5b505b505050565b60005433600160a060020a0390811691161461287657610000565b600160a060020a038116156128a15760008054600160a060020a031916600160a060020a0383161790555b5b5b505600a165627a7a72305820c4454d3df1dcaca22cb9cffba37b1f3f8ec566d0dac5acb44ad85b38451668480029",
+ "networks": {
+ "42": {
+ "links": {},
+ "events": {
+ "0x469f18a43061267ac6162ca1cec0c14a425189c7a19f52d6dc04419f3c12bb24": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "name",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "symbol",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "url",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "decimals",
+ "type": "uint8"
+ },
+ {
+ "indexed": false,
+ "name": "ipfsHash",
+ "type": "bytes32"
+ },
+ {
+ "indexed": false,
+ "name": "swarmHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "LogAddToken",
+ "type": "event"
+ },
+ "0xc9ec69d3b744b4ec70f035ed0a15ed7029e668bfb9f326e657878b2b38a90da2": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "name",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "symbol",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "url",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "decimals",
+ "type": "uint8"
+ },
+ {
+ "indexed": false,
+ "name": "ipfsHash",
+ "type": "bytes32"
+ },
+ {
+ "indexed": false,
+ "name": "swarmHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "LogRemoveToken",
+ "type": "event"
+ },
+ "0x4a6dbfc867b179991dec22ff19960f0a94d8d9d891fc556f547764670340e8ae": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "oldName",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "newName",
+ "type": "string"
+ }
+ ],
+ "name": "LogTokenNameChange",
+ "type": "event"
+ },
+ "0x53d878a6530e56c9bc96548fa0a8cae4f1d1f49c86b0e934c086b992ebb6998f": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "oldSymbol",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "newSymbol",
+ "type": "string"
+ }
+ ],
+ "name": "LogTokenSymbolChange",
+ "type": "event"
+ },
+ "0x6b45310c970f5d74814e429bdacd69c748dcb086cd38b6ddb7c2029be609e168": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "oldUrl",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "newUrl",
+ "type": "string"
+ }
+ ],
+ "name": "LogTokenUrlChange",
+ "type": "event"
+ },
+ "0xe46a8f26cfc48c12e40cf50c1063e5913b2a17da6aa396f9b008b2dfd6f273b5": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "oldIpfsHash",
+ "type": "bytes32"
+ },
+ {
+ "indexed": false,
+ "name": "newIpfsHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "LogTokenIpfsHashChange",
+ "type": "event"
+ },
+ "0xa9fd216856477e73d11c1a9140fa3d425fce2e10a5475a996440b31c2e8f1ea4": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "oldSwarmHash",
+ "type": "bytes32"
+ },
+ {
+ "indexed": false,
+ "name": "newSwarmHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "LogTokenSwarmHashChange",
+ "type": "event"
+ }
+ },
+ "updated_at": 1495042008599,
+ "address": "0xbfa86463a4faa2598bbe177debac62f4c8a3a294"
+ },
+ "50": {
+ "links": {},
+ "events": {
+ "0x469f18a43061267ac6162ca1cec0c14a425189c7a19f52d6dc04419f3c12bb24": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "name",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "symbol",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "url",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "decimals",
+ "type": "uint8"
+ },
+ {
+ "indexed": false,
+ "name": "ipfsHash",
+ "type": "bytes32"
+ },
+ {
+ "indexed": false,
+ "name": "swarmHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "LogAddToken",
+ "type": "event"
+ },
+ "0xc9ec69d3b744b4ec70f035ed0a15ed7029e668bfb9f326e657878b2b38a90da2": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "name",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "symbol",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "url",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "decimals",
+ "type": "uint8"
+ },
+ {
+ "indexed": false,
+ "name": "ipfsHash",
+ "type": "bytes32"
+ },
+ {
+ "indexed": false,
+ "name": "swarmHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "LogRemoveToken",
+ "type": "event"
+ },
+ "0x4a6dbfc867b179991dec22ff19960f0a94d8d9d891fc556f547764670340e8ae": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "oldName",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "newName",
+ "type": "string"
+ }
+ ],
+ "name": "LogTokenNameChange",
+ "type": "event"
+ },
+ "0x53d878a6530e56c9bc96548fa0a8cae4f1d1f49c86b0e934c086b992ebb6998f": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "oldSymbol",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "newSymbol",
+ "type": "string"
+ }
+ ],
+ "name": "LogTokenSymbolChange",
+ "type": "event"
+ },
+ "0x6b45310c970f5d74814e429bdacd69c748dcb086cd38b6ddb7c2029be609e168": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "oldUrl",
+ "type": "string"
+ },
+ {
+ "indexed": false,
+ "name": "newUrl",
+ "type": "string"
+ }
+ ],
+ "name": "LogTokenUrlChange",
+ "type": "event"
+ },
+ "0xe46a8f26cfc48c12e40cf50c1063e5913b2a17da6aa396f9b008b2dfd6f273b5": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "oldIpfsHash",
+ "type": "bytes32"
+ },
+ {
+ "indexed": false,
+ "name": "newIpfsHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "LogTokenIpfsHashChange",
+ "type": "event"
+ },
+ "0xa9fd216856477e73d11c1a9140fa3d425fce2e10a5475a996440b31c2e8f1ea4": {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "oldSwarmHash",
+ "type": "bytes32"
+ },
+ {
+ "indexed": false,
+ "name": "newSwarmHash",
+ "type": "bytes32"
+ }
+ ],
+ "name": "LogTokenSwarmHashChange",
+ "type": "event"
+ }
+ },
+ "updated_at": 1495030736781,
+ "address": "0x0b1ba0af832d7c05fd64161e0db78e85978e8082"
+ }
+ },
+ "schema_version": "0.0.5",
+ "updated_at": 1495042008599
+} \ No newline at end of file
diff --git a/src/ts/0x.js.ts b/src/ts/0x.js.ts
index ba922d3db..bd4978c96 100644
--- a/src/ts/0x.js.ts
+++ b/src/ts/0x.js.ts
@@ -1,25 +1,22 @@
+import * as _ from 'lodash';
import * as BigNumber from 'bignumber.js';
import * as BN from 'bn.js';
import * as ethUtil from 'ethereumjs-util';
+import contract = require('truffle-contract');
+import * as Web3 from 'web3';
import * as ethABI from 'ethereumjs-abi';
-import * as _ from 'lodash';
+import {Web3Wrapper} from './web3_wrapper';
import {constants} from './utils/constants';
import {assert} from './utils/assert';
+import {ExchangeWrapper} from './contract_wrappers/exchange_wrapper';
import {ECSignatureSchema} from './schemas/ec_signature_schema';
-import {SolidityTypes} from './types';
-
-/**
- * Elliptic Curve signature
- */
-export interface ECSignature {
- v: number;
- r: string;
- s: string;
-}
+import {SolidityTypes, ECSignature} from './types';
const MAX_DIGITS_IN_UNSIGNED_256_INT = 78;
export class ZeroEx {
+ public web3Wrapper: Web3Wrapper;
+ public exchange: ExchangeWrapper;
/**
* Computes the orderHash given the order parameters and returns it as a hex encoded string.
*/
@@ -74,7 +71,8 @@ export class ZeroEx {
const dataBuff = ethUtil.toBuffer(dataHex);
const msgHashBuff = ethUtil.hashPersonalMessage(dataBuff);
try {
- const pubKey = ethUtil.ecrecover(msgHashBuff,
+ const pubKey = ethUtil.ecrecover(
+ msgHashBuff,
signature.v,
ethUtil.toBuffer(signature.r),
ethUtil.toBuffer(signature.s));
@@ -129,7 +127,6 @@ export class ZeroEx {
const baseUnitAmount = amount.times(unit);
return baseUnitAmount;
}
-
/**
* Converts BigNumber instance to BN
* The only we convert to BN is to remain compatible with `ethABI. soliditySHA3 ` that
@@ -139,4 +136,8 @@ export class ZeroEx {
private static bigNumberToBN(value: BigNumber.BigNumber) {
return new BN(value.toString(), 10);
}
+ constructor(web3: Web3) {
+ this.web3Wrapper = new Web3Wrapper(web3);
+ this.exchange = new ExchangeWrapper(this.web3Wrapper);
+ }
}
diff --git a/src/ts/contract_wrappers/contract_wrapper.ts b/src/ts/contract_wrappers/contract_wrapper.ts
new file mode 100644
index 000000000..9f4cd8039
--- /dev/null
+++ b/src/ts/contract_wrappers/contract_wrapper.ts
@@ -0,0 +1,48 @@
+import * as _ from 'lodash';
+import contract = require('truffle-contract');
+import {Web3Wrapper} from '../web3_wrapper';
+import {ZeroExError} from '../types';
+import {utils} from '../utils/utils';
+
+export class ContractWrapper {
+ public web3Wrapper: Web3Wrapper;
+ constructor(web3Wrapper: Web3Wrapper) {
+ this.web3Wrapper = web3Wrapper;
+ }
+ protected async instantiateContractIfExistsAsync(artifact: Artifact, address?: string): Promise<ContractInstance> {
+ const c = await contract(artifact);
+ const providerObj = this.web3Wrapper.getCurrentProvider();
+ c.setProvider(providerObj);
+
+ const networkIdIfExists = await this.web3Wrapper.getNetworkIdIfExistsAsync();
+ const artifactNetworkConfigs = _.isUndefined(networkIdIfExists) ?
+ undefined :
+ artifact.networks[networkIdIfExists];
+ let contractAddress;
+ if (!_.isUndefined(address)) {
+ contractAddress = address;
+ } else if (!_.isUndefined(artifactNetworkConfigs)) {
+ contractAddress = artifactNetworkConfigs.address;
+ }
+
+ if (!_.isUndefined(contractAddress)) {
+ const doesContractExist = await this.web3Wrapper.doesContractExistAtAddressAsync(contractAddress);
+ if (!doesContractExist) {
+ throw new Error(ZeroExError.CONTRACT_DOES_NOT_EXIST);
+ }
+ }
+
+ try {
+ const contractInstance = _.isUndefined(address) ? await c.deployed() : await c.at(address);
+ return contractInstance;
+ } catch (err) {
+ const errMsg = `${err}`;
+ if (_.includes(errMsg, 'not been deployed to detected network')) {
+ throw new Error(ZeroExError.CONTRACT_DOES_NOT_EXIST);
+ } else {
+ utils.consoleLog(`Notice: Error encountered: ${err} ${err.stack}`);
+ throw new Error(ZeroExError.UNHANDLED_ERROR);
+ }
+ }
+ }
+}
diff --git a/src/ts/contract_wrappers/exchange_wrapper.ts b/src/ts/contract_wrappers/exchange_wrapper.ts
new file mode 100644
index 000000000..38043dd55
--- /dev/null
+++ b/src/ts/contract_wrappers/exchange_wrapper.ts
@@ -0,0 +1,37 @@
+import * as _ from 'lodash';
+import {Web3Wrapper} from '../web3_wrapper';
+import {ECSignature, ZeroExError, ExchangeContract} from '../types';
+import {assert} from '../utils/assert';
+import {ContractWrapper} from './contract_wrapper';
+import * as ExchangeArtifacts from '../../artifacts/Exchange.json';
+import {ECSignatureSchema} from '../schemas/ec_signature_schema';
+
+export class ExchangeWrapper extends ContractWrapper {
+ constructor(web3Wrapper: Web3Wrapper) {
+ super(web3Wrapper);
+ }
+ public async isValidSignatureAsync(dataHex: string, ecSignature: ECSignature,
+ signerAddressHex: string): Promise<boolean> {
+ assert.isHexString('dataHex', dataHex);
+ assert.doesConformToSchema('ecSignature', ecSignature, ECSignatureSchema);
+ assert.isETHAddressHex('signerAddressHex', signerAddressHex);
+
+ const senderAddressIfExists = await this.web3Wrapper.getSenderAddressIfExistsAsync();
+ assert.assert(!_.isUndefined(senderAddressIfExists), ZeroExError.USER_HAS_NO_ASSOCIATED_ADDRESSES);
+
+ const contractInstance = await this.instantiateContractIfExistsAsync((ExchangeArtifacts as any));
+ const exchangeInstance = contractInstance as ExchangeContract;
+
+ const isValidSignature = await exchangeInstance.isValidSignature.call(
+ signerAddressHex,
+ dataHex,
+ ecSignature.v,
+ ecSignature.r,
+ ecSignature.s,
+ {
+ from: senderAddressIfExists,
+ },
+ );
+ return isValidSignature;
+ }
+}
diff --git a/src/ts/globals.d.ts b/src/ts/globals.d.ts
index 99baf593f..dee957f2f 100644
--- a/src/ts/globals.d.ts
+++ b/src/ts/globals.d.ts
@@ -1,5 +1,8 @@
declare module 'chai-bignumber';
declare module 'bn.js';
+declare module 'request-promise-native';
+declare module 'web3-provider-engine';
+declare module 'web3-provider-engine/subproviders/rpc';
declare interface Schema {
id: string;
@@ -12,10 +15,18 @@ declare interface Schema {
declare namespace Chai {
interface Assertion {
bignumber: Assertion;
+ eventually: Assertion;
}
}
/* tslint:enable */
+declare module '*.json' {
+ const json: any;
+ /* tslint:disable */
+ export default json;
+ /* tslint:enable */
+}
+
declare module 'ethereumjs-util' {
const toBuffer: (dataHex: string) => Buffer;
const hashPersonalMessage: (msg: Buffer) => Buffer;
@@ -23,6 +34,28 @@ declare module 'ethereumjs-util' {
const ecrecover: (msgHashBuff: Buffer, v: number, r: Buffer, s: Buffer) => string;
const pubToAddress: (pubKey: string) => Buffer;
const isValidAddress: (address: string) => boolean;
+ const bufferToInt: (buffer: Buffer) => number;
+}
+
+// truffle-contract declarations
+declare interface ContractInstance {}
+declare interface ContractFactory {
+ setProvider: (providerObj: any) => void;
+ deployed: () => ContractInstance;
+ at: (address: string) => ContractInstance;
+}
+declare interface Artifact {
+ networks: {[networkId: number]: any};
+}
+declare function contract(artifacts: Artifact): ContractFactory;
+declare module 'truffle-contract' {
+ export = contract;
+}
+
+// es6-promisify declarations
+declare function promisify(original: any, settings?: any): ((...arg: any[]) => Promise<any>);
+declare module 'es6-promisify' {
+ export = promisify;
}
declare module 'ethereumjs-abi' {
diff --git a/src/ts/types.ts b/src/ts/types.ts
index 04902cca6..4da03a4d3 100644
--- a/src/ts/types.ts
+++ b/src/ts/types.ts
@@ -1,5 +1,4 @@
import * as _ from 'lodash';
-import * as BigNumber from 'bignumber.js';
// Utility function to create a K:V from a list of strings
// Adapted from: https://basarat.gitbooks.io/typescript/content/docs/types/literal-types.html
@@ -10,6 +9,26 @@ function strEnum(values: string[]): {[key: string]: string} {
}, Object.create(null));
}
+export const ZeroExError = strEnum([
+ 'CONTRACT_DOES_NOT_EXIST',
+ 'UNHANDLED_ERROR',
+ 'USER_HAS_NO_ASSOCIATED_ADDRESSES',
+]);
+export type ZeroExError = keyof typeof ZeroExError;
+
+/**
+ * Elliptic Curve signature
+ */
+export interface ECSignature {
+ v: number;
+ r: string;
+ s: string;
+}
+
+export interface ExchangeContract {
+ isValidSignature: any;
+}
+
export const SolidityTypes = strEnum([
'address',
'uint256',
diff --git a/src/ts/utils/assert.ts b/src/ts/utils/assert.ts
index 2f52c6a3b..1baf572d1 100644
--- a/src/ts/utils/assert.ts
+++ b/src/ts/utils/assert.ts
@@ -1,30 +1,33 @@
import * as _ from 'lodash';
import * as BigNumber from 'bignumber.js';
-import Web3 = require('web3');
+import * as Web3 from 'web3';
import {SchemaValidator} from './schema_validator';
const HEX_REGEX = /^0x[0-9A-F]*$/i;
export const assert = {
- isBigNumber(variableName: string, value: BigNumber.BigNumber) {
+ isBigNumber(variableName: string, value: BigNumber.BigNumber): void {
const isBigNumber = _.isObject(value) && value.isBigNumber;
this.assert(isBigNumber, this.typeAssertionMessage(variableName, 'BigNumber', value));
},
- isString(variableName: string, value: string) {
+ isUndefined(value: any, variableName?: string): void {
+ this.assert(_.isUndefined(value), this.typeAssertionMessage(variableName, 'undefined', value));
+ },
+ isString(variableName: string, value: string): void {
this.assert(_.isString(value), this.typeAssertionMessage(variableName, 'string', value));
},
- isHexString(variableName: string, value: string) {
+ isHexString(variableName: string, value: string): void {
this.assert(_.isString(value) && HEX_REGEX.test(value),
this.typeAssertionMessage(variableName, 'HexString', value));
},
- isETHAddressHex(variableName: string, value: string) {
+ isETHAddressHex(variableName: string, value: string): void {
const web3 = new Web3();
this.assert(web3.isAddress(value), this.typeAssertionMessage(variableName, 'ETHAddressHex', value));
},
- isNumber(variableName: string, value: number) {
+ isNumber(variableName: string, value: number): void {
this.assert(_.isFinite(value), this.typeAssertionMessage(variableName, 'number', value));
},
- doesConformToSchema(variableName: string, value: object, schema: Schema) {
+ doesConformToSchema(variableName: string, value: object, schema: Schema): void {
const schemaValidator = new SchemaValidator();
const validationResult = schemaValidator.validate(value, schema);
const hasValidationErrors = validationResult.errors.length > 0;
@@ -33,12 +36,12 @@ Encountered: ${JSON.stringify(value, null, '\t')}
Validation errors: ${validationResult.errors.join(', ')}`;
this.assert(!hasValidationErrors, msg);
},
- assert(condition: boolean, message: string) {
+ assert(condition: boolean, message: string): void {
if (!condition) {
throw new Error(message);
}
},
- typeAssertionMessage(variableName: string, type: string, value: any) {
+ typeAssertionMessage(variableName: string, type: string, value: any): string {
return `Expected ${variableName} to be of type ${type}, encountered: ${value}`;
},
};
diff --git a/src/ts/utils/constants.ts b/src/ts/utils/constants.ts
index 60af7b674..ec2fe744a 100644
--- a/src/ts/utils/constants.ts
+++ b/src/ts/utils/constants.ts
@@ -1,3 +1,3 @@
export const constants = {
NULL_ADDRESS: '0x0000000000000000000000000000000000000000',
-}
+};
diff --git a/src/ts/utils/utils.ts b/src/ts/utils/utils.ts
new file mode 100644
index 000000000..04ac36b54
--- /dev/null
+++ b/src/ts/utils/utils.ts
@@ -0,0 +1,7 @@
+export const utils = {
+ consoleLog(message: string): void {
+ /* tslint:disable */
+ console.log(message);
+ /* tslint:enable */
+ },
+};
diff --git a/src/ts/web3_wrapper.ts b/src/ts/web3_wrapper.ts
new file mode 100644
index 000000000..3b460e4da
--- /dev/null
+++ b/src/ts/web3_wrapper.ts
@@ -0,0 +1,69 @@
+import * as _ from 'lodash';
+import * as Web3 from 'web3';
+import * as BigNumber from 'bignumber.js';
+import promisify = require('es6-promisify');
+
+export class Web3Wrapper {
+ private web3: Web3;
+ constructor(web3: Web3) {
+ this.web3 = new Web3();
+ this.web3.setProvider(web3.currentProvider);
+ }
+ public isAddress(address: string): boolean {
+ return this.web3.isAddress(address);
+ }
+ public async getSenderAddressIfExistsAsync(): Promise<string|undefined> {
+ const defaultAccount = this.web3.eth.defaultAccount;
+ if (!_.isUndefined(defaultAccount)) {
+ return defaultAccount;
+ }
+ const firstAccount = await this.getFirstAddressIfExistsAsync();
+ return firstAccount;
+ }
+ public async getFirstAddressIfExistsAsync(): Promise<string|undefined> {
+ const addresses = await promisify(this.web3.eth.getAccounts)();
+ if (_.isEmpty(addresses)) {
+ return undefined;
+ }
+ return (addresses as string[])[0];
+ }
+ public async getNodeVersionAsync(): Promise<string> {
+ const nodeVersion = await promisify(this.web3.version.getNode)();
+ return nodeVersion;
+ }
+ public getCurrentProvider(): Web3.Provider {
+ return this.web3.currentProvider;
+ }
+ public async getNetworkIdIfExistsAsync(): Promise<number|undefined> {
+ try {
+ const networkId = await this.getNetworkAsync();
+ return Number(networkId);
+ } catch (err) {
+ return undefined;
+ }
+ }
+ public async getBalanceInEthAsync(owner: string): Promise<BigNumber.BigNumber> {
+ const balanceInWei = await promisify(this.web3.eth.getBalance)(owner);
+ const balanceEth = this.web3.fromWei(balanceInWei, 'ether');
+ return balanceEth;
+ }
+ public async doesContractExistAtAddressAsync(address: string): Promise<boolean> {
+ const code = await promisify(this.web3.eth.getCode)(address);
+ // Regex matches 0x0, 0x00, 0x in order to accomodate poorly implemented clients
+ const zeroHexAddressRegex = /^0x0\{0,40\}$/i;
+ const didFindCode = _.isNull(code.match(zeroHexAddressRegex));
+ return didFindCode;
+ }
+ public async signTransactionAsync(address: string, message: string): Promise<string> {
+ const signData = await promisify(this.web3.eth.sign)(address, message);
+ return signData;
+ }
+ public async getBlockTimestampAsync(blockHash: string): Promise<number> {
+ const {timestamp} = await promisify(this.web3.eth.getBlock)(blockHash);
+ return timestamp;
+ }
+ private async getNetworkAsync(): Promise<number> {
+ const networkId = await promisify(this.web3.version.getNetwork)();
+ return networkId;
+ }
+}
diff --git a/test/0x.js.ts b/test/0x.js_test.ts
index d5b2015fb..d5b2015fb 100644
--- a/test/0x.js.ts
+++ b/test/0x.js_test.ts
diff --git a/test/contract_wrapper_test.ts b/test/contract_wrapper_test.ts
new file mode 100644
index 000000000..67dae3a4e
--- /dev/null
+++ b/test/contract_wrapper_test.ts
@@ -0,0 +1,98 @@
+import 'mocha';
+import * as chai from 'chai';
+import chaiAsPromised = require('chai-as-promised');
+import * as Web3 from 'web3';
+import {web3Factory} from './utils/web3_factory';
+import {ExchangeWrapper} from '../src/ts/contract_wrappers/exchange_wrapper';
+import {BlockchainLifecycle} from './utils/blockchain_lifecycle';
+import {Web3Wrapper} from './../src/ts/web3_wrapper';
+
+const expect = chai.expect;
+chai.use(chaiAsPromised);
+const blockchainLifecycle = new BlockchainLifecycle();
+
+describe('ExchangeWrapper', () => {
+ let web3Wrapper: Web3Wrapper;
+ let exchangeWrapper: ExchangeWrapper;
+ before(async () => {
+ const web3 = web3Factory.create();
+ web3Wrapper = new Web3Wrapper(web3);
+ exchangeWrapper = new ExchangeWrapper(web3Wrapper);
+ });
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ describe('#isValidSignatureAsync', () => {
+ // The Exchange smart contract `isValidSignature` method only validates orderHashes and assumes
+ // the length of the data is exactly 32 bytes. Thus for these tests, we use data of this size.
+ const dataHex = '0x6927e990021d23b1eb7b8789f6a6feaf98fe104bb0cf8259421b79f9a34222b0';
+ const signature = {
+ v: 27,
+ r: '0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33',
+ s: '0x40349190569279751135161d22529dc25add4f6069af05be04cacbda2ace2254',
+ };
+ const address = '0x5409ed021d9299bf6814279a6a1411a7e866a631';
+ describe('should throw if passed a malformed signature', () => {
+ it('malformed v', async () => {
+ const malformedSignature = {
+ v: 34,
+ r: signature.r,
+ s: signature.s,
+ };
+ expect(exchangeWrapper.isValidSignatureAsync(dataHex, malformedSignature, address))
+ .to.be.rejected;
+ });
+ it('r lacks 0x prefix', () => {
+ const malformedR = signature.r.replace('0x', '');
+ const malformedSignature = {
+ v: signature.v,
+ r: malformedR,
+ s: signature.s,
+ };
+ expect(exchangeWrapper.isValidSignatureAsync(dataHex, malformedSignature, address))
+ .to.be.rejected;
+ });
+ it('r is too short', () => {
+ const malformedR = signature.r.substr(10);
+ const malformedSignature = {
+ v: signature.v,
+ r: malformedR,
+ s: signature.s.replace('0', 'z'),
+ };
+ expect(exchangeWrapper.isValidSignatureAsync(dataHex, malformedSignature, address))
+ .to.be.rejected;
+ });
+ it('s is not hex', () => {
+ const malformedS = signature.s.replace('0', 'z');
+ const malformedSignature = {
+ v: signature.v,
+ r: signature.r,
+ s: malformedS,
+ };
+ expect(exchangeWrapper.isValidSignatureAsync(dataHex, malformedSignature, address))
+ .to.be.rejected;
+ });
+ });
+ it('should return false if the data doesn\'t pertain to the signature & address', async () => {
+ const isValid = await exchangeWrapper.isValidSignatureAsync('0x0', signature, address);
+ expect(isValid).to.be.false;
+ });
+ it('should return false if the address doesn\'t pertain to the signature & dataHex', async () => {
+ const validUnrelatedAddress = '0x8b0292B11a196601eD2ce54B665CaFEca0347D42';
+ const isValid = await exchangeWrapper.isValidSignatureAsync(dataHex, signature, validUnrelatedAddress);
+ expect(isValid).to.be.false;
+ });
+ it('should return false if the signature doesn\'t pertain to the dataHex & address', async () => {
+ const wrongSignature = Object.assign({}, signature, {v: 28});
+ const isValid = await exchangeWrapper.isValidSignatureAsync(dataHex, wrongSignature, address);
+ expect(isValid).to.be.false;
+ });
+ it('should return true if the signature does pertain to the dataHex & address', async () => {
+ const isValid = await exchangeWrapper.isValidSignatureAsync(dataHex, signature, address);
+ expect(isValid).to.be.true;
+ });
+ });
+});
diff --git a/test/utils/blockchain_lifecycle.ts b/test/utils/blockchain_lifecycle.ts
new file mode 100644
index 000000000..68e169ac0
--- /dev/null
+++ b/test/utils/blockchain_lifecycle.ts
@@ -0,0 +1,20 @@
+import {RPC} from './rpc';
+
+export class BlockchainLifecycle {
+ private rpc: RPC;
+ private snapshotId: number;
+ constructor() {
+ this.rpc = new RPC();
+ }
+ // TODO: In order to run these tests on an actual node, we should check if we are running against
+ // TestRPC, if so, use snapshots, otherwise re-deploy contracts before every test
+ public async startAsync(): Promise<void> {
+ this.snapshotId = await this.rpc.takeSnapshotAsync();
+ }
+ public async revertAsync(): Promise<void> {
+ const didRevert = await this.rpc.revertSnapshotAsync(this.snapshotId);
+ if (!didRevert) {
+ throw new Error(`Snapshot with id #${this.snapshotId} failed to revert`);
+ }
+ }
+};
diff --git a/test/utils/constants.ts b/test/utils/constants.ts
new file mode 100644
index 000000000..aa1967f88
--- /dev/null
+++ b/test/utils/constants.ts
@@ -0,0 +1,5 @@
+export const constants = {
+ NULL_ADDRESS: '0x0000000000000000000000000000000000000000',
+ RPC_HOST: 'localhost',
+ RPC_PORT: 8545,
+};
diff --git a/test/utils/rpc.ts b/test/utils/rpc.ts
new file mode 100644
index 000000000..e331fa6d4
--- /dev/null
+++ b/test/utils/rpc.ts
@@ -0,0 +1,48 @@
+import * as ethUtil from 'ethereumjs-util';
+import * as request from 'request-promise-native';
+import {constants} from './constants';
+
+export class RPC {
+ private host: string;
+ private port: number;
+ private id: number;
+ constructor() {
+ this.host = constants.RPC_HOST;
+ this.port = constants.RPC_PORT;
+ this.id = 0;
+ }
+ public async takeSnapshotAsync(): Promise<number> {
+ const method = 'evm_snapshot';
+ const params: any[] = [];
+ const payload = this.toPayload(method, params);
+ const snapshotIdHex = await this.sendAsync(payload);
+ const snapshotId = ethUtil.bufferToInt(ethUtil.toBuffer(snapshotIdHex));
+ return snapshotId;
+ }
+ public async revertSnapshotAsync(snapshotId: number): Promise<boolean> {
+ const method = 'evm_revert';
+ const params = [snapshotId];
+ const payload = this.toPayload(method, params);
+ const didRevert = await this.sendAsync(payload);
+ return didRevert;
+ }
+ private toPayload(method: string, params: any[] = []): string {
+ const payload = JSON.stringify({
+ id: this.id,
+ method,
+ params,
+ });
+ this.id += 1;
+ return payload;
+ }
+ private async sendAsync(payload: string): Promise<any> {
+ const opts = {
+ method: 'POST',
+ uri: `http://${this.host}:${this.port}`,
+ body: payload,
+ };
+ const bodyString = await request(opts);
+ const body = JSON.parse(bodyString);
+ return body.result;
+ }
+}
diff --git a/test/utils/web3_factory.ts b/test/utils/web3_factory.ts
new file mode 100644
index 000000000..493fbc2df
--- /dev/null
+++ b/test/utils/web3_factory.ts
@@ -0,0 +1,23 @@
+// HACK: web3 injects XMLHttpRequest into the global scope and ProviderEngine checks XMLHttpRequest
+// to know whether it is running in a browser or node environment. We need it to be undefined since
+// we are not running in a browser env.
+// Filed issue: https://github.com/ethereum/web3.js/issues/844
+(global as any).XMLHttpRequest = undefined;
+import ProviderEngine = require('web3-provider-engine');
+import RpcSubprovider = require('web3-provider-engine/subproviders/rpc');
+import * as Web3 from 'web3';
+import {constants} from './constants';
+
+export const web3Factory = {
+ create(): Web3 {
+ const provider = new ProviderEngine();
+ const rpcUrl = `http://${constants.RPC_HOST}:${constants.RPC_PORT}`;
+ provider.addProvider(new RpcSubprovider({
+ rpcUrl,
+ }));
+ provider.start();
+ const web3 = new Web3();
+ web3.setProvider(provider);
+ return web3;
+ },
+};
diff --git a/webpack.config.js b/webpack.config.js
index 04822d79d..67af51f7a 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -17,7 +17,7 @@ module.exports = {
umdNamedDefine: true,
},
resolve: {
- extensions: ['.ts', '.js'],
+ extensions: ['.ts', '.js', '.json'],
},
devtool: 'source-map',
plugins: [
@@ -28,13 +28,23 @@ module.exports = {
}),
],
module: {
- loaders: [{
- test: /\.ts$/,
- loader: 'awesome-typescript-loader',
- exclude: /node_modules/,
- query: {
- declaration: false,
+ rules: [
+ {
+ test: /\.ts$/,
+ use: [
+ {
+ loader: 'awesome-typescript-loader',
+ query: {
+ declaration: false,
+ },
+ },
+ ],
+ exclude: /node_modules/,
},
- }],
+ {
+ test: /\.json$/,
+ loader: 'json-loader',
+ },
+ ],
},
};