aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/utils/src')
-rw-r--r--packages/utils/src/abi_encoder/data_type.ts4
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types.ts5
2 files changed, 5 insertions, 4 deletions
diff --git a/packages/utils/src/abi_encoder/data_type.ts b/packages/utils/src/abi_encoder/data_type.ts
index f5a8087ea..15de12a2f 100644
--- a/packages/utils/src/abi_encoder/data_type.ts
+++ b/packages/utils/src/abi_encoder/data_type.ts
@@ -41,7 +41,8 @@ export abstract class DataType {
}
public decode(calldata: string, rules?: DecodingRules): any {
- const rawCalldata = new RawCalldata(calldata);
+ const rawCalldata = new RawCalldata(calldata, false);
+ console.log(`HERE DUDE ${JSON.stringify(rawCalldata)}`);
const rules_ = rules ? rules : DataType.DEFAULT_DECODING_RULES;
const value = this.generateValue(rawCalldata, rules_);
return value;
@@ -277,6 +278,7 @@ export abstract class MemberDataType extends DataType {
value = [];
_.each(members, (member: DataType, idx: number) => {
let memberValue = member.generateValue(calldata, rules);
+ console.log(`MEMBER VALUE: ${memberValue}`);
(value as any[]).push(memberValue);
});
}
diff --git a/packages/utils/src/abi_encoder/evm_data_types.ts b/packages/utils/src/abi_encoder/evm_data_types.ts
index d024a9bfa..bfb2808da 100644
--- a/packages/utils/src/abi_encoder/evm_data_types.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types.ts
@@ -154,9 +154,8 @@ abstract class Number extends PayloadDataType {
if (this instanceof Int) {
// Check if we're negative
const binBase = 2;
- const paddedValueBin = value.toString(binBase);
- const valueBin = paddedValueBin.slice(paddedValueBin.length - this.width);
- if (valueBin[0].startsWith('1')) {
+ const valueBin = value.toString(2);
+ if (valueBin.length === 256 && valueBin[0].startsWith('1')) {
// Negative
// Step 1/3: Invert binary value
let invertedValueBin = '';