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);
Description | Parameters | Returns | Modifiers |
---|---|---|---|
Encodes DataPoint | registry : Address of the DataPoint Registryid : 32-bit DataPoint ID | Encoded DataPoint | internal , view |
2. decode()
function decode(DataPoint dp) internal pure returns (uint32 chainid, address registry, uint32 id);
Description | Parameters | Returns | Modifiers |
---|---|---|---|
Decodes DataPoint | dp : DataPoint to decode | chainid : Chain IDregistry : Registry Addressid : 32-bit DataPoint ID | internal , pure |