All 71 tests passing. Both for function encoding and individual types.

This commit is contained in:
Greg Hysen
2018-11-19 13:07:34 -08:00
parent b213cb3974
commit 0c0bcb44d3
2 changed files with 4 additions and 3 deletions

View File

@@ -40,8 +40,8 @@ export abstract class DataType {
return calldataHex;
}
public decode(calldata: string, rules?: DecodingRules): any {
const rawCalldata = new RawCalldata(calldata, true); // @TODO Sohuld not hardcode false here
public decode(calldata: string, rules?: DecodingRules, hasSelector: boolean = false): any {
const rawCalldata = new RawCalldata(calldata, hasSelector);
const rules_ = rules ? rules : DataType.DEFAULT_DECODING_RULES;
const value = this.generateValue(rawCalldata, rules_);
return value;

View File

@@ -515,7 +515,8 @@ export class Method extends MemberDataType {
if (!calldata.startsWith(this.selector)) {
throw new Error(`Tried to decode calldata, but it was missing the function selector. Expected '${this.selector}'.`);
}
const value = super.decode(calldata, rules);
const hasSelector = true;
const value = super.decode(calldata, rules, hasSelector);
return value;
}