diff options
author | Greg Hysen <greg.hysen@gmail.com> | 2018-11-26 09:47:33 +0800 |
---|---|---|
committer | Greg Hysen <greg.hysen@gmail.com> | 2018-11-29 08:38:11 +0800 |
commit | bb4d02e413119132f283ee17549cf5e1732d75b5 (patch) | |
tree | 531bbe0e43fb48ba47b1c995b2beca9af4569371 /packages | |
parent | 22ce3e2e29fb50d9b9244c9ee567c124586be9ae (diff) | |
download | dexon-sol-tools-bb4d02e413119132f283ee17549cf5e1732d75b5.tar.gz dexon-sol-tools-bb4d02e413119132f283ee17549cf5e1732d75b5.tar.zst dexon-sol-tools-bb4d02e413119132f283ee17549cf5e1732d75b5.zip |
Comments for Address
Diffstat (limited to 'packages')
-rw-r--r-- | packages/utils/src/abi_encoder/evm_data_types/address.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/packages/utils/src/abi_encoder/evm_data_types/address.ts b/packages/utils/src/abi_encoder/evm_data_types/address.ts index 9ae22bd9c..84f6665cb 100644 --- a/packages/utils/src/abi_encoder/evm_data_types/address.ts +++ b/packages/utils/src/abi_encoder/evm_data_types/address.ts @@ -34,17 +34,17 @@ export class Address extends PayloadDataType { if (!value.startsWith('0x')) { throw new Error(Address.ERROR_MESSAGE_ADDRESS_MUST_START_WITH_0X); } - const valueAsBuffer = ethUtil.toBuffer(value); - if (valueAsBuffer.byteLength !== Address._ADDRESS_SIZE_IN_BYTES) { + const valueBuf = ethUtil.toBuffer(value); + if (valueBuf.byteLength !== Address._ADDRESS_SIZE_IN_BYTES) { throw new Error(Address.ERROR_MESSAGE_ADDRESS_MUST_BE_20_BYTES); } - const encodedValueBuf = ethUtil.setLengthLeft(valueAsBuffer, Constants.EVM_WORD_WIDTH_IN_BYTES); + const encodedValueBuf = ethUtil.setLengthLeft(valueBuf, Constants.EVM_WORD_WIDTH_IN_BYTES); return encodedValueBuf; } public decodeValue(calldata: RawCalldata): string { - const paddedValueBuf = calldata.popWord(); - const valueBuf = paddedValueBuf.slice(Address._DECODED_ADDRESS_OFFSET_IN_BYTES); + const valueBufPadded = calldata.popWord(); + const valueBuf = valueBufPadded.slice(Address._DECODED_ADDRESS_OFFSET_IN_BYTES); const value = ethUtil.bufferToHex(valueBuf); return value; } |