ByteParser
ByteParser
Helpful byte utility functions. Returns decoded CBOR values as their proper types.
MAX_UINT64
uint256 MAX_UINT64
bytesToUint64
function bytesToUint64(bytes data) public pure returns (uint64 value)
Converts a CBOR dynamic bytes array to a uint64
| Name | Type | Description |
|---|---|---|
| data | bytes | dynamic bytes array |
| Name | Type | Description |
|---|---|---|
| value | uint64 | calculated uint64 value |
bytesToNegativeInt128
function bytesToNegativeInt128(bytes data) public pure returns (int128 value)
Converts a CBOR dynamic bytes array to an int128
| Name | Type | Description |
|---|---|---|
| data | bytes | dynamic bytes array |
| Name | Type | Description |
|---|---|---|
| value | int128 | calculated uint64 value |
bytesToString
function bytesToString(bytes data) public pure returns (string value)
Converts a CBOR dynamic bytes array to a string
| Name | Type | Description |
|---|---|---|
| data | bytes | dynamic bytes array |
| Name | Type | Description |
|---|---|---|
| value | string | converted string object |
bytesToBigNumber
function bytesToBigNumber(bytes data) public pure returns (uint256 value)
Converts a CBOR dynamic bytes array to a uint256
| Name | Type | Description |
|---|---|---|
| data | bytes | dynamic bytes array |
| Name | Type | Description |
|---|---|---|
| value | uint256 | calculated uint256 value |
bytesToBool
function bytesToBool(bytes data) public pure returns (bool value)
Converts a CBOR dynamic bytes array to a bool
| Name | Type | Description |
|---|---|---|
| data | bytes | dynamic bytes array |
| Name | Type | Description |
|---|---|---|
| value | bool | calculated bool value |
parseAddr
function parseAddr(bytes data) public pure returns (address value)
Converts a CBOR dynamic bytes array to an address type
| Name | Type | Description |
|---|---|---|
| data | bytes | dynamic bytes array |
| Name | Type | Description |
|---|---|---|
| value | address | translated address |