Skip to content

Commit

Permalink
fix: work around concat bug
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulstra committed Oct 3, 2023
1 parent e45aff4 commit 6bfb027
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/utils/storageSlots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,8 @@ export function getDynamicArraySlot(baseSlot: bigint, arrayIndex: number, itemSi
export function getBytesValue(value: string | Hex) {
const bytesString = toBytes(value);
if (bytesString.length > 31) throw new Error('Error: strings > 31 bytes are not implemented');
return concat([toHex(pad(bytesString, { size: 31, dir: 'right' })), toHex(bytesString.length * 2, { size: 1 })]);
return pad(
concat([toHex(pad(bytesString, { size: 31, dir: 'right' })), toHex(bytesString.length * 2, { size: 1 })]),
{ size: 32 }
);
}

0 comments on commit 6bfb027

Please sign in to comment.