diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-10-04 17:59:46 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-10-04 17:59:46 +0800 |
commit | 9af47eb063406753456f16bf3efb916666c76d7f (patch) | |
tree | b5fabea2d8ff8dd3e70a9160f015bb95ef51e0f5 /src/utils | |
parent | 944f51d66c5afb92008ddd1bff9fe83ce51a5e10 (diff) | |
download | dexon-sol-tools-9af47eb063406753456f16bf3efb916666c76d7f.tar dexon-sol-tools-9af47eb063406753456f16bf3efb916666c76d7f.tar.gz dexon-sol-tools-9af47eb063406753456f16bf3efb916666c76d7f.tar.bz2 dexon-sol-tools-9af47eb063406753456f16bf3efb916666c76d7f.tar.lz dexon-sol-tools-9af47eb063406753456f16bf3efb916666c76d7f.tar.xz dexon-sol-tools-9af47eb063406753456f16bf3efb916666c76d7f.tar.zst dexon-sol-tools-9af47eb063406753456f16bf3efb916666c76d7f.zip |
Use a ternary and add a comment
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/abi_decoder.ts | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/utils/abi_decoder.ts b/src/utils/abi_decoder.ts index e9ba3bc5a..542591251 100644 --- a/src/utils/abi_decoder.ts +++ b/src/utils/abi_decoder.ts @@ -27,14 +27,8 @@ export class AbiDecoder { const decodedData = SolidityCoder.decodeParams(dataTypes, logData.slice('0x'.length)); _.map(event.inputs, (param: Web3.EventParameter) => { - let value; - if (param.indexed) { - value = log.topics[topicsIndex]; - topicsIndex++; - } else { - value = decodedData[dataIndex]; - dataIndex++; - } + // Indexed parameters are stored in topics. Non-indexed ones in decodedData + let value = param.indexed ? log.topics[topicsIndex++] : decodedData[dataIndex++]; if (param.type === SolidityTypes.Address) { value = this.padZeros(new BigNumber(value).toString(16)); } else if (param.type === SolidityTypes.Uint256 || |