Skip to content

Commit

Permalink
Fixed topic filters for numeric types with string values (#3013).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed May 26, 2022
1 parent a71f518 commit 0078e02
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/abi/src.ts/interface.ts
Expand Up @@ -462,6 +462,14 @@ export class Interface {
return keccak256(hexlify(value));
}

if (param.type === "bool" && typeof(value) === "boolean") {
value = (value ? "0x01": "0x00");
}

if (param.type.match(/^u?int/)) {
value = BigNumber.from(value).toHexString();
}

// Check addresses are valid
if (param.type === "address") { this._abiCoder.encode( [ "address" ], [ value ]); }
return hexZeroPad(hexlify(value), 32);
Expand Down

0 comments on commit 0078e02

Please sign in to comment.