aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils/src/abi_decoder.ts
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-06-29 02:13:19 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-06-29 02:17:30 +0800
commite4188f5d4c38e53bf6966a364da41a3aa164b567 (patch)
treeac24b29f975be088a9d3d391f8a73acc7ad14aba /packages/utils/src/abi_decoder.ts
parent360927ec77d5ea50848f4c1b2c66566542a28d1c (diff)
parent0fcbd02d50bd564a9c888f247a4b0a565d928cc6 (diff)
downloaddexon-sol-tools-e4188f5d4c38e53bf6966a364da41a3aa164b567.tar
dexon-sol-tools-e4188f5d4c38e53bf6966a364da41a3aa164b567.tar.gz
dexon-sol-tools-e4188f5d4c38e53bf6966a364da41a3aa164b567.tar.bz2
dexon-sol-tools-e4188f5d4c38e53bf6966a364da41a3aa164b567.tar.lz
dexon-sol-tools-e4188f5d4c38e53bf6966a364da41a3aa164b567.tar.xz
dexon-sol-tools-e4188f5d4c38e53bf6966a364da41a3aa164b567.tar.zst
dexon-sol-tools-e4188f5d4c38e53bf6966a364da41a3aa164b567.zip
Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/website/support-new-metamask
Diffstat (limited to 'packages/utils/src/abi_decoder.ts')
-rw-r--r--packages/utils/src/abi_decoder.ts15
1 files changed, 14 insertions, 1 deletions
diff --git a/packages/utils/src/abi_decoder.ts b/packages/utils/src/abi_decoder.ts
index 931cb94b2..d0c1ddc7d 100644
--- a/packages/utils/src/abi_decoder.ts
+++ b/packages/utils/src/abi_decoder.ts
@@ -32,7 +32,20 @@ export class AbiDecoder {
const decodedParams: DecodedLogArgs = {};
let topicsIndex = 1;
- const decodedData = ethersInterface.events[event.name].parse(log.data);
+ let decodedData: any[];
+ try {
+ decodedData = ethersInterface.events[event.name].parse(log.data);
+ } catch (error) {
+ if (error.code === ethers.errors.INVALID_ARGUMENT) {
+ // Because we index events by Method ID, and Method IDs are derived from the method
+ // name and the input parameters, it's possible that the return value of the event
+ // does not match our ABI. If that's the case, then ethers will throw an error
+ // when we try to parse the event. We handle that case here by returning the log rather
+ // than throwing an error.
+ return log;
+ }
+ throw error;
+ }
let didFailToDecode = false;
_.forEach(event.inputs, (param: EventParameter, i: number) => {