Skip to content

Commit

Permalink
Fixed contract events (#404).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed May 23, 2019
1 parent 03c9725 commit 8cdda37
Show file tree
Hide file tree
Showing 6 changed files with 263 additions and 144 deletions.
8 changes: 7 additions & 1 deletion packages/abi/src.ts/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,13 @@ export class Interface {
eventFragment = this.getEvent(eventFragment);
}

if (topics != null && !eventFragment.anonymous) { topics = topics.slice(1); }
if (topics != null && !eventFragment.anonymous) {
let topicHash = this.getEventTopic(eventFragment);
if (!isHexString(topics[0], 32) || topics[0].toLowerCase() !== topicHash) {
errors.throwError("fragment/topic mismatch", errors.INVALID_ARGUMENT, { argument: "topics[0]", expected: topicHash, value: topics[0] });
}
topics = topics.slice(1);
}

let indexed: Array<ParamType> = [];
let nonIndexed: Array<ParamType> = [];
Expand Down
Loading

0 comments on commit 8cdda37

Please sign in to comment.