aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/0x.js/CHANGELOG.md4
-rw-r--r--packages/utils/src/abi_decoder.ts19
2 files changed, 18 insertions, 5 deletions
diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md
index 5250402c6..eef6f3642 100644
--- a/packages/0x.js/CHANGELOG.md
+++ b/packages/0x.js/CHANGELOG.md
@@ -1,5 +1,9 @@
# CHANGELOG
+## v0.x.x - _TBD, 2018_
+
+ * Fixed the bug causing order watcher to throw if there is the event with the same signature but different indexed fields (#)
+
## v0.31.1 - _February 1, 2018_
* Fix the bug causing order watcher to throw is makerToken === zrx (#357)
diff --git a/packages/utils/src/abi_decoder.ts b/packages/utils/src/abi_decoder.ts
index f96ee2edb..2dd7134a7 100644
--- a/packages/utils/src/abi_decoder.ts
+++ b/packages/utils/src/abi_decoder.ts
@@ -36,9 +36,14 @@ export class AbiDecoder {
const dataTypes = _.map(nonIndexedInputs, input => input.type);
const decodedData = SolidityCoder.decodeParams(dataTypes, logData.slice('0x'.length));
+ let failedToDecode = false;
_.map(event.inputs, (param: Web3.EventParameter) => {
// Indexed parameters are stored in topics. Non-indexed ones in decodedData
let value: BigNumber | string = param.indexed ? log.topics[topicsIndex++] : decodedData[dataIndex++];
+ if (_.isUndefined(value)) {
+ failedToDecode = true;
+ return;
+ }
if (param.type === SolidityTypes.Address) {
value = AbiDecoder._padZeros(new BigNumber(value).toString(16));
} else if (
@@ -51,11 +56,15 @@ export class AbiDecoder {
decodedParams[param.name] = value;
});
- return {
- ...log,
- event: event.name,
- args: decodedParams,
- };
+ if (failedToDecode) {
+ return log;
+ } else {
+ return {
+ ...log,
+ event: event.name,
+ args: decodedParams,
+ };
+ }
}
private _addABI(abiArray: Web3.AbiDefinition[]): void {
_.map(abiArray, (abi: Web3.AbiDefinition) => {