diff options
author | Greg Hysen <greg.hysen@gmail.com> | 2018-12-23 09:23:02 +0800 |
---|---|---|
committer | Greg Hysen <greg.hysen@gmail.com> | 2019-01-15 02:49:44 +0800 |
commit | b06f8239e1fe75703f88d34c0d225701406e28c2 (patch) | |
tree | 9beb83b64b37fb6ad67d066f089b868a8ad25fcb /packages/utils/src/abi_encoder/abstract_data_types/types/set.ts | |
parent | 7991de9ed0b5f1e8a38097d902eae09cc6b5cf11 (diff) | |
download | dexon-0x-contracts-b06f8239e1fe75703f88d34c0d225701406e28c2.tar dexon-0x-contracts-b06f8239e1fe75703f88d34c0d225701406e28c2.tar.gz dexon-0x-contracts-b06f8239e1fe75703f88d34c0d225701406e28c2.tar.bz2 dexon-0x-contracts-b06f8239e1fe75703f88d34c0d225701406e28c2.tar.lz dexon-0x-contracts-b06f8239e1fe75703f88d34c0d225701406e28c2.tar.xz dexon-0x-contracts-b06f8239e1fe75703f88d34c0d225701406e28c2.tar.zst dexon-0x-contracts-b06f8239e1fe75703f88d34c0d225701406e28c2.zip |
Finished porting new abi encoder to contracts
Diffstat (limited to 'packages/utils/src/abi_encoder/abstract_data_types/types/set.ts')
-rw-r--r-- | packages/utils/src/abi_encoder/abstract_data_types/types/set.ts | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts b/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts index d7105ff5f..5eb29c47b 100644 --- a/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts +++ b/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts @@ -13,6 +13,7 @@ import { DataType } from '../data_type'; import { DataTypeFactory, MemberIndexByName } from '../interfaces'; import { AbstractPointerDataType } from './pointer'; +import { logUtils } from '../../../log_utils'; export abstract class AbstractSetDataType extends DataType { protected readonly _arrayLength: number | undefined; @@ -134,22 +135,16 @@ export abstract class AbstractSetDataType extends DataType { const block = new SetCalldataBlock(this.getDataItem().name, this.getSignature(), parentName); // Create blocks for members of set. const memberCalldataBlocks: CalldataBlock[] = []; - let duplicateObj = _.cloneDeep(obj) as {[key:string]: any}; _.forEach(this._memberIndexByName, (memberIndex: number, memberName: string) => { if (!(memberName in obj)) { throw new Error( `Could not assign tuple to object: missing key '${memberName}' in object ${JSON.stringify(obj)}`, ); } - const memberValue: any = duplicateObj[memberName]; + const memberValue: any = (obj as {[key:string]: any})[memberName]; const memberBlock = this._members[memberIndex].generateCalldataBlock(memberValue, block); memberCalldataBlocks.push(memberBlock); - delete duplicateObj[memberName]; }); - // Sanity check that all members have been included. - if (Object.keys(duplicateObj).length !== 0) { - throw new Error(`Could not assign tuple to object: unrecognized keys ${Object.keys(duplicateObj)}`); - } // Associate member blocks with Set block. block.setMembers(memberCalldataBlocks); return block; |