Skip to main content

DataPoints Library

DataPoints is a library designed to assist smart contracts in processing, encoding, and decoding Data Points. We use a value type called DataPoint, which refers to a bytes32 structure that encapsulates four fields.

type DataPoint is bytes32;

Methods

The structure described in the contract's comments will be encoded using the following method:

1. encode()

function encode(address registry, uint32 id) internal view returns (DataPoint);
DescriptionParametersReturnsModifiers
Encodes DataPointregistry: Address of the DataPoint Registry
id: 32-bit DataPoint ID
Encoded DataPointinternal, view

2. decode()

function decode(DataPoint dp) internal pure returns (uint32 chainid, address registry, uint32 id);
DescriptionParametersReturnsModifiers
Decodes DataPointdp: DataPoint to decodechainid: Chain ID
registry: Registry Address
id: 32-bit DataPoint ID
internal, pure