diff options
-rw-r--r-- | CHANGELOG.md | 5 | ||||
-rw-r--r-- | circle.yml | 1 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | src/0x.ts | 26 | ||||
-rw-r--r-- | src/artifacts/EtherToken.json | 6 | ||||
-rw-r--r-- | src/artifacts/Mintable.json | 4 | ||||
-rw-r--r-- | src/artifacts/Proxy.json | 6 | ||||
-rw-r--r-- | src/artifacts/Token.json | 4 | ||||
-rw-r--r-- | src/artifacts/TokenRegistry.json | 6 | ||||
-rw-r--r-- | src/artifacts/exchange/Exchange_v1.json (renamed from src/artifacts/Exchange.json) | 115 | ||||
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 206 | ||||
-rw-r--r-- | src/contract_wrappers/proxy_wrapper.ts | 33 | ||||
-rw-r--r-- | src/exchange_artifacts_by_name.ts | 6 | ||||
-rw-r--r-- | src/globals.d.ts | 4 | ||||
-rw-r--r-- | src/types.ts | 21 | ||||
-rw-r--r-- | src/utils/assert.ts | 1 | ||||
-rw-r--r-- | src/utils/schema_validator.ts | 2 | ||||
-rw-r--r-- | src/utils/utils.ts | 4 | ||||
-rw-r--r-- | test/0x.js_test.ts | 33 | ||||
-rw-r--r-- | test/artifacts_test.ts | 8 | ||||
-rw-r--r-- | test/exchange_wrapper_test.ts | 128 | ||||
-rw-r--r-- | test/proxy_wrapper_test.ts | 23 | ||||
-rw-r--r-- | test/utils/fill_scenarios.ts | 7 | ||||
-rw-r--r-- | test/utils/order_factory.ts | 4 | ||||
-rw-r--r-- | yarn.lock | 19 |
25 files changed, 509 insertions, 165 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index da3d641ac..700095ea0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # CHANGELOG +v0.7.2 - _Jun. 26, 2017_ +------------------------ + * Add the ability to call methods on different authorized versions of the Exchange smart contract (#82) + * Update contract artifacts to reflect latest changes to the smart contracts (0xproject/contracts#59) + v0.7.1 - _Jun. 26, 2017_ ------------------------ * Add the ability to convert Ether to wrapped Ether tokens and back via `zeroEx.etherToken.depostAsync` and `zeroEx.etherToken.withdrawAsync` (#81) diff --git a/circle.yml b/circle.yml index b13422f5a..7bb33efed 100644 --- a/circle.yml +++ b/circle.yml @@ -8,7 +8,6 @@ test: background: true - git clone git@github.com:0xProject/contracts.git ../contracts - cd ../contracts; git checkout cd04d7c; npm install && npm run migrate - - npm run update_contracts - npm run test:coverage - npm run report_test_coverage - npm run test:umd diff --git a/package.json b/package.json index 757cdf3e9..4f9c6f3ae 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "build:dev": "npm run clean && run-p build:*:dev", "build:umd:dev": "webpack", "build:umd:prod": "NODE_ENV=production webpack", - "build:commonjs:dev": "tsc; copyfiles -u 2 ./src/artifacts/*.json ../0x.js/lib/src/artifacts;", + "build:commonjs:dev": "tsc; copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts;", "test:commonjs": "run-s build:commonjs:dev run_mocha", "pretest:umd": "run-s clean build:*:dev", "substitute_umd_bundle": "npm run remove_src_files_not_used_by_tests; shx mv _bundles/* lib/src", @@ -15,8 +15,8 @@ import {TokenRegistryWrapper} from './contract_wrappers/token_registry_wrapper'; import {EtherTokenWrapper} from './contract_wrappers/ether_token_wrapper'; import {ecSignatureSchema} from './schemas/ec_signature_schema'; import {TokenWrapper} from './contract_wrappers/token_wrapper'; +import {ProxyWrapper} from './contract_wrappers/proxy_wrapper'; import {ECSignature, ZeroExError, Order, SignedOrder, Web3Provider} from './types'; -import * as ExchangeArtifacts from './artifacts/Exchange.json'; import {orderSchema} from './schemas/order_schemas'; // Customize our BigNumber instances @@ -52,6 +52,7 @@ export class ZeroEx { * wrapped ETH ERC20 token smart contract. */ public etherToken: EtherTokenWrapper; + private _proxyWrapper: ProxyWrapper; private _web3Wrapper: Web3Wrapper; /** * Verifies that the elliptic curve signature `signature` was generated @@ -149,7 +150,8 @@ export class ZeroEx { constructor(provider: Web3Provider) { this._web3Wrapper = new Web3Wrapper(provider); this.token = new TokenWrapper(this._web3Wrapper); - this.exchange = new ExchangeWrapper(this._web3Wrapper, this.token); + this._proxyWrapper = new ProxyWrapper(this._web3Wrapper); + this.exchange = new ExchangeWrapper(this._web3Wrapper, this.token, this._proxyWrapper); this.tokenRegistry = new TokenRegistryWrapper(this._web3Wrapper); this.etherToken = new EtherTokenWrapper(this._web3Wrapper, this.token); } @@ -160,9 +162,10 @@ export class ZeroEx { */ public async setProviderAsync(provider: Web3Provider) { this._web3Wrapper.setProvider(provider); - await this.exchange.invalidateContractInstanceAsync(); + await this.exchange.invalidateContractInstancesAsync(); this.tokenRegistry.invalidateContractInstance(); this.token.invalidateContractInstances(); + this._proxyWrapper.invalidateContractInstance(); } /** * Get user Ethereum addresses available through the supplied web3 instance available for sending transactions. @@ -177,11 +180,9 @@ export class ZeroEx { * @param order An object that conforms to the Order or SignedOrder interface definitions. * @return The resulting orderHash from hashing the supplied order. */ - public async getOrderHashHexAsync(order: Order|SignedOrder): Promise<string> { + public getOrderHashHex(order: Order|SignedOrder): string { assert.doesConformToSchema('order', order, orderSchema); - - const exchangeContractAddr = await this._getExchangeAddressAsync(); - const orderHashHex = utils.getOrderHashHex(order, exchangeContractAddr); + const orderHashHex = utils.getOrderHashHex(order); return orderHashHex; } /** @@ -245,15 +246,4 @@ export class ZeroEx { } return ecSignature; } - private async _getExchangeAddressAsync() { - const networkIdIfExists = await this._web3Wrapper.getNetworkIdIfExistsAsync(); - const exchangeNetworkConfigsIfExists = _.isUndefined(networkIdIfExists) ? - undefined : - (ExchangeArtifacts as any).networks[networkIdIfExists]; - if (_.isUndefined(exchangeNetworkConfigsIfExists)) { - throw new Error(ZeroExError.CONTRACT_NOT_DEPLOYED_ON_NETWORK); - } - const exchangeAddress = exchangeNetworkConfigsIfExists.address; - return exchangeAddress; - } } diff --git a/src/artifacts/EtherToken.json b/src/artifacts/EtherToken.json index 0307cb22c..3ca4bd797 100644 --- a/src/artifacts/EtherToken.json +++ b/src/artifacts/EtherToken.json @@ -229,7 +229,7 @@ "type": "event" } ], - "unlinked_binary": "0x606060405234610000575b61072d806100196000396000f300606060405236156100935763ffffffff60e060020a60003504166306fdde038114610098578063095ea7b31461012557806318160ddd1461015557806323b872dd146101745780632e1a7d4d146101aa578063313ce567146101bc57806370a08231146101df57806395d89b411461020a578063a9059cbb14610297578063d0e30db0146102c7578063dd62ed3e146102d1575b610000565b34610000576100a5610302565b6040805160208082528351818301528351919283929083019185019080838382156100eb575b8051825260208311156100eb57601f1990920191602091820191016100cb565b505050905090810190601f1680156101175780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3461000057610141600160a060020a0360043516602435610339565b604080519115158252519081900360200190f35b34610000576101626103a4565b60408051918252519081900360200190f35b3461000057610141600160a060020a03600435811690602435166044356103aa565b604080519115158252519081900360200190f35b34610000576101ba6004356104a7565b005b34610000576101c9610527565b6040805160ff9092168252519081900360200190f35b3461000057610162600160a060020a036004351661052c565b60408051918252519081900360200190f35b34610000576100a561054b565b6040805160208082528351818301528351919283929083019185019080838382156100eb575b8051825260208311156100eb57601f1990920191602091820191016100cb565b505050905090810190601f1680156101175780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3461000057610141600160a060020a0360043516602435610582565b604080519115158252519081900360200190f35b6101ba610634565b005b3461000057610162600160a060020a0360043581169060243516610683565b60408051918252519081900360200190f35b60408051808201909152600b81527f457468657220546f6b656e000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260016020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60025481565b600160a060020a0383166000908152602081905260408120546103cd90836106b0565b600160a060020a03808616600090815260208181526040808320949094556001815283822033909316825291909152205461040890836106b0565b600160a060020a0380861660009081526001602090815260408083203385168452825280832094909455918616815290819052205461044790836106c9565b600160a060020a038085166000818152602081815260409182902094909455805186815290519193928816927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35060015b9392505050565b600160a060020a0333166000908152602081905260409020546104ca90826106b0565b600160a060020a0333166000908152602081905260409020556002546104f090826106b0565b600255604051600160a060020a0333169082156108fc029083906000818181858888f19350505050151561052357610000565b5b50565b601281565b600160a060020a0381166000908152602081905260409020545b919050565b60408051808201909152600481527f5745544800000000000000000000000000000000000000000000000000000000602082015281565b600160a060020a0333166000908152602081905260408120546105a590836106b0565b600160a060020a0333811660009081526020819052604080822093909355908516815220546105d490836106c9565b600160a060020a03808516600081815260208181526040918290209490945580518681529051919333909316927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35060015b92915050565b600160a060020a03331660009081526020819052604090205461065790346106c9565b600160a060020a03331660009081526020819052604090205560025461067d90346106c9565b6002555b565b600160a060020a038083166000908152600160209081526040808320938516835292905220545b92915050565b60006106be838311156106f1565b508082035b92915050565b60008282016106e68482108015906106e15750838210155b6106f1565b8091505b5092915050565b80151561052357610000565b5b505600a165627a7a72305820c7cc457bf87c8b3047275eaa71935a1612af007e4bc77d832c588245805374480029", + "unlinked_binary": "0x6060604052341561000c57fe5b5b6107218061001c6000396000f300606060405236156100935763ffffffff60e060020a60003504166306fdde038114610095578063095ea7b31461012557806318160ddd1461015857806323b872dd1461017a5780632e1a7d4d146101b3578063313ce567146101c857806370a08231146101ee57806395d89b411461021c578063a9059cbb146102ac578063d0e30db0146102df578063dd62ed3e146102e9575bfe5b341561009d57fe5b6100a561031d565b6040805160208082528351818301528351919283929083019185019080838382156100eb575b8051825260208311156100eb57601f1990920191602091820191016100cb565b505050905090810190601f1680156101175780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561012d57fe5b610144600160a060020a0360043516602435610345565b604080519115158252519081900360200190f35b341561016057fe5b6101686103b0565b60408051918252519081900360200190f35b341561018257fe5b610144600160a060020a03600435811690602435166044356103b6565b604080519115158252519081900360200190f35b34156101bb57fe5b6101c66004356104a1565b005b34156101d057fe5b6101d8610522565b6040805160ff9092168252519081900360200190f35b34156101f657fe5b610168600160a060020a0360043516610527565b60408051918252519081900360200190f35b341561022457fe5b6100a5610546565b6040805160208082528351818301528351919283929083019185019080838382156100eb575b8051825260208311156100eb57601f1990920191602091820191016100cb565b505050905090810190601f1680156101175780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156102b457fe5b610144600160a060020a0360043516602435610567565b604080519115158252519081900360200190f35b6101c6610607565b005b34156102f157fe5b610168600160a060020a0360043581169060243516610656565b60408051918252519081900360200190f35b60408051808201909152600b815260a960020a6a22ba3432b9102a37b5b2b702602082015281565b600160a060020a03338116600081815260016020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60025481565b600160a060020a0383166000908152602081905260408120546103d99083610683565b600160a060020a0380861660009081526020818152604080832094909455600181528382203390931682529190915220546104149083610683565b600160a060020a03808616600090815260016020908152604080832033851684528252808320949094559186168152908190522054610453908361069c565b600160a060020a038085166000818152602081815260409182902094909455805186815290519193928816926000805160206106d683398151915292918290030190a35060015b9392505050565b600160a060020a0333166000908152602081905260409020546104c49082610683565b600160a060020a0333166000908152602081905260409020556002546104ea9082610683565b600255604051600160a060020a0333169082156108fc029083906000818181858888f19350505050151561051e5760006000fd5b5b50565b601281565b600160a060020a0381166000908152602081905260409020545b919050565b604080518082019091526004815260e360020a630ae8aa8902602082015281565b600160a060020a03331660009081526020819052604081205461058a9083610683565b600160a060020a0333811660009081526020819052604080822093909355908516815220546105b9908361069c565b600160a060020a03808516600081815260208181526040918290209490945580518681529051919333909316926000805160206106d683398151915292918290030190a35060015b92915050565b600160a060020a03331660009081526020819052604090205461062a903461069c565b600160a060020a033316600090815260208190526040902055600254610650903461069c565b6002555b565b600160a060020a038083166000908152600160209081526040808320938516835292905220545b92915050565b6000610691838311156106c4565b508082035b92915050565b60008282016106b98482108015906106b45750838210155b6106c4565b8091505b5092915050565b80151561051e5760006000fd5b5b505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820d39a3d758ea0042048564f60b0e39c59508468d4de91cd9b7b5f708b554f699c0029", "networks": { "42": { "links": {}, @@ -330,10 +330,10 @@ "type": "event" } }, - "updated_at": 1495030736786, + "updated_at": 1498588231356, "address": "0x48bacb9266a570d521063ef5dd96e61686dbe788" } }, "schema_version": "0.0.5", - "updated_at": 1496294576956 + "updated_at": 1498588231356 }
\ No newline at end of file diff --git a/src/artifacts/Mintable.json b/src/artifacts/Mintable.json index eed87f498..fc4b93cae 100644 --- a/src/artifacts/Mintable.json +++ b/src/artifacts/Mintable.json @@ -182,8 +182,8 @@ "type": "event" } ], - "unlinked_binary": "0x606060405234610000575b6104e7806100196000396000f300606060405236156100675763ffffffff60e060020a600035041663095ea7b3811461006c57806318160ddd1461009c57806323b872dd146100bb57806370a08231146100f1578063a0712d681461011c578063a9059cbb1461012e578063dd62ed3e1461015e575b610000565b3461000057610088600160a060020a036004351660243561018f565b604080519115158252519081900360200190f35b34610000576100a96101fa565b60408051918252519081900360200190f35b3461000057610088600160a060020a0360043581169060243516604435610200565b604080519115158252519081900360200190f35b34610000576100a9600160a060020a036004351661030d565b60408051918252519081900360200190f35b346100005761012c60043561032c565b005b3461000057610088600160a060020a0360043516602435610393565b604080519115158252519081900360200190f35b34610000576100a9600160a060020a0360043581169060243516610456565b60408051918252519081900360200190f35b600160a060020a03338116600081815260016020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60025481565b600160a060020a0383166000908152602081905260408120548290108015906102505750600160a060020a0380851660009081526001602090815260408083203390941683529290522054829010155b80156102755750600160a060020a038316600090815260208190526040902054828101115b1561030157600160a060020a0380841660008181526020818152604080832080548801905588851680845281842080548990039055600183528184203390961684529482529182902080548790039055815186815291519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3506001610305565b5060005b5b9392505050565b600160a060020a0381166000908152602081905260409020545b919050565b68056bc75e2d6310000081111561034257610000565b600160a060020a033316600090815260208190526040902054610366908290610483565b600160a060020a03331660009081526020819052604090205560025461038c9082610483565b6002555b50565b600160a060020a0333166000908152602081905260408120548290108015906103d55750600160a060020a038316600090815260208190526040902054828101115b1561044757600160a060020a0333811660008181526020818152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35060016101f4565b5060006101f4565b5b92915050565b600160a060020a038083166000908152600160209081526040808320938516835292905220545b92915050565b60008282016104a084821080159061049b5750838210155b6104ab565b8091505b5092915050565b80151561039057610000565b5b505600a165627a7a723058204789b7d0fd9aae8d16b771c1b12c5863cfa8aaef739d2d811f91e447ee450bce0029", + "unlinked_binary": "0x6060604052341561000c57fe5b5b6104f78061001c6000396000f300606060405236156100675763ffffffff60e060020a600035041663095ea7b3811461006957806318160ddd1461009c57806323b872dd146100be57806370a08231146100f7578063a0712d6814610125578063a9059cbb1461013a578063dd62ed3e1461016d575bfe5b341561007157fe5b610088600160a060020a03600435166024356101a1565b604080519115158252519081900360200190f35b34156100a457fe5b6100ac61020c565b60408051918252519081900360200190f35b34156100c657fe5b610088600160a060020a0360043581169060243516604435610212565b604080519115158252519081900360200190f35b34156100ff57fe5b6100ac600160a060020a036004351661030d565b60408051918252519081900360200190f35b341561012d57fe5b61013860043561032c565b005b341561014257fe5b610088600160a060020a0360043516602435610394565b604080519115158252519081900360200190f35b341561017557fe5b6100ac600160a060020a0360043581169060243516610445565b60408051918252519081900360200190f35b600160a060020a03338116600081815260016020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60025481565b600160a060020a0383166000908152602081905260408120548290108015906102625750600160a060020a0380851660009081526001602090815260408083203390941683529290522054829010155b80156102875750600160a060020a038316600090815260208190526040902054828101115b1561030157600160a060020a0380841660008181526020818152604080832080548801905588851680845281842080548990039055600183528184203390961684529482529182902080548790039055815186815291519293926000805160206104ac8339815191529281900390910190a3506001610305565b5060005b5b9392505050565b600160a060020a0381166000908152602081905260409020545b919050565b68056bc75e2d631000008111156103435760006000fd5b600160a060020a033316600090815260208190526040902054610367908290610472565b600160a060020a03331660009081526020819052604090205560025461038d9082610472565b6002555b50565b600160a060020a0333166000908152602081905260408120548290108015906103d65750600160a060020a038316600090815260208190526040902054828101115b1561043657600160a060020a0333811660008181526020818152604080832080548890039055938716808352918490208054870190558351868152935191936000805160206104ac833981519152929081900390910190a3506001610206565b506000610206565b5b92915050565b600160a060020a038083166000908152600160209081526040808320938516835292905220545b92915050565b600082820161048f84821080159061048a5750838210155b61049a565b8091505b5092915050565b8015156103915760006000fd5b5b505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a7230582017b556a0dd152ca0b949c108d1e5479ccafa38c1a952572dde1d45dab72f113b0029", "networks": {}, "schema_version": "0.0.5", - "updated_at": 1496294434244 + "updated_at": 1498588228068 }
\ No newline at end of file diff --git a/src/artifacts/Proxy.json b/src/artifacts/Proxy.json index e7d4ba714..c001cee5b 100644 --- a/src/artifacts/Proxy.json +++ b/src/artifacts/Proxy.json @@ -177,7 +177,7 @@ "type": "event" } ], - "unlinked_binary": "0x60606040525b60008054600160a060020a03191633600160a060020a03161790555b5b610701806100316000396000f300606060405236156100725763ffffffff60e060020a60003504166315dacbea811461007757806342f1181e146100b3578063494503d4146100e0578063707129391461010c5780638da5cb5b14610139578063b918161114610162578063d39de6e91461018f578063f2fde38b146101f7575b610000565b346100005761009f600160a060020a0360043581169060243581169060443516606435610212565b604080519115158252519081900360200190f35b346100005761009f600160a060020a03600435166102d8565b604080519115158252519081900360200190f35b34610000576100f06004356103f5565b60408051600160a060020a039092168252519081900360200190f35b346100005761009f600160a060020a0360043516610425565b604080519115158252519081900360200190f35b34610000576100f06105ee565b60408051600160a060020a039092168252519081900360200190f35b346100005761009f600160a060020a03600435166105fd565b604080519115158252519081900360200190f35b346100005761019c610612565b60408051602080825283518183015283519192839290830191858101910280838382156101e4575b8051825260208311156101e457601f1990920191602091820191016101c4565b5050509050019250505060405180910390f35b3461000057610210600160a060020a036004351661067d565b005b600160a060020a03331660009081526001602052604081205460ff16151561023957610000565b604080516000602091820181905282517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a0388811660048301528781166024830152604482018790529351938916936323b872dd9360648084019491938390030190829087803b156100005760325a03f11561000057505060405151151590506102cb57610000565b5060015b5b949350505050565b6000805433600160a060020a039081169116146102f457610000565b600160a060020a038216600090815260016020526040902054829060ff161561031c57610000565b600160a060020a0383166000908152600160208190526040909120805460ff191682179055600280549182018082559091908281838015829011610385576000838152602090206103859181019083015b80821115610381576000815560010161036d565b5090565b5b505050916000526020600020900160005b81546101009190910a600160a060020a0381810219909216878316918202179092556040513390911692507f94bb87f4c15c4587ff559a7584006fa01ddf9299359be6b512b94527aa961aca90600090a3600191505b5b505b919050565b600281815481101561000057906000526020600020900160005b915054906101000a9004600160a060020a031681565b60008054819033600160a060020a0390811691161461044357610000565b600160a060020a038316600090815260016020526040902054839060ff16151561046c57610000565b600160a060020a0384166000908152600160205260408120805460ff1916905591505b6002548210156105a75783600160a060020a0316600283815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316141561059b576002805460001981019081101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600283815481101561000057906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a031602179055506001600281818054905003915081815481835581811511610591576000838152602090206105919181019083015b80821115610381576000815560010161036d565b5090565b5b505050506105a7565b5b60019091019061048f565b604051600160a060020a0333811691908616907ff5b347a1e40749dd050f5f07fbdbeb7e3efa9756903044dd29401fd1d4bb4a1c90600090a3600192505b5b505b50919050565b600054600160a060020a031681565b60016020526000908152604090205460ff1681565b60408051602081810183526000825260028054845181840281018401909552808552929392909183018282801561067257602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610654575b505050505090505b90565b60005433600160a060020a0390811691161461069857610000565b600160a060020a038116156106d0576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b5b505600a165627a7a72305820e094d2460f9f11db4e36cf6e7af1eb1f6fb883275fea375d814c23e81802753b0029", + "unlinked_binary": "0x60606040525b60008054600160a060020a03191633600160a060020a03161790555b5b610727806100316000396000f300606060405236156100725763ffffffff60e060020a60003504166315dacbea811461007457806342f1181e146100b3578063494503d4146100e357806370712939146101125780638da5cb5b14610142578063b91816111461016e578063d39de6e91461019e578063f2fde38b14610209575bfe5b341561007c57fe5b61009f600160a060020a0360043581169060243581169060443516606435610227565b604080519115158252519081900360200190f35b34156100bb57fe5b61009f600160a060020a03600435166102e0565b604080519115158252519081900360200190f35b34156100eb57fe5b6100f66004356103c9565b60408051600160a060020a039092168252519081900360200190f35b341561011a57fe5b61009f600160a060020a03600435166103fb565b604080519115158252519081900360200190f35b341561014a57fe5b6100f661059b565b60408051600160a060020a039092168252519081900360200190f35b341561017657fe5b61009f600160a060020a03600435166105aa565b604080519115158252519081900360200190f35b34156101a657fe5b6101ae6105bf565b60408051602080825283518183015283519192839290830191858101910280838382156101f6575b8051825260208311156101f657601f1990920191602091820191016101d6565b5050509050019250505060405180910390f35b341561021157fe5b610225600160a060020a0360043516610628565b005b600160a060020a03331660009081526001602052604081205460ff16151561024f5760006000fd5b6040805160006020918201819052825160e060020a6323b872dd028152600160a060020a0388811660048301528781166024830152604482018790529351938916936323b872dd9360648084019491938390030190829087803b15156102b157fe5b6102c65a03f115156102bf57fe5b505060405151151590506102d35760006000fd5b5060015b5b949350505050565b6000805433600160a060020a039081169116146102fd5760006000fd5b600160a060020a038216600090815260016020526040902054829060ff16156103265760006000fd5b600160a060020a0383166000908152600160208190526040909120805460ff191682179055600280549091810161035d8382610674565b916000526020600020900160005b81546101009190910a600160a060020a0381810219909216878316918202179092556040513390911692507f94bb87f4c15c4587ff559a7584006fa01ddf9299359be6b512b94527aa961aca90600090a3600191505b5b505b919050565b60028054829081106103d757fe5b906000526020600020900160005b915054906101000a9004600160a060020a031681565b60008054819033600160a060020a0390811691161461041a5760006000fd5b600160a060020a038316600090815260016020526040902054839060ff1615156104445760006000fd5b600160a060020a0384166000908152600160205260408120805460ff1916905591505b6002548210156105545783600160a060020a031660028381548110151561048a57fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a03161415610548576002805460001981019081106104cb57fe5b906000526020600020900160005b9054906101000a9004600160a060020a03166002838154811015156104fa57fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a0316021790555060016002818180549050039150816105429190610674565b50610554565b5b600190910190610467565b604051600160a060020a0333811691908616907ff5b347a1e40749dd050f5f07fbdbeb7e3efa9756903044dd29401fd1d4bb4a1c90600090a3600192505b5b505b50919050565b600054600160a060020a031681565b60016020526000908152604090205460ff1681565b6105c76106c8565b600280548060200260200160405190810160405280929190818152602001828054801561061d57602002820191906000526020600020905b8154600160a060020a031681526001909101906020018083116105ff575b505050505090505b90565b60005433600160a060020a039081169116146106445760006000fd5b600160a060020a0381161561066f5760008054600160a060020a031916600160a060020a0383161790555b5b5b50565b815481835581811511610698576000838152602090206106989181019083016106da565b5b505050565b815481835581811511610698576000838152602090206106989181019083016106da565b5b505050565b60408051602081019091526000815290565b61062591905b808211156106f457600081556001016106e0565b5090565b905600a165627a7a7230582021aadf834398ddc9f252eb0b3ab6ddea131aa7bca5d904d429a49ab48bcbe2910029", "networks": { "42": { "links": {}, @@ -258,10 +258,10 @@ "type": "event" } }, - "updated_at": 1495030736781, + "updated_at": 1498588231340, "address": "0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c" } }, "schema_version": "0.0.5", - "updated_at": 1496294576942 + "updated_at": 1498588231340 }
\ No newline at end of file diff --git a/src/artifacts/Token.json b/src/artifacts/Token.json index 4894f5be5..f44de34b8 100644 --- a/src/artifacts/Token.json +++ b/src/artifacts/Token.json @@ -169,8 +169,8 @@ "type": "event" } ], - "unlinked_binary": "0x606060405234610000575b6101d1806100196000396000f3006060604052361561005c5763ffffffff60e060020a600035041663095ea7b3811461006157806318160ddd1461009157806323b872dd146100b057806370a08231146100e6578063a9059cbb14610061578063dd62ed3e14610141575b610000565b346100005761007d600160a060020a0360043516602435610172565b604080519115158252519081900360200190f35b346100005761009e61017b565b60408051918252519081900360200190f35b346100005761007d600160a060020a0360043581169060243516604435610181565b604080519115158252519081900360200190f35b346100005761009e600160a060020a036004351661018b565b60408051918252519081900360200190f35b346100005761007d600160a060020a0360043516602435610172565b604080519115158252519081900360200190f35b346100005761009e600160a060020a0360043581169060243516610172565b60408051918252519081900360200190f35b60005b92915050565b60005b90565b60005b9392505050565b60005b919050565b60005b92915050565b60005b929150505600a165627a7a7230582041bf388c3189085f6807945974edea68192611a83cc2920536293b220d1e7fcb0029", + "unlinked_binary": "0x6060604052341561000c57fe5b5b6101e08061001c6000396000f3006060604052361561005c5763ffffffff60e060020a600035041663095ea7b3811461005e57806318160ddd1461009157806323b872dd146100b357806370a08231146100ec578063a9059cbb1461005e578063dd62ed3e1461014d575bfe5b341561006657fe5b61007d600160a060020a0360043516602435610181565b604080519115158252519081900360200190f35b341561009957fe5b6100a161018a565b60408051918252519081900360200190f35b34156100bb57fe5b61007d600160a060020a0360043581169060243516604435610190565b604080519115158252519081900360200190f35b34156100f457fe5b6100a1600160a060020a036004351661019a565b60408051918252519081900360200190f35b341561006657fe5b61007d600160a060020a0360043516602435610181565b604080519115158252519081900360200190f35b341561015557fe5b6100a1600160a060020a0360043581169060243516610181565b60408051918252519081900360200190f35b60005b92915050565b60005b90565b60005b9392505050565b60005b919050565b60005b92915050565b60005b929150505600a165627a7a723058203c197cc1ab179269cf5d1ae1606a41063b723c0e550a2805382c9c4600ddc75e0029", "networks": {}, "schema_version": "0.0.5", - "updated_at": 1496294434247 + "updated_at": 1498588228068 }
\ No newline at end of file diff --git a/src/artifacts/TokenRegistry.json b/src/artifacts/TokenRegistry.json index ef039b85c..6d8bbfd64 100644 --- a/src/artifacts/TokenRegistry.json +++ b/src/artifacts/TokenRegistry.json @@ -592,7 +592,7 @@ "type": "event" } ], - "unlinked_binary": "0x60606040525b60008054600160a060020a03191633600160a060020a03161790555b5b6128d2806100316000396000f300606060405236156100d55763ffffffff60e060020a6000350416632fbfeba981146100da57806334ed557f146101495780633550b6d9146101675780635fa7b584146101d65780637abccac9146101f15780638da5cb5b1461039f57806391914b30146103c85780639a84d0c414610427578063c370c86d14610510578063e48603391461056f578063e5df8b8414610732578063e73fc0c31461075e578063eaabd05e14610946578063ee8c24b814610964578063efa74f1f146109cc578063f036417f14610bb4578063f2fde38b14610c13575b610000565b346100005761012d600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843750949650610c2e95505050505050565b60408051600160a060020a039092168252519081900360200190f35b3461000057610165600160a060020a0360043516602435610ca1565b005b346100005761012d600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843750949650610d5295505050505050565b60408051600160a060020a039092168252519081900360200190f35b3461000057610165600160a060020a0360043516610dc5565b005b346100005761020a600160a060020a036004351661139e565b60408051600160a060020a038916815260ff8516608082015260a0810184905260c0810183905260e060208083018281528a5192840192909252895192939192918401916060850191610100860191908c01908083838215610287575b80518252602083111561028757601f199092019160209182019101610267565b505050905090810190601f1680156102b35780820380516001836020036101000a031916815260200191505b5084810383528951815289516020918201918b019080838382156102f2575b8051825260208311156102f257601f1990920191602091820191016102d2565b505050905090810190601f16801561031e5780820380516001836020036101000a031916815260200191505b5084810382528851815288516020918201918a0190808383821561035d575b80518252602083111561035d57601f19909201916020918201910161033d565b505050905090810190601f1680156103895780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b346100005761012d611661565b60408051600160a060020a039092168252519081900360200190f35b346100005760408051602060046024803582810135601f8101859004850286018501909652858552610165958335600160a060020a0316959394604494939290920191819084018382808284375094965061167095505050505050565b005b346100005760408051602060046024803582810135601f8101859004850286018501909652858552610165958335600160a060020a0316959394604494939290920191819084018382808284375050604080516020601f89358b0180359182018390048302840183019094528083529799988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979998810197919650918201945092508291508401838280828437509496505060ff853516946020810135945060400135925061189e915050565b005b346100005760408051602060046024803582810135601f8101859004850286018501909652858552610165958335600160a060020a03169593946044949392909201918190840183828082843750949650611ebe95505050505050565b005b3461000057610588600160a060020a03600435166121f7565b60408051600160a060020a038916815260ff8516608082015260a0810184905260c0810183905260e06020820181815289546002610100600183161581026000190190921604928401839052929390929084019160608501918501908b9080156106335780601f1061060857610100808354040283529160200191610633565b820191906000526020600020905b81548152906001019060200180831161061657829003601f168201915b505084810383528954600260001961010060018416150201909116048082526020909101908a9080156106a75780601f1061067c576101008083540402835291602001916106a7565b820191906000526020600020905b81548152906001019060200180831161068a57829003601f168201915b505084810382528854600260001961010060018416150201909116048082526020909101908990801561071b5780601f106106f05761010080835404028352916020019161071b565b820191906000526020600020905b8154815290600101906020018083116106fe57829003601f168201915b50509a505050505050505050505060405180910390f35b346100005761012d60043561223b565b60408051600160a060020a039092168252519081900360200190f35b346100005761020a600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375094965061226b95505050505050565b60408051600160a060020a038916815260ff8516608082015260a0810184905260c0810183905260e060208083018281528a5192840192909252895192939192918401916060850191610100860191908c01908083838215610287575b80518252602083111561028757601f199092019160209182019101610267565b505050905090810190601f1680156102b35780820380516001836020036101000a031916815260200191505b5084810383528951815289516020918201918b019080838382156102f2575b8051825260208311156102f257601f1990920191602091820191016102d2565b505050905090810190601f16801561031e5780820380516001836020036101000a031916815260200191505b5084810382528851815288516020918201918a0190808383821561035d575b80518252602083111561035d57601f19909201916020918201910161033d565b505050905090810190601f1680156103895780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b3461000057610165600160a060020a0360043516602435612339565b005b34610000576109716123ea565b60408051602080825283518183015283519192839290830191858101910280838382156109b9575b8051825260208311156109b957601f199092019160209182019101610999565b5050509050019250505060405180910390f35b346100005761020a600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375094965061245595505050505050565b60408051600160a060020a038916815260ff8516608082015260a0810184905260c0810183905260e060208083018281528a5192840192909252895192939192918401916060850191610100860191908c01908083838215610287575b80518252602083111561028757601f199092019160209182019101610267565b505050905090810190601f1680156102b35780820380516001836020036101000a031916815260200191505b5084810383528951815289516020918201918b019080838382156102f2575b8051825260208311156102f257601f1990920191602091820191016102d2565b505050905090810190601f16801561031e5780820380516001836020036101000a031916815260200191505b5084810382528851815288516020918201918a0190808383821561035d575b80518252602083111561035d57601f19909201916020918201910161033d565b505050905090810190601f1680156103895780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b346100005760408051602060046024803582810135601f8101859004850286018501909652858552610165958335600160a060020a0316959394604494939290920191819084018382808284375094965061252395505050505050565b005b3461000057610165600160a060020a036004351661285b565b005b60006003826040518082805190602001908083835b60208310610c625780518252601f199092019160209182019101610c43565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054600160a060020a0316925050505b919050565b6000805433600160a060020a03908116911614610cbd57610000565b600160a060020a0380841660009081526001602052604090205484911615610d4957600160a060020a038416600081815260016020908152604091829020600581015483519485529184019190915282820186905290519093507fe46a8f26cfc48c12e40cf50c1063e5913b2a17da6aa396f9b008b2dfd6f273b59181900360600190a1600582018390555b5b5b505b505050565b60006002826040518082805190602001908083835b60208310610c625780518252601f199092019160209182019101610c43565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054600160a060020a0316925050505b919050565b60008054819033600160a060020a03908116911614610de357610000565b600160a060020a0380841660009081526001602052604090205484911615610d4957600092505b600454831015610f225783600160a060020a0316600484815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a03161415610f16576004805460001981019081101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600484815481101561000057906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a031602179055506001600481818054905003915081815481835581811511610f0c57600083815260209020610f0c9181019083015b80821115610f085760008155600101610ef4565b5090565b5b50505050610f22565b5b600190920191610e0a565b600160a060020a03808516600090815260016020818152604092839020805460048201546005830154600684015487519390981680845260ff9092166080840181905260a0840182905260c0840189905260e09584018681528588018054600299811615610100908102600019019091168a9004988701899052969c507fc9ec69d3b744b4ec70f035ed0a15ed7029e668bfb9f326e657878b2b38a90da29a949990988d019760038e0197939694959493918401916060850191908501908b90801561102f5780601f106110045761010080835404028352916020019161102f565b820191906000526020600020905b81548152906001019060200180831161101257829003601f168201915b505084810383528954600260001961010060018416150201909116048082526020909101908a9080156110a35780601f10611078576101008083540402835291602001916110a3565b820191906000526020600020905b81548152906001019060200180831161108657829003601f168201915b50508481038252885460026000196101006001841615020190911604808252602090910190899080156111175780601f106110ec57610100808354040283529160200191611117565b820191906000526020600020905b8154815290600101906020018083116110fa57829003601f168201915b50509a505050505050505050505060405180910390a1600282600201604051808280546001816001161561010002031660029004801561118e5780601f1061116c57610100808354040283529182019161118e565b820191906000526020600020905b81548152906001019060200180831161117a575b5050915050908152602001604051809103902060006101000a815490600160a060020a03021916905560038260010160405180828054600181600116156101000203166002900480156112185780601f106111f6576101008083540402835291820191611218565b820191906000526020600020905b815481529060010190602001808311611204575b50509283525050604080519182900360209081019092208054600160a060020a0319908116909155600160a060020a03871660009081526001938490529182208054909116815580830180548382559193909160029181161561010002600019011604601f81901061128a57506112bc565b601f0160209004906000526020600020908101906112bc91905b80821115610f085760008155600101610ef4565b5090565b5b5060028201805460018160011615610100020316600290046000825580601f106112e75750611319565b601f01602090049060005260206000209081019061131991905b80821115610f085760008155600101610ef4565b5090565b5b5060038201805460018160011615610100020316600290046000825580601f106113445750611376565b601f01602090049060005260206000209081019061137691905b80821115610f085760008155600101610ef4565b5090565b5b505060048101805460ff191690556000600582018190556006909101555b5b5b505b505050565b604080516020818101835260008083528351808301855281815284518084018652828152855160e08181018852848252875180870189528581528287015287518087018952858152828901528751808701895285815260608301526080820185905260a0820185905260c08201859052600160a060020a03898116865260018088528987208a519384018b528054909216835281810180548b51601f6002948316156101000260001901909216939093049081018a90048a0283018a01909b528a82529699959794968a968796879695949385820193909290918301828280156114c95780601f1061149e576101008083540402835291602001916114c9565b820191906000526020600020905b8154815290600101906020018083116114ac57829003601f168201915b5050509183525050600282810180546040805160206001841615610100026000190190931694909404601f8101839004830285018301909152808452938101939083018282801561155b5780601f106115305761010080835404028352916020019161155b565b820191906000526020600020905b81548152906001019060200180831161153e57829003601f168201915b505050918352505060038201805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529382019392918301828280156115ef5780601f106115c4576101008083540402835291602001916115ef565b820191906000526020600020905b8154815290600101906020018083116115d257829003601f168201915b5050509183525050600482015460ff1660208083019190915260058301546040808401919091526006909301546060928301528351908401519284015191840151608085015160a086015160c0870151939e50949c50929a509850909650909450925090505b50919395979092949650565b600054600160a060020a031681565b6000805433600160a060020a0390811691161461168c57610000565b600160a060020a0380841660009081526001602052604090205484911615610d4957600160a060020a03841660008181526001602081815260409283902083519485526060918501828152600382018054600295811615610100026000190116949094049286018390529096507f6b45310c970f5d74814e429bdacd69c748dcb086cd38b6ddb7c2029be609e16894899489939192919083019060808401908690801561177a5780601f1061174f5761010080835404028352916020019161177a565b820191906000526020600020905b81548152906001019060200180831161175d57829003601f168201915b5050838103825284518152845160209182019186019080838382156117ba575b8051825260208311156117ba57601f19909201916020918201910161179a565b505050905090810190601f1680156117e65780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a182826003019080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061184457805160ff1916838001178555611871565b82800160010185558215611871579182015b82811115611871578251825591602001919060010190611856565b5b506118929291505b80821115610f085760008155600101610ef4565b5090565b50505b5b5b505b505050565b60005433600160a060020a039081169116146118b957610000565b600160a060020a038088166000908152600160205260409020548891161515611eb1576040805160e081018252600160a060020a03808b1680835260208084018c81528486018c9052606085018b905260ff8a16608086015260a0850189905260c0850188905260009283526001808352958320855181549516600160a060020a0319909516949094178455518051848701805481865294849020969795969095601f600291871615610100026000190190961604850184900481019491939092019083901061199457805160ff19168380011785556119c1565b828001600101855582156119c1579182015b828111156119c15782518255916020019190600101906119a6565b5b506119e29291505b80821115610f085760008155600101610ef4565b5090565b50506040820151816002019080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611a3657805160ff1916838001178555611a63565b82800160010185558215611a63579182015b82811115611a63578251825591602001919060010190611a48565b5b50611a849291505b80821115610f085760008155600101610ef4565b5090565b50506060820151816003019080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611ad857805160ff1916838001178555611b05565b82800160010185558215611b05579182015b82811115611b05578251825591602001919060010190611aea565b5b50611b269291505b80821115610f085760008155600101610ef4565b5090565b505060808201516004828101805460ff191660ff9093169290921790915560a0830151600583015560c0909201516006909101558054600181018083558281838015829011611b9a57600083815260209020611b9a9181019083015b80821115610f085760008155600101610ef4565b5090565b5b505050916000526020600020900160005b8a909190916101000a815481600160a060020a030219169083600160a060020a0316021790555050876002876040518082805190602001908083835b60208310611c075780518252601f199092019160209182019101611be8565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184208054600160a060020a031916600160a060020a039690961695909517909455505088518a926003928b9290918291908401908083835b60208310611c875780518252601f199092019160209182019101611c68565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060006101000a815481600160a060020a030219169083600160a060020a031602179055507f469f18a43061267ac6162ca1cec0c14a425189c7a19f52d6dc04419f3c12bb24888888888888886040518088600160a060020a0316600160a060020a031681526020018060200180602001806020018760ff1660ff1681526020018660001916600019168152602001856000191660001916815260200184810384528a818151815260200191508051906020019080838360008314611d99575b805182526020831115611d9957601f199092019160209182019101611d79565b505050905090810190601f168015611dc55780820380516001836020036101000a031916815260200191505b5084810383528951815289516020918201918b01908083838215611e04575b805182526020831115611e0457601f199092019160209182019101611de4565b505050905090810190601f168015611e305780820380516001836020036101000a031916815260200191505b5084810382528851815288516020918201918a01908083838215611e6f575b805182526020831115611e6f57601f199092019160209182019101611e4f565b505050905090810190601f168015611e9b5780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390a15b5b5b505b50505050505050565b6000805433600160a060020a03908116911614611eda57610000565b600160a060020a0380841660009081526001602052604090205484911615610d4957600160a060020a038416600081815260016020818152604092839020835194855260609185018281528184018054600295811615610100026000190116949094049286018390529096507f4a6dbfc867b179991dec22ff19960f0a94d8d9d891fc556f547764670340e8ae948994899391929190830190608084019086908015611fc75780601f10611f9c57610100808354040283529160200191611fc7565b820191906000526020600020905b815481529060010190602001808311611faa57829003601f168201915b505083810382528451815284516020918201918601908083838215612007575b80518252602083111561200757601f199092019160209182019101611fe7565b505050905090810190601f1680156120335780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a160038260010160405180828054600181600116156101000203166002900480156120a45780601f106120825761010080835404028352918201916120a4565b820191906000526020600020905b815481529060010190602001808311612090575b5050928352505060405190819003602090810182208054600160a060020a031916905584518692600392879282918401908083835b602083106120f85780518252601f1990920191602091820191016120d9565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060006101000a815481600160a060020a030219169083600160a060020a0316021790555082826001019080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061184457805160ff1916838001178555611871565b82800160010185558215611871579182015b82811115611871578251825591602001919060010190611856565b5b506118929291505b80821115610f085760008155600101610ef4565b5090565b50505b5b5b505b505050565b60016020819052600091825260409091208054600482015460058301546006840154600160a060020a0390931694840193600281019360039091019260ff16919087565b600481815481101561000057906000526020600020900160005b915054906101000a9004600160a060020a031681565b600060206040519081016040528060008152506020604051908101604052806000815250602060405190810160405280600081525060006000600060006003896040518082805190602001908083835b602083106122da5780518252601f1990920191602091820191016122bb565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054600160a060020a0316925061231e915082905061139e565b97509750975097509750975097505b50919395979092949650565b6000805433600160a060020a0390811691161461235557610000565b600160a060020a0380841660009081526001602052604090205484911615610d4957600160a060020a038416600081815260016020908152604091829020600681015483519485529184019190915282820186905290519093507fa9fd216856477e73d11c1a9140fa3d425fce2e10a5475a996440b31c2e8f1ea49181900360600190a1600682018390555b5b5b505b505050565b60408051602081810183526000825260048054845181840281018401909552808552929392909183018282801561244a57602002820191906000526020600020905b8154600160a060020a0316815260019091019060200180831161242c575b505050505090505b90565b600060206040519081016040528060008152506020604051908101604052806000815250602060405190810160405280600081525060006000600060006002896040518082805190602001908083835b602083106122da5780518252601f1990920191602091820191016122bb565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054600160a060020a0316925061231e915082905061139e565b97509750975097509750975097505b50919395979092949650565b6000805433600160a060020a0390811691161461253f57610000565b600160a060020a0380841660009081526001602052604090205484911615610d4957600160a060020a0384166000818152600160208181526040928390208351948552606091850182815260028083018054958616156101000260001901909516049286018390529096507f53d878a6530e56c9bc96548fa0a8cae4f1d1f49c86b0e934c086b992ebb6998f94899489939192919083019060808401908690801561262b5780601f106126005761010080835404028352916020019161262b565b820191906000526020600020905b81548152906001019060200180831161260e57829003601f168201915b50508381038252845181528451602091820191860190808383821561266b575b80518252602083111561266b57601f19909201916020918201910161264b565b505050905090810190601f1680156126975780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a160028260020160405180828054600181600116156101000203166002900480156127085780601f106126e6576101008083540402835291820191612708565b820191906000526020600020905b8154815290600101906020018083116126f4575b5050928352505060405190819003602090810182208054600160a060020a031916905584518692600292879282918401908083835b6020831061275c5780518252601f19909201916020918201910161273d565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060006101000a815481600160a060020a030219169083600160a060020a0316021790555082826002019080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061184457805160ff1916838001178555611871565b82800160010185558215611871579182015b82811115611871578251825591602001919060010190611856565b5b506118929291505b80821115610f085760008155600101610ef4565b5090565b50505b5b5b505b505050565b60005433600160a060020a0390811691161461287657610000565b600160a060020a038116156128a15760008054600160a060020a031916600160a060020a0383161790555b5b5b505600a165627a7a72305820ab391667fa2dd2ca38e4cb647adeb6c84564055a1511891be49c5f0ab676e98e0029", + "unlinked_binary": "0x60606040525b60008054600160a060020a03191633600160a060020a03161790555b5b612635806100316000396000f300606060405236156100d55763ffffffff60e060020a6000350416632fbfeba981146100d757806334ed557f146101495780633550b6d91461016a5780635fa7b584146101dc5780637abccac9146101fa5780638da5cb5b146103ab57806391914b30146103d75780639a84d0c414610439578063c370c86d14610525578063e486033914610587578063e5df8b841461074d578063e73fc0c31461077c578063eaabd05e14610967578063ee8c24b814610988578063efa74f1f146109f3578063f036417f14610bde578063f2fde38b14610c40575bfe5b34156100df57fe5b61012d600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843750949650610c5e95505050505050565b60408051600160a060020a039092168252519081900360200190f35b341561015157fe5b610168600160a060020a0360043516602435610cd1565b005b341561017257fe5b61012d600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843750949650610d8395505050505050565b60408051600160a060020a039092168252519081900360200190f35b34156101e457fe5b610168600160a060020a0360043516610df6565b005b341561020257fe5b610216600160a060020a03600435166112b3565b60408051600160a060020a038916815260ff8516608082015260a0810184905260c0810183905260e060208083018281528a5192840192909252895192939192918401916060850191610100860191908c01908083838215610293575b80518252602083111561029357601f199092019160209182019101610273565b505050905090810190601f1680156102bf5780820380516001836020036101000a031916815260200191505b5084810383528951815289516020918201918b019080838382156102fe575b8051825260208311156102fe57601f1990920191602091820191016102de565b505050905090810190601f16801561032a5780820380516001836020036101000a031916815260200191505b5084810382528851815288516020918201918a01908083838215610369575b80518252602083111561036957601f199092019160209182019101610349565b505050905090810190601f1680156103955780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b34156103b357fe5b61012d611529565b60408051600160a060020a039092168252519081900360200190f35b34156103df57fe5b60408051602060046024803582810135601f8101859004850286018501909652858552610168958335600160a060020a0316959394604494939290920191819084018382808284375094965061153895505050505050565b005b341561044157fe5b60408051602060046024803582810135601f8101859004850286018501909652858552610168958335600160a060020a0316959394604494939290920191819084018382808284375050604080516020601f89358b0180359182018390048302840183019094528083529799988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979998810197919650918201945092508291508401838280828437509496505060ff85351694602081013594506040013592506116df915050565b005b341561052d57fe5b60408051602060046024803582810135601f8101859004850286018501909652858552610168958335600160a060020a03169593946044949392909201918190840183828082843750949650611b3a95505050505050565b005b341561058f57fe5b6105a3600160a060020a0360043516611de0565b60408051600160a060020a038916815260ff8516608082015260a0810184905260c0810183905260e06020820181815289546002610100600183161581026000190190921604928401839052929390929084019160608501918501908b90801561064e5780601f106106235761010080835404028352916020019161064e565b820191906000526020600020905b81548152906001019060200180831161063157829003601f168201915b505084810383528954600260001961010060018416150201909116048082526020909101908a9080156106c25780601f10610697576101008083540402835291602001916106c2565b820191906000526020600020905b8154815290600101906020018083116106a557829003601f168201915b50508481038252885460026000196101006001841615020190911604808252602090910190899080156107365780601f1061070b57610100808354040283529160200191610736565b820191906000526020600020905b81548152906001019060200180831161071957829003601f168201915b50509a505050505050505050505060405180910390f35b341561075557fe5b61012d600435611e24565b60408051600160a060020a039092168252519081900360200190f35b341561078457fe5b610216600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843750949650611e5695505050505050565b60408051600160a060020a038916815260ff8516608082015260a0810184905260c0810183905260e060208083018281528a5192840192909252895192939192918401916060850191610100860191908c01908083838215610293575b80518252602083111561029357601f199092019160209182019101610273565b505050905090810190601f1680156102bf5780820380516001836020036101000a031916815260200191505b5084810383528951815289516020918201918b019080838382156102fe575b8051825260208311156102fe57601f1990920191602091820191016102de565b505050905090810190601f16801561032a5780820380516001836020036101000a031916815260200191505b5084810382528851815288516020918201918a01908083838215610369575b80518252602083111561036957601f199092019160209182019101610349565b505050905090810190601f1680156103955780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b341561096f57fe5b610168600160a060020a0360043516602435611f09565b005b341561099057fe5b610998611fbb565b60408051602080825283518183015283519192839290830191858101910280838382156109e0575b8051825260208311156109e057601f1990920191602091820191016109c0565b5050509050019250505060405180910390f35b34156109fb57fe5b610216600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375094965061202495505050505050565b60408051600160a060020a038916815260ff8516608082015260a0810184905260c0810183905260e060208083018281528a5192840192909252895192939192918401916060850191610100860191908c01908083838215610293575b80518252602083111561029357601f199092019160209182019101610273565b505050905090810190601f1680156102bf5780820380516001836020036101000a031916815260200191505b5084810383528951815289516020918201918b019080838382156102fe575b8051825260208311156102fe57601f1990920191602091820191016102de565b505050905090810190601f16801561032a5780820380516001836020036101000a031916815260200191505b5084810382528851815288516020918201918a01908083838215610369575b80518252602083111561036957601f199092019160209182019101610349565b505050905090810190601f1680156103955780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b3415610be657fe5b60408051602060046024803582810135601f8101859004850286018501909652858552610168958335600160a060020a031695939460449493929092019181908401838280828437509496506120d795505050505050565b005b3415610c4857fe5b610168600160a060020a036004351661237c565b005b60006003826040518082805190602001908083835b60208310610c925780518252601f199092019160209182019101610c73565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054600160a060020a0316925050505b919050565b6000805433600160a060020a03908116911614610cee5760006000fd5b600160a060020a0380841660009081526001602052604090205484911615610d7a57600160a060020a038416600081815260016020908152604091829020600581015483519485529184019190915282820186905290519093507fe46a8f26cfc48c12e40cf50c1063e5913b2a17da6aa396f9b008b2dfd6f273b59181900360600190a1600582018390555b5b5b505b505050565b60006002826040518082805190602001908083835b60208310610c925780518252601f199092019160209182019101610c73565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054600160a060020a0316925050505b919050565b60008054819033600160a060020a03908116911614610e155760006000fd5b600160a060020a0380841660009081526001602052604090205484911615610d7a57600092505b600454831015610f295783600160a060020a0316600484815481101515610e5f57fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a03161415610f1d57600480546000198101908110610ea057fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600484815481101515610ecf57fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a031602179055506001600481818054905003915081610f1791906123c8565b50610f29565b5b600190920191610e3c565b600160a060020a03808516600090815260016020818152604092839020805460048201546005830154600684015487519390981680845260ff9092166080840181905260a0840182905260c0840189905260e09584018681528588018054600299811615610100908102600019019091168a9004988701899052969c507fc9ec69d3b744b4ec70f035ed0a15ed7029e668bfb9f326e657878b2b38a90da29a949990988d019760038e0197939694959493918401916060850191908501908b9080156110365780601f1061100b57610100808354040283529160200191611036565b820191906000526020600020905b81548152906001019060200180831161101957829003601f168201915b505084810383528954600260001961010060018416150201909116048082526020909101908a9080156110aa5780601f1061107f576101008083540402835291602001916110aa565b820191906000526020600020905b81548152906001019060200180831161108d57829003601f168201915b505084810382528854600260001961010060018416150201909116048082526020909101908990801561111e5780601f106110f35761010080835404028352916020019161111e565b820191906000526020600020905b81548152906001019060200180831161110157829003601f168201915b50509a505050505050505050505060405180910390a160028260020160405180828054600181600116156101000203166002900480156111955780601f10611173576101008083540402835291820191611195565b820191906000526020600020905b815481529060010190602001808311611181575b5050915050908152602001604051809103902060006101000a815490600160a060020a030219169055600382600101604051808280546001816001161561010002031660029004801561121f5780601f106111fd57610100808354040283529182019161121f565b820191906000526020600020905b81548152906001019060200180831161120b575b5050928352505060408051602092819003830190208054600160a060020a0319908116909155600160a060020a03871660009081526001938490529182208054909116815591611271908301826123f2565b61127f6002830160006123f2565b61128d6003830160006123f2565b5060048101805460ff191690556000600582018190556006909101555b5b5b505b505050565b60006112bd61243a565b6112c561243a565b6112cd61243a565b6000600060006112db61244c565b600160a060020a03898116600090815260016020818152604092839020835160e0810185528154909516855280830180548551600261010096831615969096026000190190911694909404601f8101849004840285018401909552848452909385830193928301828280156113915780601f1061136657610100808354040283529160200191611391565b820191906000526020600020905b81548152906001019060200180831161137457829003601f168201915b5050509183525050600282810180546040805160206001841615610100026000190190931694909404601f810183900483028501830190915280845293810193908301828280156114235780601f106113f857610100808354040283529160200191611423565b820191906000526020600020905b81548152906001019060200180831161140657829003601f168201915b505050918352505060038201805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529382019392918301828280156114b75780601f1061148c576101008083540402835291602001916114b7565b820191906000526020600020905b81548152906001019060200180831161149a57829003601f168201915b5050509183525050600482015460ff1660208083019190915260058301546040808401919091526006909301546060928301528351908401519284015191840151608085015160a086015160c0870151939e50949c50929a509850909650909450925090505b50919395979092949650565b600054600160a060020a031681565b6000805433600160a060020a039081169116146115555760006000fd5b600160a060020a0380841660009081526001602052604090205484911615610d7a57600160a060020a03841660008181526001602081815260409283902083519485526060918501828152600382018054600295811615610100026000190116949094049286018390529096507f6b45310c970f5d74814e429bdacd69c748dcb086cd38b6ddb7c2029be609e1689489948993919291908301906080840190869080156116435780601f1061161857610100808354040283529160200191611643565b820191906000526020600020905b81548152906001019060200180831161162657829003601f168201915b505083810382528451815284516020918201918601908083838215611683575b80518252602083111561168357601f199092019160209182019101611663565b505050905090810190601f1680156116af5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a182516116d4906003840190602086019061249c565b505b5b5b505b505050565b60005433600160a060020a039081169116146116fb5760006000fd5b600160a060020a038088166000908152600160205260409020548891161515611b2d576040805160e081018252600160a060020a038a811680835260208084018c81528486018c9052606085018b905260ff8a16608086015260a0850189905260c08501889052600092835260018083529590922084518154600160a060020a0319169416939093178355905180519394929361179f93850192919091019061249c565b50604082015180516117bb91600284019160209091019061249c565b50606082015180516117d791600384019160209091019061249c565b5060808201516004828101805460ff191660ff9093169290921790915560a0830151600583015560c09092015160069091015580546001810161181a83826123c8565b916000526020600020900160005b8a909190916101000a815481600160a060020a030219169083600160a060020a0316021790555050876002876040518082805190602001908083835b602083106118835780518252601f199092019160209182019101611864565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184208054600160a060020a031916600160a060020a039690961695909517909455505088518a926003928b9290918291908401908083835b602083106119035780518252601f1990920191602091820191016118e4565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060006101000a815481600160a060020a030219169083600160a060020a031602179055507f469f18a43061267ac6162ca1cec0c14a425189c7a19f52d6dc04419f3c12bb24888888888888886040518088600160a060020a0316600160a060020a031681526020018060200180602001806020018760ff1660ff1681526020018660001916600019168152602001856000191660001916815260200184810384528a818151815260200191508051906020019080838360008314611a15575b805182526020831115611a1557601f1990920191602091820191016119f5565b505050905090810190601f168015611a415780820380516001836020036101000a031916815260200191505b5084810383528951815289516020918201918b01908083838215611a80575b805182526020831115611a8057601f199092019160209182019101611a60565b505050905090810190601f168015611aac5780820380516001836020036101000a031916815260200191505b5084810382528851815288516020918201918a01908083838215611aeb575b805182526020831115611aeb57601f199092019160209182019101611acb565b505050905090810190601f168015611b175780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390a15b5b5b505b50505050505050565b6000805433600160a060020a03908116911614611b575760006000fd5b600160a060020a0380841660009081526001602052604090205484911615610d7a57600160a060020a038416600081815260016020818152604092839020835194855260609185018281528184018054600295811615610100026000190116949094049286018390529096507f4a6dbfc867b179991dec22ff19960f0a94d8d9d891fc556f547764670340e8ae948994899391929190830190608084019086908015611c445780601f10611c1957610100808354040283529160200191611c44565b820191906000526020600020905b815481529060010190602001808311611c2757829003601f168201915b505083810382528451815284516020918201918601908083838215611c84575b805182526020831115611c8457601f199092019160209182019101611c64565b505050905090810190601f168015611cb05780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a16003826001016040518082805460018160011615610100020316600290048015611d215780601f10611cff576101008083540402835291820191611d21565b820191906000526020600020905b815481529060010190602001808311611d0d575b5050928352505060405190819003602090810182208054600160a060020a031916905584518692600392879282918401908083835b60208310611d755780518252601f199092019160209182019101611d56565b51815160209384036101000a60001901801990921691161790529201948552506040519384900381019093208054600160a060020a031916600160a060020a0395909516949094179093555084516116d49250600185019186019061249c565b505b5b5b505b505050565b60016020819052600091825260409091208054600482015460058301546006840154600160a060020a0390931694840193600281019360039091019260ff16919087565b6004805482908110611e3257fe5b906000526020600020900160005b915054906101000a9004600160a060020a031681565b6000611e6061243a565b611e6861243a565b611e7061243a565b60006000600060006003896040518082805190602001908083835b60208310611eaa5780518252601f199092019160209182019101611e8b565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054600160a060020a03169250611eee91508290506112b3565b97509750975097509750975097505b50919395979092949650565b6000805433600160a060020a03908116911614611f265760006000fd5b600160a060020a0380841660009081526001602052604090205484911615610d7a57600160a060020a038416600081815260016020908152604091829020600681015483519485529184019190915282820186905290519093507fa9fd216856477e73d11c1a9140fa3d425fce2e10a5475a996440b31c2e8f1ea49181900360600190a1600682018390555b5b5b505b505050565b611fc361243a565b600480548060200260200160405190810160405280929190818152602001828054801561201957602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311611ffb575b505050505090505b90565b600061202e61243a565b61203661243a565b61203e61243a565b60006000600060006002896040518082805190602001908083835b60208310611eaa5780518252601f199092019160209182019101611e8b565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054600160a060020a03169250611eee91508290506112b3565b97509750975097509750975097505b50919395979092949650565b6000805433600160a060020a039081169116146120f45760006000fd5b600160a060020a0380841660009081526001602052604090205484911615610d7a57600160a060020a0384166000818152600160208181526040928390208351948552606091850182815260028083018054958616156101000260001901909516049286018390529096507f53d878a6530e56c9bc96548fa0a8cae4f1d1f49c86b0e934c086b992ebb6998f9489948993919291908301906080840190869080156121e05780601f106121b5576101008083540402835291602001916121e0565b820191906000526020600020905b8154815290600101906020018083116121c357829003601f168201915b505083810382528451815284516020918201918601908083838215612220575b80518252602083111561222057601f199092019160209182019101612200565b505050905090810190601f16801561224c5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a160028260020160405180828054600181600116156101000203166002900480156122bd5780601f1061229b5761010080835404028352918201916122bd565b820191906000526020600020905b8154815290600101906020018083116122a9575b5050928352505060405190819003602090810182208054600160a060020a031916905584518692600292879282918401908083835b602083106123115780518252601f1990920191602091820191016122f2565b51815160209384036101000a60001901801990921691161790529201948552506040519384900381019093208054600160a060020a031916600160a060020a0395909516949094179093555084516116d49250600285019186019061249c565b505b5b5b505b505050565b60005433600160a060020a039081169116146123985760006000fd5b600160a060020a038116156123c35760008054600160a060020a031916600160a060020a0383161790555b5b5b50565b815481835581811511610d7e57600083815260209020610d7e9181019083016125d6565b5b505050565b50805460018160011615610100020316600290046000825580601f1061241857506123c3565b601f0160209004906000526020600020908101906123c391906125d6565b5b50565b60408051602081019091526000815290565b6040805160e08101909152600081526020810161246761243a565b815260200161247461243a565b815260200161248161243a565b81526000602082018190526040820181905260609091015290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106124dd57805160ff191683800117855561250a565b8280016001018555821561250a579182015b8281111561250a5782518255916020019190600101906124ef565b5b506125179291506125d6565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106124dd57805160ff191683800117855561250a565b8280016001018555821561250a579182015b8281111561250a5782518255916020019190600101906124ef565b5b506125179291506125d6565b5090565b815481835581811511610d7e57600083815260209020610d7e9181019083016125d6565b5b505050565b60408051602081019091526000815290565b61202191905b8082111561251757600081556001016125dc565b5090565b90565b604080516020810190915260008152905600a165627a7a72305820694ecc468cf651cee830ac5107745dac20b5be83e2585ca089db4ca333108d740029", "networks": { "42": { "links": {}, @@ -993,10 +993,10 @@ "type": "event" } }, - "updated_at": 1495030736781, + "updated_at": 1498588231341, "address": "0x0b1ba0af832d7c05fd64161e0db78e85978e8082" } }, "schema_version": "0.0.5", - "updated_at": 1496294576947 + "updated_at": 1498588231341 }
\ No newline at end of file diff --git a/src/artifacts/Exchange.json b/src/artifacts/exchange/Exchange_v1.json index bcb8aece0..4b7321970 100644 --- a/src/artifacts/Exchange.json +++ b/src/artifacts/exchange/Exchange_v1.json @@ -606,7 +606,7 @@ "type": "event" } ], - "unlinked_binary": "0x60606040523461000057604051604080611c698339810160405280516020909101515b60008054600160a060020a03808516600160a060020a03199283161790925560018054928416929091169190911790555b50505b611c04806100656000396000f300606060405236156100d55763ffffffff60e060020a60003504166308eb4e9881146100da57806314df96ee1461014a578063288cdc91146101745780632ac1262214610196578063441b1b44146101b857806350ec2a6a146101e057806359b257201461032a5780637ae2b5c7146104e95780638163681e1461050e578063909f617e1461054a578063914ff398146105d4578063a2e855a5146107ce578063a8c92d48146109c0578063aae62507146109e9578063cfc4d0ec14610a0b578063d40fa8bf14610a79578063ddefdb9014610aa2575b610000565b34610000576040805160a08181019092526101389160049160a4918390600590839083908082843750506040805160c08181019092529496958181019594509250600691508390839080828437509395505092359250610b27915050565b60408051918252519081900360200190f35b3461000057610160600435602435604435610e1c565b604080519115158252519081900360200190f35b3461000057610138600435610e3b565b60408051918252519081900360200190f35b3461000057610138600435610e4d565b60408051918252519081900360200190f35b3461000057610138600435602435604435610e5f565b60408051918252519081900360200190f35b346100005761016060048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610257576040805160a0818101909252908084028701906005908390839080828437505050918352505060019091019060200161021b565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156102ca576040805160c0818101909252908084028701906006908390839080828437505050918352505060019091019060200161028e565b50505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750949650610e7e95505050505050565b604080519115158252519081900360200190f35b346100005761013860048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156103a1576040805160a08181019092529080840287019060059083908390808284375050509183525050600190910190602001610365565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610414576040805160c081810190925290808402870190600690839083908082843750505091835250506001909101906020016103d8565b5050604080516020878301358901803582810280850184019095528084529799893599838101351515999198506060019650929450810192829185019084908082843750506040805187358901803560208181028481018201909552818452989a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989a998901989297509082019550935083925085019084908082843750949650610ee995505050505050565b60408051918252519081900360200190f35b3461000057610138600435602435610ff2565b60408051918252519081900360200190f35b3461000057610160600160a060020a036004351660243560ff6044351660643560843561100c565b604080519115158252519081900360200190f35b34610000576040805160a08181019092526101389160049160a4918390600590839083908082843750506040805160c08181019092529496958181019594509250600691508390839080828437509395505083359360208101351515935060ff604082013516925060608101359150608001356110c1565b60408051918252519081900360200190f35b346100005761016060048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561064b576040805160a0818101909252908084028701906005908390839080828437505050918352505060019091019060200161060f565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156106be576040805160c08181019092529080840287019060069083908390808284375050509183525050600190910190602001610682565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375050604080516020808901358a01803580830284810184018652818552999b8b3515159b909a950198509296508101945090925082919085019084908082843750506040805187358901803560208181028481018201909552818452989a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989a99890198929750908201955093508392508501908490808284375094965061156295505050505050565b604080519115158252519081900360200190f35b346100005761016060048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610845576040805160a08181019092529080840287019060059083908390808284375050509183525050600190910190602001610809565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156108b8576040805160c0818101909252908084028701906006908390839080828437505050918352505060019091019060200161087c565b50505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750506040805187358901803560208181028481018201909552818452989a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989a99890198929750908201955093508392508501908490808284375094965061161195505050505050565b604080519115158252519081900360200190f35b34610000576109cd6116c5565b60408051600160a060020a039092168252519081900360200190f35b34610000576101386004356116d4565b60408051918252519081900360200190f35b34610000576040805160a08181019092526101389160049160a4918390600590839083908082843750506040805160c0818101909252949695818101959450925060069150839083908082843750939550611700945050505050565b60408051918252519081900360200190f35b34610000576109cd6117ba565b60408051600160a060020a039092168252519081900360200190f35b34610000576040805160a08181019092526101609160049160a4918390600590839083908082843750506040805160c08181019092529496958181019594509250600691508390839080828437509395505083359360ff6020820135169350604081013592506060013590506117c9565b604080519115158252519081900360200190f35b604080516101608181018352600080835260208301819052828401819052606083018190526080830181905260a0830181905260c0830181905260e083018190526101008301819052610120830181905261014083018190528351918201909352829080878360209081029190910151600160a060020a031682520187600160209081029190910151600160a060020a031682520187600260209081029190910151600160a060020a031682520187600360209081029190910151600160a060020a031682520187600460209081029190910151600160a060020a03168252018660006020908102919091015182520186600160209081029190910151825201866002602090810291909101518252018660036020908102919091015182520186600460200201518152602001610c5e8888611700565b600019168152509150610c8833600160a060020a03168360000151600160a060020a0316146117f3565b6101208201514210610cbd57610140820151604051600490600080516020611bb983398151915290600090a360009250610e13565b610cd88260c00151610cd38461014001516116d4565b611803565b9050610ce48482610ff2565b9250821515610d1657610140820151604051600590600080516020611bb983398151915290600090a360009250610e13565b610140820151600090815260036020526040902054610d35908461181c565b610140830151600090815260036020526040908190209190915580830180516060850180518451606060020a600160a060020a03948516810282529184169091026014820152935193849003602801909320608086015186519351945160c088015160a0890151939692851695909416937f67d66f160bc93d925d05dae1794c90d2d6d6688b29b84ff069398a9b0458713193610dd491908b90610e5f565b61014089015160408051600160a060020a03958616815293909416602084015282840191909152606082018a9052608082015290519081900360a00190a45b50509392505050565b60006103e882108015610e3157508383830915155b90505b9392505050565b60026020526000908152604090205481565b60036020526000908152604090205481565b6000610e31610e6e8484611844565b85611870565b90505b9392505050565b6000805b8451811015610edc57610ed2858281518110156100005790602001906020020151858381518110156100005790602001906020020151858481518110156100005790602001906020020151610b27565b505b600101610e82565b600191505b509392505050565b6000805b8851811015610fe557610f488960008151811015610000576020908102909101015160036020020151600160a060020a03168a83815181101561000057602090810291909101015160600151600160a060020a0316146117f3565b610fcd82610fc88b84815181101561000057906020019060200201518b8581518110156100005790602001906020020151610f838c88611803565b8b8b88815181101561000057906020019060200201518b89815181101561000057906020019060200201518b8a815181101561000057906020019060200201516110c1565b61181c565b915086821415610fdc57610fe5565b5b600101610eed565b5b50979650505050505050565b600081831015611003575081611006565b50805b92915050565b604080517f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c8101869052815190819003603c018120600082815260208381018552928401819052835191825260ff8716828401528184018690526060820185905292516001926080808401939192601f198101928190039091019086866161da5a03f11561000057505060206040510351600160a060020a031686600160a060020a03161490505b95945050505050565b604080516101608181018352600080835260208301819052828401819052606083018190526080830181905260a0830181905260c0830181905260e0830181905261010083018190526101208301819052610140830181905283519182019093528290819081908190808e8360209081029190910151600160a060020a03168252018e600160209081029190910151600160a060020a03168252018e600260209081029190910151600160a060020a03168252018e600360209081029190910151600160a060020a03168252018e600460209081029190910151600160a060020a03168252018d6000602090810291909101518252018d6001602090810291909101518252018d6002602090810291909101518252018d6003602090810291909101518252018d6004602002015181526020016111fe8f8f611700565b9052602081015190955061123b90600160a060020a03161580611236575033600160a060020a03168660200151600160a060020a0316145b6117f3565b610120850151421061126f57610140850151604051600090600080516020611bb9833981519152908290a360009550611552565b61128a8560c00151610cd38761014001516116d4565b611803565b93506112968b85610ff2565b95508515156112c857610140850151604051600190600080516020611bb983398151915290600090a360009550611552565b6112db8560c00151878760a00151610e1c565b1561130957610140850151604051600290600080516020611bb983398151915290600090a360009550611552565b89801561131d575061131b85876118ad565b155b1561134b57610140850151604051600390600080516020611bb983398151915290600090a360009550611552565b61136961123686600001518761014001518c8c8c61100c565b6117f3565b61137c8560c00151878760a00151610e5f565b61014086015160009081526002602052604090205490935061139e908761181c565b610140860151600090815260026020526040908190209190915585015185516113d191611236913387611a16565b6117f3565b6113ed61123686606001513388600001518a611a16565b6117f3565b6080850151600160a060020a0316156114985760008560e00151111561144b576114208560c00151878760e00151610e5f565b6000548651608088015192945061144b9261123692600160a060020a0316919086611a16565b6117f3565b5b600085610100015111156114985761146e8560c0015187876101000151610e5f565b60005460808701519192506114989161123691600160a060020a031690339085611a16565b6117f3565b5b5b60408086018051606080890180518551606060020a600160a060020a0395861681028252918516909102601482015285519081900360280181206080808d01518d51975194516101408f0151338916865295881660208601528716848a01529483018b905282018d905260a0820189905260c0820188905260e08201929092529451909491831693909216917f0d0b9391970d9a25552f37d436d2aae2925e2bfe1b2a923754bada030c498cb3918190036101000190a45b5050505050979650505050505050565b6000805b8851811015611600576115f6898281518110156100005790602001906020020151898381518110156100005790602001906020020151898481518110156100005790602001906020020151898986815181101561000057906020019060200201518987815181101561000057906020019060200201518988815181101561000057906020019060200201516110c1565b505b600101611566565b600191505b50979650505050505050565b6000805b87518110156116b5576116ac6112368983815181101561000057906020019060200201518984815181101561000057906020019060200201518985815181101561000057906020019060200201518986815181101561000057906020019060200201518987815181101561000057906020019060200201518988815181101561000057906020019060200201516117c9565b6117f3565b5b600101611615565b600191505b509695505050505050565b600154600160a060020a031681565b60008181526002602090815260408083205460039092528220546116f8919061181c565b90505b919050565b81516020808401516040808601516060808801516080808a01518951978a01518a870151948b0151928b015160a08c01518851606060020a30600160a060020a03908116820283529d8e16810260148301529a8d168b026028820152978c168a02603c890152948b16890260508801529990911690960260648501526078840196909652609883019490945260b882015260d881019390935260f88301939093526101188201529051908190036101380190205b92915050565b600054600160a060020a031681565b60006117e5856117df89898960008a8a8a6110c1565b146117f3565b5060015b9695505050505050565b8015156117ff57610000565b5b50565b6000611811838311156117f3565b508082035b92915050565b60008282016118398482108015906112365750838210155b6117f3565b8091505b5092915050565b6000828202611839841580611236575083858381156100005704145b6117f3565b8091505b5092915050565b60006000611880600084116117f3565b82848115610000570490506118398385811561000057068285020185146117f3565b8091505b5092915050565b600060006000600060003393506118cd8760c00151878960a00151610e5f565b9250826118e288604001518960000151611ab4565b10806118fe5750826118fc88604001518960000151611b2d565b105b80611915575085611913886060015186611ab4565b105b8061192c57508561192a886060015186611b2d565b105b1561193a5760009450611a0c565b6080870151600160a060020a031615611a06576119608760c00151878960e00151610e5f565b91506119768760c0015187896101000151610e5f565b6000548851919250839161199391600160a060020a031690611ab4565b10806119b85750600054875183916119b691600160a060020a0390911690611b2d565b105b806119d8575060005481906119d690600160a060020a031686611ab4565b105b806119f8575060005481906119f690600160a060020a031686611b2d565b105b15611a065760009450611a0c565b5b600194505b5050505092915050565b600154604080516000602091820181905282517f15dacbea000000000000000000000000000000000000000000000000000000008152600160a060020a03898116600483015288811660248301528781166044830152606482018790529351919493909316926315dacbea92608480830193919282900301818787803b156100005760325a03f115610000575050604051519150505b949350505050565b600082600160a060020a03166370a08231836000604051602001526040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b156100005760325a03f115610000575050604051519150505b92915050565b600154604080516000602091820181905282517fdd62ed3e000000000000000000000000000000000000000000000000000000008152600160a060020a03868116600483015294851660248201529251909386169263dd62ed3e92604480830193919282900301818787803b156100005760325a03f115610000575050604051519150505b92915050560036d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e90a165627a7a72305820ef988e6a5f6297c52b9000648cdfb5dff80dddb6b40a41db8881b106f06edeb20029", + "unlinked_binary": "0x6060604052341561000c57fe5b604051604080611cf88339810160405280516020909101515b60008054600160a060020a03808516600160a060020a03199283161790925560018054928416929091169190911790555b50505b611c90806100686000396000f300606060405236156100d55763ffffffff60e060020a60003504166308eb4e9881146100d757806314df96ee1461014a578063288cdc91146101775780632ac126221461019c578063441b1b44146101c157806350ec2a6a146101ec57806359b25720146103395780637ae2b5c7146104fb5780638163681e14610523578063909f617e14610562578063914ff398146105ef578063a2e855a5146107ec578063a8c92d48146109e1578063aae6250714610a0d578063cfc4d0ec14610a32578063d40fa8bf14610aa3578063ddefdb9014610acf575bfe5b34156100df57fe5b6040805160a08181019092526101389160049160a4918390600590839083908082843750506040805160c08181019092529496958181019594509250600691508390839080828437509395505092359250610b57915050565b60408051918252519081900360200190f35b341561015257fe5b610163600435602435604435610e0c565b604080519115158252519081900360200190f35b341561017f57fe5b610138600435610e2b565b60408051918252519081900360200190f35b34156101a457fe5b610138600435610e3d565b60408051918252519081900360200190f35b34156101c957fe5b610138600435602435604435610e4f565b60408051918252519081900360200190f35b34156101f457fe5b61016360048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610266576040805160a0818101909252908084028701906005908390839080828437505050918352505060019091019060200161022a565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156102d9576040805160c0818101909252908084028701906006908390839080828437505050918352505060019091019060200161029d565b50505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750949650610e6e95505050505050565b604080519115158252519081900360200190f35b341561034157fe5b61013860048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156103b3576040805160a08181019092529080840287019060059083908390808284375050509183525050600190910190602001610377565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610426576040805160c081810190925290808402870190600690839083908082843750505091835250506001909101906020016103ea565b5050604080516020878301358901803582810280850184019095528084529799893599838101351515999198506060019650929450810192829185019084908082843750506040805187358901803560208181028481018201909552818452989a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989a998901989297509082019550935083925085019084908082843750949650610ee295505050505050565b60408051918252519081900360200190f35b341561050357fe5b610138600435602435611004565b60408051918252519081900360200190f35b341561052b57fe5b610163600160a060020a036004351660243560ff6044351660643560843561101e565b604080519115158252519081900360200190f35b341561056a57fe5b6040805160a08181019092526101389160049160a4918390600590839083908082843750506040805160c08181019092529496958181019594509250600691508390839080828437509395505083359360208101351515935060ff604082013516925060608101359150608001356110d6565b60408051918252519081900360200190f35b34156105f757fe5b61016360048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610669576040805160a0818101909252908084028701906005908390839080828437505050918352505060019091019060200161062d565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156106dc576040805160c081810190925290808402870190600690839083908082843750505091835250506001909101906020016106a0565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375050604080516020808901358a01803580830284810184018652818552999b8b3515159b909a950198509296508101945090925082919085019084908082843750506040805187358901803560208181028481018201909552818452989a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989a99890198929750908201955093508392508501908490808284375094965061154295505050505050565b604080519115158252519081900360200190f35b34156107f457fe5b61016360048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610866576040805160a0818101909252908084028701906005908390839080828437505050918352505060019091019060200161082a565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156108d9576040805160c0818101909252908084028701906006908390839080828437505050918352505060019091019060200161089d565b50505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750506040805187358901803560208181028481018201909552818452989a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989a99890198929750908201955093508392508501908490808284375094965061160395505050505050565b604080519115158252519081900360200190f35b34156109e957fe5b6109f16116c9565b60408051600160a060020a039092168252519081900360200190f35b3415610a1557fe5b6101386004356116d8565b60408051918252519081900360200190f35b3415610a3a57fe5b6040805160a08181019092526101389160049160a4918390600590839083908082843750506040805160c0818101909252949695818101959450925060069150839083908082843750939550611704945050505050565b60408051918252519081900360200190f35b3415610aab57fe5b6109f16117f7565b60408051600160a060020a039092168252519081900360200190f35b3415610ad757fe5b6040805160a08181019092526101639160049160a4918390600590839083908082843750506040805160c08181019092529496958181019594509250600691508390839080828437509395505083359360ff602082013516935060408101359250606001359050611806565b604080519115158252519081900360200190f35b6000610b61611be8565b6040805161016081019091526000908087835b60209081029190910151600160a060020a03168252018760015b60209081029190910151600160a060020a03168252018760025b60209081029190910151600160a060020a03168252018760035b60209081029190910151600160a060020a03168252018760045b60209081029190910151600160a060020a03168252018660005b602090810291909101518252018660015b602090810291909101518252018660025b602090810291909101518252018660035b602090810291909101518252018660045b60200201518152602001610c4e8888611704565b600019168152509150610c7833600160a060020a03168360000151600160a060020a031614611830565b6101208201514210610cad57610140820151604051600490600080516020611c4583398151915290600090a360009250610e03565b610cc88260c00151610cc38461014001516116d8565b611841565b9050610cd48482611004565b9250821515610d0657610140820151604051600590600080516020611c4583398151915290600090a360009250610e03565b610140820151600090815260036020526040902054610d25908461185a565b610140830151600090815260036020526040908190209190915580830180516060850180518451606060020a600160a060020a03948516810282529184169091026014820152935193849003602801909320608086015186519351945160c088015160a0890151939692851695909416937f67d66f160bc93d925d05dae1794c90d2d6d6688b29b84ff069398a9b0458713193610dc491908b90610e4f565b61014089015160408051600160a060020a03958616815293909416602084015282840191909152606082018a9052608082015290519081900360a00190a45b50509392505050565b60006103e882108015610e2157508383830915155b90505b9392505050565b60026020526000908152604090205481565b60036020526000908152604090205481565b6000610e21610e5e8484611882565b856118b1565b90505b9392505050565b6000805b8451811015610ed557610ecb8582815181101515610e8c57fe5b906020019060200201518583815181101515610ea457fe5b906020019060200201518584815181101515610ebc57fe5b90602001906020020151610b57565b505b600101610e72565b600191505b509392505050565b6000805b8851811015610ff757610f4b896000815181101515610f0157fe5b6020908102909101015160035b6020020151600160a060020a03168a83815181101515610f2a57fe5b6020908102909101015160035b6020020151600160a060020a031614611830565b610fdf82610fda8b84815181101515610f6057fe5b906020019060200201518b85815181101515610f7857fe5b90602001906020020151610f8c8c88611841565b8b8b88815181101515610f9b57fe5b906020019060200201518b89815181101515610fb357fe5b906020019060200201518b8a815181101515610fcb57fe5b906020019060200201516110d6565b61185a565b915086821415610fee57610ff7565b5b600101610ee6565b5b50979650505050505050565b600081831015611015575081611018565b50805b92915050565b604080517f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c8101869052815190819003603c018120600082815260208381018552928401819052835191825260ff8716828401528184018690526060820185905292516001926080808401939192601f1981019281900390910190868661646e5a03f115156110ad57fe5b505060206040510351600160a060020a031686600160a060020a03161490505b95945050505050565b60006110e0611be8565b6000600060006000610160604051908101604052808e600060058110151561110457fe5b60209081029190910151600160a060020a03168252018e60015b60209081029190910151600160a060020a03168252018e60025b60209081029190910151600160a060020a03168252018e60035b60209081029190910151600160a060020a03168252018e60045b60209081029190910151600160a060020a03168252018d60005b602090810291909101518252018d60015b602090810291909101518252018d60025b602090810291909101518252018d60035b602090810291909101518252018d60045b602002015181526020016111de8f8f611704565b9052602081015190955061121b90600160a060020a03161580611216575033600160a060020a03168660200151600160a060020a0316145b611830565b610120850151421061124f57610140850151604051600090600080516020611c45833981519152908290a360009550611532565b61126a8560c00151610cc38761014001516116d8565b611841565b93506112768b85611004565b95508515156112a857610140850151604051600190600080516020611c4583398151915290600090a360009550611532565b6112bb8560c00151878760a00151610e0c565b156112e957610140850151604051600290600080516020611c4583398151915290600090a360009550611532565b8980156112fd57506112fb85876118f4565b155b1561132b57610140850151604051600390600080516020611c4583398151915290600090a360009550611532565b61134961121686600001518761014001518c8c8c61101e565b611830565b61135c8560c00151878760a00151610e4f565b61014086015160009081526002602052604090205490935061137e908761185a565b610140860151600090815260026020526040908190209190915585015185516113b191611216913387611a5d565b611830565b6113cd61121686606001513388600001518a611a5d565b611830565b6080850151600160a060020a0316156114785760008560e00151111561142b576114008560c00151878760e00151610e4f565b6000548651608088015192945061142b9261121692600160a060020a0316919086611a5d565b611830565b5b600085610100015111156114785761144e8560c0015187876101000151610e4f565b60005460808701519192506114789161121691600160a060020a031690339085611a5d565b611830565b5b5b60408086018051606080890180518551606060020a600160a060020a0395861681028252918516909102601482015285519081900360280181206080808d01518d51975194516101408f0151338916865295881660208601528716848a01529483018b905282018d905260a0820189905260c0820188905260e08201929092529451909491831693909216917f0d0b9391970d9a25552f37d436d2aae2925e2bfe1b2a923754bada030c498cb3918190036101000190a45b5050505050979650505050505050565b6000805b88518110156115f2576115e8898281518110151561156057fe5b90602001906020020151898381518110151561157857fe5b90602001906020020151898481518110151561159057fe5b906020019060200201518989868151811015156115a957fe5b9060200190602002015189878151811015156115c157fe5b906020019060200201518988815181101515610fcb57fe5b906020019060200201516110d6565b505b600101611546565b600191505b50979650505050505050565b6000805b87518110156116b9576116b0611216898381518110151561162457fe5b90602001906020020151898481518110151561163c57fe5b90602001906020020151898581518110151561165457fe5b90602001906020020151898681518110151561166c57fe5b90602001906020020151898781518110151561168457fe5b90602001906020020151898881518110151561169c57fe5b90602001906020020151611806565b611830565b5b600101611607565b600191505b509695505050505050565b600154600160a060020a031681565b60008181526002602090815260408083205460039092528220546116fc919061185a565b90505b919050565b60003083825b60200201518460015b60200201518560025b60200201518660035b60200201518760045b60200201518760005b60200201518860015b60200201518960025b60200201518a60035b60200201518b60045b60200201518c60055b602002015160408051606060020a600160a060020a039e8f16810282529c8e168d0260148201529a8d168c0260288c0152988c168b02603c8b0152968b168a0260508a01529490991690970260648701526078860191909152609885015260b884019490945260d883019490945260f8820192909252610118810192909252519081900361013801902090505b92915050565b600054600160a060020a031681565b60006118228561181c89898960008a8a8a6110d6565b14611830565b5060015b9695505050505050565b80151561183d5760006000fd5b5b50565b600061184f83831115611830565b508082035b92915050565b60008282016118778482108015906112165750838210155b611830565b8091505b5092915050565b6000828202611877841580611216575083858381151561189e57fe5b04145b611830565b8091505b5092915050565b600060006118c160008411611830565b82848115156118cc57fe5b04905061187783858115156118dd57fe5b06828502018514611830565b8091505b5092915050565b600060006000600060003393506119148760c00151878960a00151610e4f565b92508261192988604001518960000151611aec565b108061194557508261194388604001518960000151611b6c565b105b8061195c57508561195a886060015186611aec565b105b80611973575085611971886060015186611b6c565b105b156119815760009450611a53565b6080870151600160a060020a031615611a4d576119a78760c00151878960e00151610e4f565b91506119bd8760c0015187896101000151610e4f565b600054885191925083916119da91600160a060020a031690611aec565b10806119ff5750600054875183916119fd91600160a060020a0390911690611b6c565b105b80611a1f57506000548190611a1d90600160a060020a031686611aec565b105b80611a3f57506000548190611a3d90600160a060020a031686611b6c565b105b15611a4d5760009450611a53565b5b600194505b5050505092915050565b6001546040805160006020918201819052825160e160020a630aed65f5028152600160a060020a03898116600483015288811660248301528781166044830152606482018790529351919493909316926315dacbea92608480830193919282900301818787803b1515611acc57fe5b6102c65a03f11515611ada57fe5b5050604051519150505b949350505050565b600082600160a060020a03166370a08231836000604051602001526040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b1515611b4e57fe5b6102c65a03f11515611b5c57fe5b5050604051519150505b92915050565b6001546040805160006020918201819052825160e160020a636eb1769f028152600160a060020a03868116600483015294851660248201529251909386169263dd62ed3e92604480830193919282900301818787803b1515611b4e57fe5b6102c65a03f11515611b5c57fe5b5050604051519150505b92915050565b6040805161016081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081018290526101008101829052610120810182905261014081019190915290560036d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e90a165627a7a723058209d6310023b98fc6419d082309e5333a2b2cbe61eb7f333bcf05040a05358b4ef0029", "networks": { "42": { "links": {}, @@ -1048,12 +1048,121 @@ ], "name": "LogError", "type": "event" + }, + "0x0d0b9391970d9a25552f37d436d2aae2925e2bfe1b2a923754bada030c498cb3": { + "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": "filledValueM", + "type": "uint256" + }, + { + "indexed": false, + "name": "filledValueT", + "type": "uint256" + }, + { + "indexed": false, + "name": "feeMPaid", + "type": "uint256" + }, + { + "indexed": false, + "name": "feeTPaid", + "type": "uint256" + }, + { + "indexed": true, + "name": "tokens", + "type": "bytes32" + }, + { + "indexed": false, + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "LogFill", + "type": "event" + }, + "0x67d66f160bc93d925d05dae1794c90d2d6d6688b29b84ff069398a9b04587131": { + "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": "cancelledValueM", + "type": "uint256" + }, + { + "indexed": false, + "name": "cancelledValueT", + "type": "uint256" + }, + { + "indexed": true, + "name": "tokens", + "type": "bytes32" + }, + { + "indexed": false, + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "LogCancel", + "type": "event" } }, - "updated_at": 1495030736784, + "updated_at": 1498588231353, "address": "0xb69e673309512a9d726f87304c6984054f87a93b" } }, "schema_version": "0.0.5", - "updated_at": 1496294576952 + "updated_at": 1498588231353 }
\ No newline at end of file diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index 5d514e5ec..f596cb429 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -7,6 +7,7 @@ import { ExchangeContract, ExchangeContractErrCodes, ExchangeContractErrs, + ZeroExError, OrderValues, OrderAddresses, Order, @@ -25,11 +26,14 @@ import { LogErrorContractEventArgs, LogFillContractEventArgs, LogCancelContractEventArgs, + ExchangeContractByAddress, + ContractArtifact, } from '../types'; import {assert} from '../utils/assert'; import {utils} from '../utils/utils'; import {ContractWrapper} from './contract_wrapper'; -import * as ExchangeArtifacts from '../artifacts/Exchange.json'; +import {ProxyWrapper} from './proxy_wrapper'; +import {ExchangeArtifactsByName} from '../exchange_artifacts_by_name'; import {ecSignatureSchema} from '../schemas/ec_signature_schema'; import {signedOrdersSchema} from '../schemas/signed_orders_schema'; import {orderFillRequestsSchema} from '../schemas/order_fill_requests_schema'; @@ -53,9 +57,10 @@ export class ExchangeWrapper extends ContractWrapper { [ExchangeContractErrCodes.ERROR_FILL_TRUNCATION]: ExchangeContractErrs.ORDER_FILL_ROUNDING_ERROR, [ExchangeContractErrCodes.ERROR_FILL_BALANCE_ALLOWANCE]: ExchangeContractErrs.FILL_BALANCE_ALLOWANCE_ERROR, }; - private _exchangeContractIfExists?: ExchangeContract; + private _exchangeContractByAddress: ExchangeContractByAddress; private _exchangeLogEventEmitters: ContractEventEmitter[]; private _tokenWrapper: TokenWrapper; + private _proxyWrapper: ProxyWrapper; private static _getOrderAddressesAndValues(order: Order): [OrderAddresses, OrderValues] { const orderAddresses: OrderAddresses = [ order.maker, @@ -74,27 +79,31 @@ export class ExchangeWrapper extends ContractWrapper { ]; return [orderAddresses, orderValues]; } - constructor(web3Wrapper: Web3Wrapper, tokenWrapper: TokenWrapper) { + constructor(web3Wrapper: Web3Wrapper, tokenWrapper: TokenWrapper, proxyWrapper: ProxyWrapper) { super(web3Wrapper); this._tokenWrapper = tokenWrapper; + this._proxyWrapper = proxyWrapper; this._exchangeLogEventEmitters = []; + this._exchangeContractByAddress = {}; } - public async invalidateContractInstanceAsync(): Promise<void> { + public async invalidateContractInstancesAsync(): Promise<void> { await this.stopWatchingAllEventsAsync(); - delete this._exchangeContractIfExists; + this._exchangeContractByAddress = {}; } /** * Returns the unavailable takerAmount of an order. Unavailable amount is defined as the total * amount that has been filled or cancelled. The remaining takerAmount can be calculated by * subtracting the unavailable amount from the total order takerAmount. - * @param orderHash The hex encoded orderHash for which you would like to retrieve the - * unavailable takerAmount. + * @param orderHash The hex encoded orderHash for which you would like to retrieve the + * unavailable takerAmount. + * @param exchangeContractAddress The hex encoded address of the Exchange contract to use. * @return The amount of the order (in taker tokens) that has either been filled or canceled. */ - public async getUnavailableTakerAmountAsync(orderHash: string): Promise<BigNumber.BigNumber> { + public async getUnavailableTakerAmountAsync(orderHash: string, + exchangeContractAddress: string): Promise<BigNumber.BigNumber> { assert.isValidOrderHash('orderHash', orderHash); - const exchangeContract = await this._getExchangeContractAsync(); + const exchangeContract = await this._getExchangeContractAsync(exchangeContractAddress); let unavailableAmountInBaseUnits = await exchangeContract.getUnavailableValueT.call(orderHash); // Wrap BigNumbers returned from web3 with our own (later) version of BigNumber unavailableAmountInBaseUnits = new BigNumber(unavailableAmountInBaseUnits); @@ -103,12 +112,14 @@ export class ExchangeWrapper extends ContractWrapper { /** * Retrieve the takerAmount of an order that has already been filled. * @param orderHash The hex encoded orderHash for which you would like to retrieve the filled takerAmount. + * @param exchangeContractAddress The hex encoded address of the Exchange contract to use. * @return The amount of the order (in taker tokens) that has already been filled. */ - public async getFilledTakerAmountAsync(orderHash: string): Promise<BigNumber.BigNumber> { + public async getFilledTakerAmountAsync(orderHash: string, + exchangeContractAddress: string): Promise<BigNumber.BigNumber> { assert.isValidOrderHash('orderHash', orderHash); - const exchangeContract = await this._getExchangeContractAsync(); + const exchangeContract = await this._getExchangeContractAsync(exchangeContractAddress); let fillAmountInBaseUnits = await exchangeContract.filled.call(orderHash); // Wrap BigNumbers returned from web3 with our own (later) version of BigNumber fillAmountInBaseUnits = new BigNumber(fillAmountInBaseUnits); @@ -118,12 +129,14 @@ export class ExchangeWrapper extends ContractWrapper { * Retrieve the takerAmount of an order that has been cancelled. * @param orderHash The hex encoded orderHash for which you would like to retrieve the * cancelled takerAmount. + * @param exchangeContractAddress The hex encoded address of the Exchange contract to use. * @return The amount of the order (in taker tokens) that has been cancelled. */ - public async getCanceledTakerAmountAsync(orderHash: string): Promise<BigNumber.BigNumber> { + public async getCanceledTakerAmountAsync(orderHash: string, + exchangeContractAddress: string): Promise<BigNumber.BigNumber> { assert.isValidOrderHash('orderHash', orderHash); - const exchangeContract = await this._getExchangeContractAsync(); + const exchangeContract = await this._getExchangeContractAsync(exchangeContractAddress); let cancelledAmountInBaseUnits = await exchangeContract.cancelled.call(orderHash); // Wrap BigNumbers returned from web3 with our own (later) version of BigNumber cancelledAmountInBaseUnits = new BigNumber(cancelledAmountInBaseUnits); @@ -152,7 +165,7 @@ export class ExchangeWrapper extends ContractWrapper { assert.isBoolean('shouldCheckTransfer', shouldCheckTransfer); await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); - const exchangeInstance = await this._getExchangeContractAsync(); + const exchangeInstance = await this._getExchangeContractAsync(signedOrder.exchangeContractAddress); await this._validateFillOrderAndThrowIfInvalidAsync(signedOrder, takerTokenFillAmount, takerAddress); const [orderAddresses, orderValues] = ExchangeWrapper._getOrderAddressesAndValues(signedOrder); @@ -205,12 +218,15 @@ export class ExchangeWrapper extends ContractWrapper { @decorators.contractCallErrorHandler public async fillOrdersUpToAsync(signedOrders: SignedOrder[], takerTokenFillAmount: BigNumber.BigNumber, shouldCheckTransfer: boolean, takerAddress: string): Promise<BigNumber.BigNumber> { + assert.doesConformToSchema('signedOrders', signedOrders, signedOrdersSchema); const takerTokenAddresses = _.map(signedOrders, signedOrder => signedOrder.takerTokenAddress); assert.hasAtMostOneUniqueValue(takerTokenAddresses, - ExchangeContractErrs.MULTIPLE_TAKER_TOKENS_IN_FILL_UP_TO_DISALLOWED); + ExchangeContractErrs.MULTIPLE_TAKER_TOKENS_IN_FILL_UP_TO_DISALLOWED); + const exchangeContractAddresses = _.map(signedOrders, signedOrder => signedOrder.exchangeContractAddress); + assert.hasAtMostOneUniqueValue(exchangeContractAddresses, + ExchangeContractErrs.BATCH_ORDERS_MUST_HAVE_SAME_EXCHANGE_ADDRESS); assert.isBigNumber('takerTokenFillAmount', takerTokenFillAmount); assert.isBoolean('shouldCheckTransfer', shouldCheckTransfer); - assert.doesConformToSchema('signedOrders', signedOrders, signedOrdersSchema); await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); for (const signedOrder of signedOrders) { await this._validateFillOrderAndThrowIfInvalidAsync( @@ -233,7 +249,7 @@ export class ExchangeWrapper extends ContractWrapper { orderAddressesValuesAndSignatureArray, ); - const exchangeInstance = await this._getExchangeContractAsync(); + const exchangeInstance = await this._getExchangeContractAsync(exchangeContractAddresses[0]); const gas = await exchangeInstance.fillUpTo.estimateGas( orderAddressesArray, orderValuesArray, @@ -282,9 +298,15 @@ export class ExchangeWrapper extends ContractWrapper { @decorators.contractCallErrorHandler public async batchFillOrderAsync(orderFillRequests: OrderFillRequest[], shouldCheckTransfer: boolean, takerAddress: string): Promise<void> { + assert.doesConformToSchema('orderFillRequests', orderFillRequests, orderFillRequestsSchema); + const exchangeContractAddresses = _.map( + orderFillRequests, + orderFillRequest => orderFillRequest.signedOrder.exchangeContractAddress, + ); + assert.hasAtMostOneUniqueValue(exchangeContractAddresses, + ExchangeContractErrs.BATCH_ORDERS_MUST_HAVE_SAME_EXCHANGE_ADDRESS); assert.isBoolean('shouldCheckTransfer', shouldCheckTransfer); await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); - assert.doesConformToSchema('orderFillRequests', orderFillRequests, orderFillRequestsSchema); for (const orderFillRequest of orderFillRequests) { await this._validateFillOrderAndThrowIfInvalidAsync( orderFillRequest.signedOrder, orderFillRequest.takerTokenFillAmount, takerAddress); @@ -307,7 +329,7 @@ export class ExchangeWrapper extends ContractWrapper { orderAddressesValuesAmountsAndSignatureArray, ); - const exchangeInstance = await this._getExchangeContractAsync(); + const exchangeInstance = await this._getExchangeContractAsync(exchangeContractAddresses[0]); const gas = await exchangeInstance.batchFill.estimateGas( orderAddressesArray, orderValuesArray, @@ -351,7 +373,7 @@ export class ExchangeWrapper extends ContractWrapper { assert.isBigNumber('takerTokenFillAmount', takerTokenFillAmount); await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); - const exchangeInstance = await this._getExchangeContractAsync(); + const exchangeInstance = await this._getExchangeContractAsync(signedOrder.exchangeContractAddress); await this._validateFillOrderAndThrowIfInvalidAsync(signedOrder, takerTokenFillAmount, takerAddress); await this._validateFillOrKillOrderAndThrowIfInvalidAsync(signedOrder, exchangeInstance.address, @@ -394,9 +416,18 @@ export class ExchangeWrapper extends ContractWrapper { @decorators.contractCallErrorHandler public async batchFillOrKillAsync(orderFillOrKillRequests: OrderFillOrKillRequest[], takerAddress: string): Promise<void> { - await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); assert.doesConformToSchema('orderFillOrKillRequests', orderFillOrKillRequests, orderFillOrKillRequestsSchema); - const exchangeInstance = await this._getExchangeContractAsync(); + const exchangeContractAddresses = _.map( + orderFillOrKillRequests, + orderFillOrKillRequest => orderFillOrKillRequest.signedOrder.exchangeContractAddress, + ); + assert.hasAtMostOneUniqueValue(exchangeContractAddresses, + ExchangeContractErrs.BATCH_ORDERS_MUST_HAVE_SAME_EXCHANGE_ADDRESS); + await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); + if (_.isEmpty(orderFillOrKillRequests)) { + return; // no-op + } + const exchangeInstance = await this._getExchangeContractAsync(exchangeContractAddresses[0]); for (const request of orderFillOrKillRequests) { await this._validateFillOrKillOrderAndThrowIfInvalidAsync(request.signedOrder, exchangeInstance.address, request.fillTakerAmount); @@ -455,7 +486,7 @@ export class ExchangeWrapper extends ContractWrapper { assert.isBigNumber('takerTokenCancelAmount', takerTokenCancelAmount); await assert.isSenderAddressAsync('order.maker', order.maker, this._web3Wrapper); - const exchangeInstance = await this._getExchangeContractAsync(); + const exchangeInstance = await this._getExchangeContractAsync(order.exchangeContractAddress); await this._validateCancelOrderAndThrowIfInvalidAsync(order, takerTokenCancelAmount); const [orderAddresses, orderValues] = ExchangeWrapper._getOrderAddressesAndValues(order); @@ -489,12 +520,18 @@ export class ExchangeWrapper extends ContractWrapper { */ @decorators.contractCallErrorHandler public async batchCancelOrderAsync(orderCancellationRequests: OrderCancellationRequest[]): Promise<void> { + assert.doesConformToSchema('orderCancellationRequests', orderCancellationRequests, + orderCancellationRequestsSchema); + const exchangeContractAddresses = _.map( + orderCancellationRequests, + orderCancellationRequest => orderCancellationRequest.order.exchangeContractAddress, + ); + assert.hasAtMostOneUniqueValue(exchangeContractAddresses, + ExchangeContractErrs.BATCH_ORDERS_MUST_HAVE_SAME_EXCHANGE_ADDRESS); const makers = _.map(orderCancellationRequests, cancellationRequest => cancellationRequest.order.maker); assert.hasAtMostOneUniqueValue(makers, ExchangeContractErrs.MULTIPLE_MAKERS_IN_SINGLE_CANCEL_BATCH_DISALLOWED); const maker = makers[0]; await assert.isSenderAddressAsync('maker', maker, this._web3Wrapper); - assert.doesConformToSchema('orderCancellationRequests', orderCancellationRequests, - orderCancellationRequestsSchema); for (const cancellationRequest of orderCancellationRequests) { await this._validateCancelOrderAndThrowIfInvalidAsync( cancellationRequest.order, cancellationRequest.takerTokenCancelAmount, @@ -503,7 +540,7 @@ export class ExchangeWrapper extends ContractWrapper { if (_.isEmpty(orderCancellationRequests)) { return; // no-op } - const exchangeInstance = await this._getExchangeContractAsync(); + const exchangeInstance = await this._getExchangeContractAsync(exchangeContractAddresses[0]); const orderAddressesValuesAndTakerTokenCancelAmounts = _.map(orderCancellationRequests, cancellationRequest => { return [ ...ExchangeWrapper._getOrderAddressesAndValues(cancellationRequest.order), @@ -534,16 +571,17 @@ export class ExchangeWrapper extends ContractWrapper { } /** * Subscribe to an event type emitted by the Exchange smart contract - * @param eventName The exchange contract event you would like to subscribe to. - * @param subscriptionOpts Subscriptions options that let you configure the subscription. - * @param indexFilterValues An object where the keys are indexed args returned by the event and - * the value is the value you are interested in. E.g `{maker: aUserAddressHex}` + * @param eventName The exchange contract event you would like to subscribe to. + * @param subscriptionOpts Subscriptions options that let you configure the subscription. + * @param indexFilterValues An object where the keys are indexed args returned by the event and + * the value is the value you are interested in. E.g `{maker: aUserAddressHex}` + * @param exchangeContractAddress The hex encoded address of the Exchange contract to use. * @return ContractEventEmitter object */ public async subscribeAsync(eventName: ExchangeEvents, subscriptionOpts: SubscriptionOpts, - indexFilterValues: IndexedFilterValues): + indexFilterValues: IndexedFilterValues, exchangeContractAddress: string): Promise<ContractEventEmitter> { - const exchangeContract = await this._getExchangeContractAsync(); + const exchangeContract = await this._getExchangeContractAsync(exchangeContractAddress); let createLogEvent: CreateContractEvent; switch (eventName) { case ExchangeEvents.LogFill: @@ -565,13 +603,41 @@ export class ExchangeWrapper extends ContractWrapper { return eventEmitter; } /** - * Returns the ethereum address of the current exchange contract + * Returns the ethereum addresses of all available exchange contracts + * on the network that the provided web3 instance is connected to + * @return The ethereum addresses of all available exchange contracts. + */ + public async getAvailableContractAddressesAsync(): Promise<string[]> { + const networkId = await this._web3Wrapper.getNetworkIdIfExistsAsync(); + if (_.isUndefined(networkId)) { + return []; + } else { + const exchangeArtifacts = _.values(ExchangeArtifactsByName); + const networkSpecificExchangeArtifacts = _.compact(_.map( + exchangeArtifacts, exchangeArtifact => exchangeArtifact.networks[networkId])); + const exchangeAddresses = _.map( + networkSpecificExchangeArtifacts, + networkSpecificExchangeArtifact => networkSpecificExchangeArtifact.address, + ); + return exchangeAddresses; + } + } + /** + * Returns the ethereum addresses of all available exchange contracts * on the network that the provided web3 instance is connected to - * @return The ethereum address of the current exchange contract. + * that are currently authorized on the Proxy contract + * @return The ethereum addresses of all available and authorized exchange contract. */ - public async getContractAddressAsync(): Promise<string> { - const exchangeContract = await this._getExchangeContractAsync(); - return exchangeContract.address; + public async getProxyAuthorizedContractAddressesAsync(): Promise<string[]> { + const exchangeContractAddresses = await this.getAvailableContractAddressesAsync(); + const proxyAuthorizedExchangeContractAddresses = []; + for (const exchangeContractAddress of exchangeContractAddresses) { + const isAuthorized = await this._isExchangeContractAddressProxyAuthorizedAsync(exchangeContractAddress); + if (isAuthorized) { + proxyAuthorizedExchangeContractAddresses.push(exchangeContractAddress); + } + } + return proxyAuthorizedExchangeContractAddresses; } /** * Stops watching for all exchange events @@ -582,6 +648,10 @@ export class ExchangeWrapper extends ContractWrapper { await Promise.all(stopWatchingPromises); this._exchangeLogEventEmitters = []; } + private async _isExchangeContractAddressProxyAuthorizedAsync(exchangeContractAddress: string): Promise<boolean> { + const isAuthorized = await this._proxyWrapper.isAuthorizedAsync(exchangeContractAddress); + return isAuthorized; + } private _wrapEventEmitter(event: ContractEventObj): ContractEventEmitter { const zeroExEvent = { watch: event.watch.bind(event), @@ -592,12 +662,13 @@ export class ExchangeWrapper extends ContractWrapper { return zeroExEvent; } private async _isValidSignatureUsingContractCallAsync(dataHex: string, ecSignature: ECSignature, - signerAddressHex: string): Promise<boolean> { + signerAddressHex: string, + exchangeContractAddress: string): Promise<boolean> { assert.isHexString('dataHex', dataHex); assert.doesConformToSchema('ecSignature', ecSignature, ecSignatureSchema); assert.isETHAddressHex('signerAddressHex', signerAddressHex); - const exchangeInstance = await this._getExchangeContractAsync(); + const exchangeInstance = await this._getExchangeContractAsync(exchangeContractAddress); const isValidSignature = await exchangeInstance.isValidSignature.call( signerAddressHex, @@ -608,13 +679,8 @@ export class ExchangeWrapper extends ContractWrapper { ); return isValidSignature; } - private async _getOrderHashHexAsync(order: Order|SignedOrder): Promise<string> { - const exchangeInstance = await this._getExchangeContractAsync(); - const orderHashHex = utils.getOrderHashHex(order, exchangeInstance.address); - return orderHashHex; - } private async _getOrderHashHexUsingContractCallAsync(order: Order|SignedOrder): Promise<string> { - const exchangeInstance = await this._getExchangeContractAsync(); + const exchangeInstance = await this._getExchangeContractAsync(order.exchangeContractAddress); const [orderAddresses, orderValues] = ExchangeWrapper._getOrderAddressesAndValues(order); const orderHashHex = await exchangeInstance.getOrderHash.call(orderAddresses, orderValues); return orderHashHex; @@ -632,12 +698,13 @@ export class ExchangeWrapper extends ContractWrapper { if (signedOrder.expirationUnixTimestampSec.lessThan(currentUnixTimestampSec)) { throw new Error(ExchangeContractErrs.ORDER_FILL_EXPIRED); } - const zrxTokenAddress = await this._getZRXTokenAddressAsync(); + const zrxTokenAddress = await this._getZRXTokenAddressAsync(signedOrder.exchangeContractAddress); await this._validateFillOrderBalancesAndAllowancesAndThrowIfInvalidAsync(signedOrder, fillTakerAmount, senderAddress, zrxTokenAddress); const wouldRoundingErrorOccur = await this._isRoundingErrorAsync( signedOrder.takerTokenAmount, fillTakerAmount, signedOrder.makerTokenAmount, + signedOrder.exchangeContractAddress, ); if (wouldRoundingErrorOccur) { throw new Error(ExchangeContractErrs.ORDER_FILL_ROUNDING_ERROR); @@ -648,8 +715,8 @@ export class ExchangeWrapper extends ContractWrapper { if (takerTokenCancelAmount.eq(0)) { throw new Error(ExchangeContractErrs.ORDER_CANCEL_AMOUNT_ZERO); } - const orderHash = await this._getOrderHashHexAsync(order); - const unavailableAmount = await this.getUnavailableTakerAmountAsync(orderHash); + const orderHash = utils.getOrderHashHex(order); + const unavailableAmount = await this.getUnavailableTakerAmountAsync(orderHash, order.exchangeContractAddress); if (order.takerTokenAmount.minus(unavailableAmount).eq(0)) { throw new Error(ExchangeContractErrs.ORDER_ALREADY_CANCELLED_OR_FILLED); } @@ -659,11 +726,11 @@ export class ExchangeWrapper extends ContractWrapper { } } private async _validateFillOrKillOrderAndThrowIfInvalidAsync(signedOrder: SignedOrder, - exchangeAddress: string, + exchangeContractAddress: string, fillTakerAmount: BigNumber.BigNumber) { // Check that fillValue available >= fillTakerAmount - const orderHashHex = utils.getOrderHashHex(signedOrder, exchangeAddress); - const unavailableTakerAmount = await this.getUnavailableTakerAmountAsync(orderHashHex); + const orderHashHex = utils.getOrderHashHex(signedOrder); + const unavailableTakerAmount = await this.getUnavailableTakerAmountAsync(orderHashHex, exchangeContractAddress); const remainingTakerAmount = signedOrder.takerTokenAmount.minus(unavailableTakerAmount); if (remainingTakerAmount < fillTakerAmount) { throw new Error(ExchangeContractErrs.INSUFFICIENT_REMAINING_FILL_AMOUNT); @@ -740,24 +807,41 @@ export class ExchangeWrapper extends ContractWrapper { } private async _isRoundingErrorAsync(takerTokenAmount: BigNumber.BigNumber, fillTakerAmount: BigNumber.BigNumber, - makerTokenAmount: BigNumber.BigNumber): Promise<boolean> { + makerTokenAmount: BigNumber.BigNumber, + exchangeContractAddress: string): Promise<boolean> { await assert.isUserAddressAvailableAsync(this._web3Wrapper); - const exchangeInstance = await this._getExchangeContractAsync(); + const exchangeInstance = await this._getExchangeContractAsync(exchangeContractAddress); const isRoundingError = await exchangeInstance.isRoundingError.call( takerTokenAmount, fillTakerAmount, makerTokenAmount, ); return isRoundingError; } - private async _getExchangeContractAsync(): Promise<ExchangeContract> { - if (!_.isUndefined(this._exchangeContractIfExists)) { - return this._exchangeContractIfExists; + private async _getExchangeContractAsync(exchangeContractAddress: string): Promise<ExchangeContract> { + if (!_.isUndefined(this._exchangeContractByAddress[exchangeContractAddress])) { + return this._exchangeContractByAddress[exchangeContractAddress]; } + const ExchangeArtifacts = this._getExchangeArtifactsByAddressOrThrow(exchangeContractAddress); const contractInstance = await this._instantiateContractIfExistsAsync((ExchangeArtifacts as any)); - this._exchangeContractIfExists = contractInstance as ExchangeContract; - return this._exchangeContractIfExists; + this._exchangeContractByAddress[exchangeContractAddress] = contractInstance as ExchangeContract; + return this._exchangeContractByAddress[exchangeContractAddress]; + } + private _getExchangeArtifactsByAddressOrThrow(exchangeContractAddress: string): ContractArtifact { + const exchangeArtifacts = _.values<ContractArtifact>(ExchangeArtifactsByName); + for (const exchangeArtifact of exchangeArtifacts) { + const networkSpecificExchangeArtifactValues = _.values(exchangeArtifact.networks); + const exchangeAddressesInArtifact = _.map( + networkSpecificExchangeArtifactValues, + networkSpecificExchangeArtifact => networkSpecificExchangeArtifact.address, + ); + if (_.includes(exchangeAddressesInArtifact, exchangeContractAddress)) { + return exchangeArtifact; + } + } + throw new Error(ZeroExError.EXCHANGE_CONTRACT_DOES_NOT_EXIST); } - private async _getZRXTokenAddressAsync(): Promise<string> { - const exchangeInstance = await this._getExchangeContractAsync(); - return exchangeInstance.ZRX.call(); + private async _getZRXTokenAddressAsync(exchangeContractAddress: string): Promise<string> { + const exchangeInstance = await this._getExchangeContractAsync(exchangeContractAddress); + const ZRXtokenAddress = await exchangeInstance.ZRX.call(); + return ZRXtokenAddress; } } diff --git a/src/contract_wrappers/proxy_wrapper.ts b/src/contract_wrappers/proxy_wrapper.ts new file mode 100644 index 000000000..862bce131 --- /dev/null +++ b/src/contract_wrappers/proxy_wrapper.ts @@ -0,0 +1,33 @@ +import * as _ from 'lodash'; +import {Web3Wrapper} from '../web3_wrapper'; +import {ContractWrapper} from './contract_wrapper'; +import * as ProxyArtifacts from '../artifacts/Proxy.json'; +import {ProxyContract} from '../types'; + +/** + * This class includes the functionality related to interacting with the Proxy contract. + */ +export class ProxyWrapper extends ContractWrapper { + private _proxyContractIfExists?: ProxyContract; + public invalidateContractInstance(): void { + delete this._proxyContractIfExists; + } + /** + * Check if the Exchange contract address is authorized by the Proxy contract. + * @param exchangeContractAddress The hex encoded address of the Exchange contract to use. + * @return Whether the exchangeContractAddress is authorized. + */ + public async isAuthorizedAsync(exchangeContractAddress: string): Promise<boolean> { + const proxyContractInstance = await this._getProxyContractAsync(); + const isAuthorized = await proxyContractInstance.authorized.call(exchangeContractAddress); + return isAuthorized; + } + private async _getProxyContractAsync(): Promise<ProxyContract> { + if (!_.isUndefined(this._proxyContractIfExists)) { + return this._proxyContractIfExists; + } + const contractInstance = await this._instantiateContractIfExistsAsync((ProxyArtifacts as any)); + this._proxyContractIfExists = contractInstance as ProxyContract; + return this._proxyContractIfExists; + } +} diff --git a/src/exchange_artifacts_by_name.ts b/src/exchange_artifacts_by_name.ts new file mode 100644 index 000000000..d5ae6e180 --- /dev/null +++ b/src/exchange_artifacts_by_name.ts @@ -0,0 +1,6 @@ +import {ContractArtifact} from './types'; +import * as Exchange_v1 from './artifacts/exchange/Exchange_v1.json'; + +export const ExchangeArtifactsByName = { + Exchange_v1: Exchange_v1 as any as ContractArtifact, +}; diff --git a/src/globals.d.ts b/src/globals.d.ts index 4a0a3fb04..6a4e8d3a7 100644 --- a/src/globals.d.ts +++ b/src/globals.d.ts @@ -7,10 +7,6 @@ declare module 'request-promise-native'; declare module 'web3-provider-engine'; declare module 'web3-provider-engine/subproviders/rpc'; -declare interface Schema { - id: string; -} - // HACK: In order to merge the bignumber declaration added by chai-bignumber to the chai Assertion // interface we must use `namespace` as the Chai definitelyTyped definition does. Since we otherwise // disallow `namespace`, we disable tslint for the following. diff --git a/src/types.ts b/src/types.ts index 200e65d56..2af778677 100644 --- a/src/types.ts +++ b/src/types.ts @@ -12,6 +12,7 @@ function strEnum(values: string[]): {[key: string]: string} { export const ZeroExError = strEnum([ 'CONTRACT_DOES_NOT_EXIST', + 'EXCHANGE_CONTRACT_DOES_NOT_EXIST', 'UNHANDLED_ERROR', 'USER_HAS_NO_ASSOCIATED_ADDRESSES', 'INVALID_SIGNATURE', @@ -147,6 +148,12 @@ export interface EtherTokenContract extends ContractInstance { withdraw: (amount: BigNumber.BigNumber, txOpts: TxOpts) => Promise<void>; } +export interface ProxyContract extends ContractInstance { + authorized: { + call: (address: string) => Promise<boolean>; + }; +} + export const SolidityTypes = strEnum([ 'address', 'uint256', @@ -182,6 +189,7 @@ export const ExchangeContractErrs = strEnum([ 'MULTIPLE_MAKERS_IN_SINGLE_CANCEL_BATCH_DISALLOWED', 'INSUFFICIENT_REMAINING_FILL_AMOUNT', 'MULTIPLE_TAKER_TOKENS_IN_FILL_UP_TO_DISALLOWED', + 'BATCH_ORDERS_MUST_HAVE_SAME_EXCHANGE_ADDRESS', ]); export type ExchangeContractErrs = keyof typeof ExchangeContractErrs; @@ -240,6 +248,7 @@ export interface Order { makerTokenAddress: string; takerTokenAddress: string; salt: BigNumber.BigNumber; + exchangeContractAddress: string; feeRecipient: string; expirationUnixTimestampSec: BigNumber.BigNumber; } @@ -325,3 +334,15 @@ export interface ContractEventEmitter { * It is however a `Web3` library type, not a native `0x.js` type. */ export type Web3Provider = Web3.Provider; + +export interface ExchangeContractByAddress { + [address: string]: ExchangeContract; +} + +export interface ContractArtifact { + networks: { + [networkId: number]: { + address: string; + }; + }; +} diff --git a/src/utils/assert.ts b/src/utils/assert.ts index 94b119d5a..38c1d4aae 100644 --- a/src/utils/assert.ts +++ b/src/utils/assert.ts @@ -2,6 +2,7 @@ import * as _ from 'lodash'; import * as BigNumber from 'bignumber.js'; import * as Web3 from 'web3'; import {Web3Wrapper} from '../web3_wrapper'; +import {Schema} from 'jsonschema'; import {SchemaValidator} from './schema_validator'; import {utils} from './utils'; diff --git a/src/utils/schema_validator.ts b/src/utils/schema_validator.ts index 9097dce88..e3f911adb 100644 --- a/src/utils/schema_validator.ts +++ b/src/utils/schema_validator.ts @@ -1,4 +1,4 @@ -import {Validator, ValidatorResult} from 'jsonschema'; +import {Validator, ValidatorResult, Schema} from 'jsonschema'; import {ecSignatureSchema, ecSignatureParameterSchema} from '../schemas/ec_signature_schema'; import {orderSchema, signedOrderSchema} from '../schemas/order_schemas'; import {addressSchema, numberSchema} from '../schemas/basic_type_schemas'; diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 6f2d02a70..061e9f99a 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -32,9 +32,9 @@ export const utils = { spawnSwitchErr(name: string, value: any): Error { return new Error(`Unexpected switch value: ${value} encountered for ${name}`); }, - getOrderHashHex(order: Order|SignedOrder, exchangeContractAddr: string): string { + getOrderHashHex(order: Order|SignedOrder): string { const orderParts = [ - {value: exchangeContractAddr, type: SolidityTypes.address}, + {value: order.exchangeContractAddress, type: SolidityTypes.address}, {value: order.maker, type: SolidityTypes.address}, {value: order.taker, type: SolidityTypes.address}, {value: order.makerTokenAddress, type: SolidityTypes.address}, diff --git a/test/0x.js_test.ts b/test/0x.js_test.ts index 9ec0a0c8e..50db402c4 100644 --- a/test/0x.js_test.ts +++ b/test/0x.js_test.ts @@ -16,10 +16,11 @@ describe('ZeroEx library', () => { it('overrides provider in nested web3s and invalidates contractInstances', async () => { const web3 = web3Factory.create(); const zeroEx = new ZeroEx(web3.currentProvider); + const [exchangeContractAddress] = await zeroEx.exchange.getAvailableContractAddressesAsync(); // Instantiate the contract instances with the current provider - await (zeroEx.exchange as any)._getExchangeContractAsync(); + await (zeroEx.exchange as any)._getExchangeContractAsync(exchangeContractAddress); await (zeroEx.tokenRegistry as any)._getTokenRegistryContractAsync(); - expect((zeroEx.exchange as any)._exchangeContractIfExists).to.not.be.undefined(); + expect((zeroEx.exchange as any)._exchangeContractByAddress[exchangeContractAddress]).to.not.be.undefined(); expect((zeroEx.tokenRegistry as any)._tokenRegistryContractIfExists).to.not.be.undefined(); const newProvider = web3Factory.getRpcProvider(); @@ -28,7 +29,7 @@ describe('ZeroEx library', () => { await zeroEx.setProviderAsync(newProvider); // Check that contractInstances with old provider are removed after provider update - expect((zeroEx.exchange as any)._exchangeContractIfExists).to.be.undefined(); + expect((zeroEx.exchange as any)._exchangeContractByAddress[exchangeContractAddress]).to.be.undefined(); expect((zeroEx.tokenRegistry as any)._tokenRegistryContractIfExists).to.be.undefined(); // Check that all nested web3 instances return the updated provider @@ -52,6 +53,10 @@ describe('ZeroEx library', () => { const address = '0x5409ed021d9299bf6814279a6a1411a7e866a631'; const web3 = web3Factory.create(); const zeroEx = new ZeroEx(web3.currentProvider); + let exchangeContractAddress: string; + before(async () => { + [exchangeContractAddress] = await zeroEx.exchange.getAvailableContractAddressesAsync(); + }); it('should return false if the data doesn\'t pertain to the signature & address', async () => { expect(ZeroEx.isValidSignature('0x0', signature, address)).to.be.false(); return expect( @@ -77,7 +82,7 @@ describe('ZeroEx library', () => { const isValidSignatureLocal = ZeroEx.isValidSignature(dataHex, signature, address); expect(isValidSignatureLocal).to.be.true(); const isValidSignatureOnContract = await (zeroEx.exchange as any) - ._isValidSignatureUsingContractCallAsync(dataHex, signature, address); + ._isValidSignatureUsingContractCallAsync(dataHex, signature, address, exchangeContractAddress); return expect(isValidSignatureOnContract).to.be.true(); }); }); @@ -125,15 +130,16 @@ describe('ZeroEx library', () => { expect(baseUnitAmount).to.be.bignumber.equal(expectedUnitAmount); }); }); - describe('#getOrderHashHexAsync', () => { - const exchangeContractAddress = constants.NULL_ADDRESS; - const expectedOrderHash = '0x103a5e97dab5dbeb8f385636f86a7d1e458a7ccbe1bd194727f0b2f85ab116c7'; + describe('#getOrderHashHex', () => { + const expectedOrderHash = '0x39da987067a3c9e5f1617694f1301326ba8c8b0498ebef5df4863bed394e3c83'; + const fakeExchangeContractAddress = '0xb69e673309512a9d726f87304c6984054f87a93b'; const order: Order = { maker: constants.NULL_ADDRESS, taker: constants.NULL_ADDRESS, feeRecipient: constants.NULL_ADDRESS, makerTokenAddress: constants.NULL_ADDRESS, takerTokenAddress: constants.NULL_ADDRESS, + exchangeContractAddress: fakeExchangeContractAddress, salt: new BigNumber(0), makerFee: new BigNumber(0), takerFee: new BigNumber(0), @@ -141,22 +147,11 @@ describe('ZeroEx library', () => { takerTokenAmount: new BigNumber(0), expirationUnixTimestampSec: new BigNumber(0), }; - let stubs: Sinon.SinonStub[] = []; - afterEach(() => { - // clean up any stubs after the test has completed - _.each(stubs, s => s.restore()); - stubs = []; - }); it('calculates the order hash', async () => { const web3 = web3Factory.create(); const zeroEx = new ZeroEx(web3.currentProvider); - stubs = [ - Sinon.stub((zeroEx as any), '_getExchangeAddressAsync') - .returns(Promise.resolve(exchangeContractAddress)), - ]; - - const orderHash = await zeroEx.getOrderHashHexAsync(order); + const orderHash = zeroEx.getOrderHashHex(order); expect(orderHash).to.be.equal(expectedOrderHash); }); }); diff --git a/test/artifacts_test.ts b/test/artifacts_test.ts index d71b45567..22d55a2ee 100644 --- a/test/artifacts_test.ts +++ b/test/artifacts_test.ts @@ -1,9 +1,14 @@ import * as fs from 'fs'; +import * as chai from 'chai'; +import {chaiSetup} from './utils/chai_setup'; import HDWalletProvider = require('truffle-hdwallet-provider'); import {ZeroEx} from '../src'; import {web3Factory} from './utils/web3_factory'; import {constants} from './utils/constants'; +chaiSetup.configure(); +const expect = chai.expect; + // Those tests are slower cause they're talking to a remote node const TIMEOUT = 10000; @@ -22,7 +27,8 @@ describe('Artifacts', () => { await (zeroEx.token as any)._getProxyAddressAsync(); }).timeout(TIMEOUT); it('exchange contract is deployed', async () => { - await (zeroEx.exchange as any)._getExchangeContractAsync(); + const exchangeContractAddresses = await zeroEx.exchange.getAvailableContractAddressesAsync(); + expect(exchangeContractAddresses).to.have.lengthOf.above(0); }).timeout(TIMEOUT); }); }); diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts index f40fdb874..5833a8c23 100644 --- a/test/exchange_wrapper_test.ts +++ b/test/exchange_wrapper_test.ts @@ -1,4 +1,5 @@ import 'mocha'; +import * as _ from 'lodash'; import * as chai from 'chai'; import * as Web3 from 'web3'; import * as BigNumber from 'bignumber.js'; @@ -22,6 +23,7 @@ import {DoneCallback} from '../src/types'; import {FillScenarios} from './utils/fill_scenarios'; import {TokenUtils} from './utils/token_utils'; import {assert} from '../src/utils/assert'; +import {ProxyWrapper} from '../src/contract_wrappers/proxy_wrapper'; chaiSetup.configure(); const expect = chai.expect; @@ -37,14 +39,16 @@ describe('ExchangeWrapper', () => { let userAddresses: string[]; let zrxTokenAddress: string; let fillScenarios: FillScenarios; + let exchangeContractAddress: string; before(async () => { web3 = web3Factory.create(); zeroEx = new ZeroEx(web3.currentProvider); + [exchangeContractAddress] = await zeroEx.exchange.getAvailableContractAddressesAsync(); userAddresses = await promisify(web3.eth.getAccounts)(); tokens = await zeroEx.tokenRegistry.getTokensAsync(); tokenUtils = new TokenUtils(tokens); zrxTokenAddress = tokenUtils.getProtocolTokenOrThrow().address; - fillScenarios = new FillScenarios(zeroEx, userAddresses, tokens, zrxTokenAddress); + fillScenarios = new FillScenarios(zeroEx, userAddresses, tokens, zrxTokenAddress, exchangeContractAddress); }); beforeEach(async () => { await blockchainLifecycle.startAsync(); @@ -391,11 +395,11 @@ describe('ExchangeWrapper', () => { signedOrder = await fillScenarios.createFillableSignedOrderAsync( makerTokenAddress, takerTokenAddress, makerAddress, takerAddress, fillableAmount, ); - signedOrderHashHex = await zeroEx.getOrderHashHexAsync(signedOrder); + signedOrderHashHex = zeroEx.getOrderHashHex(signedOrder); anotherSignedOrder = await fillScenarios.createFillableSignedOrderAsync( makerTokenAddress, takerTokenAddress, makerAddress, takerAddress, fillableAmount, ); - anotherOrderHashHex = await zeroEx.getOrderHashHexAsync(anotherSignedOrder); + anotherOrderHashHex = zeroEx.getOrderHashHex(anotherSignedOrder); orderFillBatch = [ { signedOrder, @@ -413,8 +417,12 @@ describe('ExchangeWrapper', () => { }); it('should successfully fill multiple orders', async () => { await zeroEx.exchange.batchFillOrderAsync(orderFillBatch, shouldCheckTransfer, takerAddress); - const filledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(signedOrderHashHex); - const anotherFilledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(anotherOrderHashHex); + const filledAmount = await zeroEx.exchange.getFilledTakerAmountAsync( + signedOrderHashHex, exchangeContractAddress, + ); + const anotherFilledAmount = await zeroEx.exchange.getFilledTakerAmountAsync( + anotherOrderHashHex, exchangeContractAddress, + ); expect(filledAmount).to.be.bignumber.equal(fillTakerAmount); expect(anotherFilledAmount).to.be.bignumber.equal(fillTakerAmount); }); @@ -431,11 +439,11 @@ describe('ExchangeWrapper', () => { signedOrder = await fillScenarios.createFillableSignedOrderAsync( makerTokenAddress, takerTokenAddress, makerAddress, takerAddress, fillableAmount, ); - signedOrderHashHex = await zeroEx.getOrderHashHexAsync(signedOrder); + signedOrderHashHex = zeroEx.getOrderHashHex(signedOrder); anotherSignedOrder = await fillScenarios.createFillableSignedOrderAsync( makerTokenAddress, takerTokenAddress, makerAddress, takerAddress, fillableAmount, ); - anotherOrderHashHex = await zeroEx.getOrderHashHexAsync(anotherSignedOrder); + anotherOrderHashHex = zeroEx.getOrderHashHex(anotherSignedOrder); signedOrders = [signedOrder, anotherSignedOrder]; }); describe('successful batch fills', () => { @@ -446,8 +454,12 @@ describe('ExchangeWrapper', () => { await zeroEx.exchange.fillOrdersUpToAsync( signedOrders, fillUpToAmount, shouldCheckTransfer, takerAddress, ); - const filledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(signedOrderHashHex); - const anotherFilledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(anotherOrderHashHex); + const filledAmount = await zeroEx.exchange.getFilledTakerAmountAsync( + signedOrderHashHex, exchangeContractAddress, + ); + const anotherFilledAmount = await zeroEx.exchange.getFilledTakerAmountAsync( + anotherOrderHashHex, exchangeContractAddress, + ); expect(filledAmount).to.be.bignumber.equal(fillableAmount); const remainingFillAmount = fillableAmount.minus(1); expect(anotherFilledAmount).to.be.bignumber.equal(remainingFillAmount); @@ -479,7 +491,7 @@ describe('ExchangeWrapper', () => { signedOrder = await fillScenarios.createFillableSignedOrderAsync( makerTokenAddress, takerTokenAddress, makerAddress, takerAddress, fillableAmount, ); - orderHashHex = await zeroEx.getOrderHashHexAsync(signedOrder); + orderHashHex = zeroEx.getOrderHashHex(signedOrder); }); describe('#cancelOrderAsync', () => { describe('failed cancels', () => { @@ -494,7 +506,7 @@ describe('ExchangeWrapper', () => { makerTokenAddress, takerTokenAddress, makerAddress, takerAddress, fillableAmount, expirationInPast, ); - orderHashHex = await zeroEx.getOrderHashHexAsync(expiredSignedOrder); + orderHashHex = zeroEx.getOrderHashHex(expiredSignedOrder); return expect(zeroEx.exchange.cancelOrderAsync(expiredSignedOrder, cancelAmount)) .to.be.rejectedWith(ExchangeContractErrs.ORDER_CANCEL_EXPIRED); }); @@ -507,7 +519,9 @@ describe('ExchangeWrapper', () => { describe('successful cancels', () => { it('should cancel an order', async () => { await zeroEx.exchange.cancelOrderAsync(signedOrder, cancelAmount); - const cancelledAmount = await zeroEx.exchange.getCanceledTakerAmountAsync(orderHashHex); + const cancelledAmount = await zeroEx.exchange.getCanceledTakerAmountAsync( + orderHashHex, exchangeContractAddress, + ); expect(cancelledAmount).to.be.bignumber.equal(cancelAmount); }); it('should return cancelled amount', async () => { @@ -524,7 +538,7 @@ describe('ExchangeWrapper', () => { anotherSignedOrder = await fillScenarios.createFillableSignedOrderAsync( makerTokenAddress, takerTokenAddress, makerAddress, takerAddress, fillableAmount, ); - anotherOrderHashHex = await zeroEx.getOrderHashHexAsync(anotherSignedOrder); + anotherOrderHashHex = zeroEx.getOrderHashHex(anotherSignedOrder); cancelBatch = [ { order: signedOrder, @@ -553,9 +567,12 @@ describe('ExchangeWrapper', () => { describe('successful batch cancels', () => { it('should cancel a batch of orders', async () => { await zeroEx.exchange.batchCancelOrderAsync(cancelBatch); - const cancelledAmount = await zeroEx.exchange.getCanceledTakerAmountAsync(orderHashHex); + const cancelledAmount = await zeroEx.exchange.getCanceledTakerAmountAsync( + orderHashHex, exchangeContractAddress, + ); const anotherCancelledAmount = await zeroEx.exchange.getCanceledTakerAmountAsync( - anotherOrderHashHex); + anotherOrderHashHex, exchangeContractAddress, + ); expect(cancelledAmount).to.be.bignumber.equal(cancelAmount); expect(anotherCancelledAmount).to.be.bignumber.equal(cancelAmount); }); @@ -582,53 +599,73 @@ describe('ExchangeWrapper', () => { signedOrder = await fillScenarios.createPartiallyFilledSignedOrderAsync( makerTokenAddress, takerTokenAddress, takerAddress, fillableAmount, partialFillAmount, ); - orderHash = await zeroEx.getOrderHashHexAsync(signedOrder); + orderHash = zeroEx.getOrderHashHex(signedOrder); }); describe('#getUnavailableTakerAmountAsync', () => { it ('should throw if passed an invalid orderHash', async () => { const invalidOrderHashHex = '0x123'; - return expect(zeroEx.exchange.getUnavailableTakerAmountAsync(invalidOrderHashHex)).to.be.rejected(); + return expect(zeroEx.exchange.getUnavailableTakerAmountAsync( + invalidOrderHashHex, exchangeContractAddress, + )).to.be.rejected(); }); it ('should return zero if passed a valid but non-existent orderHash', async () => { - const unavailableValueT = await zeroEx.exchange.getUnavailableTakerAmountAsync(NON_EXISTENT_ORDER_HASH); + const unavailableValueT = await zeroEx.exchange.getUnavailableTakerAmountAsync( + NON_EXISTENT_ORDER_HASH, exchangeContractAddress, + ); expect(unavailableValueT).to.be.bignumber.equal(0); }); it ('should return the unavailableValueT for a valid and partially filled orderHash', async () => { - const unavailableValueT = await zeroEx.exchange.getUnavailableTakerAmountAsync(orderHash); + const unavailableValueT = await zeroEx.exchange.getUnavailableTakerAmountAsync( + orderHash, exchangeContractAddress, + ); expect(unavailableValueT).to.be.bignumber.equal(partialFillAmount); }); }); describe('#getFilledTakerAmountAsync', () => { it ('should throw if passed an invalid orderHash', async () => { const invalidOrderHashHex = '0x123'; - return expect(zeroEx.exchange.getFilledTakerAmountAsync(invalidOrderHashHex)).to.be.rejected(); + return expect(zeroEx.exchange.getFilledTakerAmountAsync( + invalidOrderHashHex, exchangeContractAddress, + )).to.be.rejected(); }); it ('should return zero if passed a valid but non-existent orderHash', async () => { - const filledValueT = await zeroEx.exchange.getFilledTakerAmountAsync(NON_EXISTENT_ORDER_HASH); + const filledValueT = await zeroEx.exchange.getFilledTakerAmountAsync( + NON_EXISTENT_ORDER_HASH, exchangeContractAddress, + ); expect(filledValueT).to.be.bignumber.equal(0); }); it ('should return the filledValueT for a valid and partially filled orderHash', async () => { - const filledValueT = await zeroEx.exchange.getFilledTakerAmountAsync(orderHash); + const filledValueT = await zeroEx.exchange.getFilledTakerAmountAsync( + orderHash, exchangeContractAddress, + ); expect(filledValueT).to.be.bignumber.equal(partialFillAmount); }); }); describe('#getCanceledTakerAmountAsync', () => { it ('should throw if passed an invalid orderHash', async () => { const invalidOrderHashHex = '0x123'; - return expect(zeroEx.exchange.getCanceledTakerAmountAsync(invalidOrderHashHex)).to.be.rejected(); + return expect(zeroEx.exchange.getCanceledTakerAmountAsync( + invalidOrderHashHex, exchangeContractAddress, + )).to.be.rejected(); }); it ('should return zero if passed a valid but non-existent orderHash', async () => { - const cancelledValueT = await zeroEx.exchange.getCanceledTakerAmountAsync(NON_EXISTENT_ORDER_HASH); + const cancelledValueT = await zeroEx.exchange.getCanceledTakerAmountAsync( + NON_EXISTENT_ORDER_HASH, exchangeContractAddress, + ); expect(cancelledValueT).to.be.bignumber.equal(0); }); it ('should return the cancelledValueT for a valid and partially filled orderHash', async () => { - const cancelledValueT = await zeroEx.exchange.getCanceledTakerAmountAsync(orderHash); + const cancelledValueT = await zeroEx.exchange.getCanceledTakerAmountAsync( + orderHash, exchangeContractAddress, + ); expect(cancelledValueT).to.be.bignumber.equal(0); }); it ('should return the cancelledValueT for a valid and cancelled orderHash', async () => { const cancelAmount = fillableAmount.minus(partialFillAmount); await zeroEx.exchange.cancelOrderAsync(signedOrder, cancelAmount); - const cancelledValueT = await zeroEx.exchange.getCanceledTakerAmountAsync(orderHash); + const cancelledValueT = await zeroEx.exchange.getCanceledTakerAmountAsync( + orderHash, exchangeContractAddress, + ); expect(cancelledValueT).to.be.bignumber.equal(cancelAmount); }); }); @@ -669,8 +706,9 @@ describe('ExchangeWrapper', () => { fromBlock: 0, toBlock: 'latest', }; - const zeroExEvent = await zeroEx.exchange.subscribeAsync(ExchangeEvents.LogFill, subscriptionOpts, - indexFilterValues); + const zeroExEvent = await zeroEx.exchange.subscribeAsync( + ExchangeEvents.LogFill, subscriptionOpts, indexFilterValues, exchangeContractAddress, + ); zeroExEvent.watch((err: Error, event: ContractEvent) => { expect(err).to.be.null(); expect(event).to.not.be.undefined(); @@ -689,8 +727,9 @@ describe('ExchangeWrapper', () => { fromBlock: 0, toBlock: 'latest', }; - const zeroExEvent = await zeroEx.exchange.subscribeAsync(ExchangeEvents.LogCancel, subscriptionOpts, - indexFilterValues); + const zeroExEvent = await zeroEx.exchange.subscribeAsync( + ExchangeEvents.LogCancel, subscriptionOpts, indexFilterValues, exchangeContractAddress, + ); zeroExEvent.watch((err: Error, event: ContractEvent) => { expect(err).to.be.null(); expect(event).to.not.be.undefined(); @@ -708,7 +747,7 @@ describe('ExchangeWrapper', () => { toBlock: 'latest', }; const eventSubscriptionToBeCancelled = await zeroEx.exchange.subscribeAsync( - ExchangeEvents.LogFill, subscriptionOpts, indexFilterValues, + ExchangeEvents.LogFill, subscriptionOpts, indexFilterValues, exchangeContractAddress, ); eventSubscriptionToBeCancelled.watch((err: Error, event: ContractEvent) => { done(new Error('Expected this subscription to have been cancelled')); @@ -718,7 +757,7 @@ describe('ExchangeWrapper', () => { await zeroEx.setProviderAsync(newProvider); const eventSubscriptionToStay = await zeroEx.exchange.subscribeAsync( - ExchangeEvents.LogFill, subscriptionOpts, indexFilterValues, + ExchangeEvents.LogFill, subscriptionOpts, indexFilterValues, exchangeContractAddress, ); eventSubscriptionToStay.watch((err: Error, event: ContractEvent) => { expect(err).to.be.null(); @@ -740,7 +779,7 @@ describe('ExchangeWrapper', () => { toBlock: 'latest', }; const eventSubscriptionToBeStopped = await zeroEx.exchange.subscribeAsync( - ExchangeEvents.LogFill, subscriptionOpts, indexFilterValues, + ExchangeEvents.LogFill, subscriptionOpts, indexFilterValues, exchangeContractAddress, ); eventSubscriptionToBeStopped.watch((err: Error, event: ContractEvent) => { done(new Error('Expected this subscription to have been stopped')); @@ -770,16 +809,29 @@ describe('ExchangeWrapper', () => { const signedOrder = await fillScenarios.createFillableSignedOrderAsync( makerTokenAddress, takerTokenAddress, makerAddress, takerAddress, fillableAmount, ); - const orderHash = await zeroEx.getOrderHashHexAsync(signedOrder); + const orderHash = zeroEx.getOrderHashHex(signedOrder); const orderHashFromContract = await (zeroEx.exchange as any) ._getOrderHashHexUsingContractCallAsync(signedOrder); expect(orderHash).to.equal(orderHashFromContract); }); }); - describe('#getContractAddressAsync', () => { - it('returns the exchange contract address', async () => { - const exchangeAddress = await zeroEx.exchange.getContractAddressAsync(); - assert.isETHAddressHex('exchangeAddress', exchangeAddress); + describe('#getAvailableContractAddressesAsync', () => { + it('returns the exchange contract addresses', async () => { + const exchangeAddresses = await zeroEx.exchange.getAvailableContractAddressesAsync(); + _.map(exchangeAddresses, exchangeAddress => { + assert.isETHAddressHex('exchangeAddress', exchangeAddress); + }); + }); + }); + describe('#getProxyAuthorizedContractAddressesAsync', () => { + it('returns the Proxy authorized exchange contract addresses', async () => { + const exchangeAddresses = await zeroEx.exchange.getProxyAuthorizedContractAddressesAsync(); + for (const exchangeAddress of exchangeAddresses) { + assert.isETHAddressHex('exchangeAddress', exchangeAddress); + const proxyWrapper = (zeroEx as any)._proxyWrapper as ProxyWrapper; + const isAuthorized = await proxyWrapper.isAuthorizedAsync(exchangeAddress); + expect(isAuthorized).to.be.true(); + } }); }); }); diff --git a/test/proxy_wrapper_test.ts b/test/proxy_wrapper_test.ts new file mode 100644 index 000000000..29b5776c6 --- /dev/null +++ b/test/proxy_wrapper_test.ts @@ -0,0 +1,23 @@ +import * as chai from 'chai'; +import {chaiSetup} from './utils/chai_setup'; +import {web3Factory} from './utils/web3_factory'; +import {ZeroEx} from '../src'; +import {ProxyWrapper} from '../src/contract_wrappers/proxy_wrapper'; + +chaiSetup.configure(); +const expect = chai.expect; + +describe('ProxyWrapper', () => { + let zeroEx: ZeroEx; + before(async () => { + const web3 = web3Factory.create(); + zeroEx = new ZeroEx(web3.currentProvider); + }); + describe('#isAuthorizedAsync', () => { + it('should return false if the address is not authorized', async () => { + const proxyWrapper = (zeroEx as any)._proxyWrapper as ProxyWrapper; + const isAuthorized = await proxyWrapper.isAuthorizedAsync(ZeroEx.NULL_ADDRESS); + expect(isAuthorized).to.be.false(); + }); + }); +}); diff --git a/test/utils/fill_scenarios.ts b/test/utils/fill_scenarios.ts index b8ad7eb12..65a912955 100644 --- a/test/utils/fill_scenarios.ts +++ b/test/utils/fill_scenarios.ts @@ -9,12 +9,15 @@ export class FillScenarios { private tokens: Token[]; private coinbase: string; private zrxTokenAddress: string; - constructor(zeroEx: ZeroEx, userAddresses: string[], tokens: Token[], zrxTokenAddress: string) { + private exchangeContractAddress: string; + constructor(zeroEx: ZeroEx, userAddresses: string[], + tokens: Token[], zrxTokenAddress: string, exchangeContractAddress: string) { this.zeroEx = zeroEx; this.userAddresses = userAddresses; this.tokens = tokens; this.coinbase = userAddresses[0]; this.zrxTokenAddress = zrxTokenAddress; + this.exchangeContractAddress = exchangeContractAddress; } public async createFillableSignedOrderAsync(makerTokenAddress: string, takerTokenAddress: string, makerAddress: string, takerAddress: string, @@ -103,7 +106,7 @@ export class FillScenarios { const signedOrder = await orderFactory.createSignedOrderAsync(this.zeroEx, makerAddress, takerAddress, makerFee, takerFee, makerFillableAmount, makerTokenAddress, takerFillableAmount, takerTokenAddress, - feeRecepient, expirationUnixTimestampSec); + this.exchangeContractAddress, feeRecepient, expirationUnixTimestampSec); return signedOrder; } } diff --git a/test/utils/order_factory.ts b/test/utils/order_factory.ts index ef19f2c4c..22bf44c0f 100644 --- a/test/utils/order_factory.ts +++ b/test/utils/order_factory.ts @@ -13,6 +13,7 @@ export const orderFactory = { makerTokenAddress: string, takerTokenAmount: BigNumber.BigNumber, takerTokenAddress: string, + exchangeContractAddress: string, feeRecipient: string, expirationUnixTimestampSec?: BigNumber.BigNumber): Promise<SignedOrder> { const defaultExpirationUnixTimestampSec = new BigNumber(2524604400); // Close to infinite @@ -29,10 +30,11 @@ export const orderFactory = { makerTokenAddress, takerTokenAddress, salt: ZeroEx.generatePseudoRandomSalt(), + exchangeContractAddress, feeRecipient, expirationUnixTimestampSec, }; - const orderHash = await zeroEx.getOrderHashHexAsync(order); + const orderHash = zeroEx.getOrderHashHex(order); const ecSignature = await zeroEx.signOrderHashAsync(orderHash, maker); const signedOrder: SignedOrder = _.assign(order, {ecSignature}); return signedOrder; @@ -4570,6 +4570,25 @@ web3-provider-engine@^8.4.0: xhr "^2.2.0" xtend "^4.0.1" +web3-provider-engine@~8.1.0: + version "8.1.19" + resolved "https://registry.yarnpkg.com/web3-provider-engine/-/web3-provider-engine-8.1.19.tgz#3ccae95adecef55632e2a73bf3bee64b7e62fcf7" + dependencies: + async "^2.1.2" + clone "^2.0.0" + ethereumjs-block "^1.2.2" + ethereumjs-tx "^1.2.0" + ethereumjs-util "^5.0.1" + ethereumjs-vm "^2.0.2" + isomorphic-fetch "^2.2.0" + request "^2.67.0" + semaphore "^1.0.3" + solc "^0.4.2" + tape "^4.4.0" + web3 "^0.16.0" + xhr "^2.2.0" + xtend "^4.0.1" + web3-typescript-typings@^0.0.10: version "0.0.10" resolved "https://registry.yarnpkg.com/web3-typescript-typings/-/web3-typescript-typings-0.0.10.tgz#8108c80f252fedb5c1670a547da4554112dbd44d" |