Utils
PatchworkUtils
Helper functions
import”@patchwork/contracts/PatchworkUtils/PatchworkUtils.sol”;
Functions
toString8
Converts uint64 raw data to an 8 character string
Parameters
Name | Type | Description |
---|---|---|
raw | uint64 | the raw data |
Returns
Name | Type | Description |
---|---|---|
out | string | the string |
toString16
Converts uint128 raw data to a 16 character string
Parameters
Name | Type | Description |
---|---|---|
raw | uint128 | the raw data |
Returns
Name | Type | Description |
---|---|---|
out | string | the string |
toString32
Converts uint256 raw data to a 32 character string
Parameters
Name | Type | Description |
---|---|---|
raw | uint256 | the raw data |
Returns
Name | Type | Description |
---|---|---|
out | string | the string |
trimUp
Trims a raw string to its null-terminated length
Parameters
Name | Type | Description |
---|---|---|
byteArray | bytes | the raw string |
Returns
Name | Type | Description |
---|---|---|
out | string | the trimmed string |
convertUint16ToBytes
Converts a uint16 into a 2-byte array
Parameters
Name | Type | Description |
---|---|---|
input | uint16 | the uint16 |
Returns
Name | Type | Description |
---|---|---|
<none> | bytes | bytes the array |
strToUint256
Converts a string to a uint256
Parameters
Name | Type | Description |
---|---|---|
str | string | the string to convert |
Returns
Name | Type | Description |
---|---|---|
val | uint256 | the uint256 value |