Merge pull request #138 from sc0Vu/fix-dynamic-bytes
Fix DynamicBytes.php
This commit is contained in:
commit
b0615caf03
@ -66,7 +66,7 @@ class DynamicBytes extends SolidityType implements IType
|
|||||||
// if (mb_strlen($value) % 2 !== 0) {
|
// if (mb_strlen($value) % 2 !== 0) {
|
||||||
// throw new InvalidArgumentException('The value to inputFormat has invalid length.');
|
// throw new InvalidArgumentException('The value to inputFormat has invalid length.');
|
||||||
// }
|
// }
|
||||||
$bn = Utils::toBn(mb_strlen($value) / 2);
|
$bn = Utils::toBn(floor(mb_strlen($value) / 2));
|
||||||
$bnHex = $bn->toHex(true);
|
$bnHex = $bn->toHex(true);
|
||||||
$padded = mb_substr($bnHex, 0, 1);
|
$padded = mb_substr($bnHex, 0, 1);
|
||||||
|
|
||||||
@ -98,4 +98,4 @@ class DynamicBytes extends SolidityType implements IType
|
|||||||
|
|
||||||
return '0x' . mb_substr($value, 64, $length);
|
return '0x' . mb_substr($value, 64, $length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user