BaseDataObject
Base contract for DataObject implementations
This contract provides the basic storage of DataPoint data as identifiers and associated Data Index implementation. It also provides internal functions for DataObjects to manage the DataPoint data and the read and write functionality for Data Index implementations to interact with the DataObject
IncorrectDataIndexImplementationAddress
Error thrown when the proposed address is not the Data Index implementation
Parameters
Name | Type | Description |
---|---|---|
dataIndexImpl | address | The Data Index implementation |
DataIndexImplementationNotSet
Error thrown when there is no DataIndex implementation for a DataPoint
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | The DataPoint identifier |
InvalidCaller
Error thrown when the msg.sender is not the expected caller
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | The DataPoint identifier |
sender | address | The msg.sender address |
DiidDataUnavailable
Error thrown when the DiidData is not found
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | The DataPoint identifier |
diid | bytes32 | The user Data Index id |
NativePaymentNotSupported
Error thrown when the native payment is not supported
WrongOperationArguments
Error thrown when the operation arguments are wrong
UnknownReadOperation
Error thrown when the read operation is unknown
Parameters
Name | Type | Description |
---|---|---|
selector | bytes4 | The operation selector |
UnknownWriteOperation
Error thrown when the write operation is unknown
Parameters
Name | Type | Description |
---|---|---|
selector | bytes4 | The operation selector |
DefaultDataIndexImplementationSet
Event emitted when default Data Index implementation is set
Parameters
Name | Type | Description |
---|---|---|
dataIndexImplementation | address | The Data Index implementation address |
DataIndexImplementationSet
Event emitted when the Data Index implementation is set
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | The DataPoint identifier |
dataIndexImplementation | address | The Data Index implementation address |
DataPointStorage
Data structure to store DataPoint data
Parameters
Name | Type | Description |
---|
defaultDataIndex
DataIndex implementation to be used if none is set for DataPoint. Zero address is valid and prevents usage of such DataPoints
onlyDataIndex
Modifier to check if the caller is the Data Index implementation which is set for the DataPoint, or the default one.
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | The DataPoint identifier |
constructor
setDefaultDataIndexImplementation
Set default DataIndex implementation, which should be used if none is set for a DataPoint
NOTE: zero address is valid and can be used to dissalow usage of such DataPoints
Parameters
Name | Type | Description |
---|---|---|
newImpl | address | Address DataIndex implementations |
setDataIndexImplementation
This function SHOULD be called by the Data Index Implementation OR DataPoint Admin
Initializes DataPoint with provided Data Index implementation or changes current implementation to another one
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | DataPoint to work with |
newImpl | address | New Data Index Implementation |
read
Reads stored data
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | Identifier of the DataPoint |
operation | bytes4 | Read operation to execute on the data |
data | bytes | Operation-specific data |
Return Values
Name | Type | Description |
---|---|---|
[0] | bytes | Operation-specific data |
write
Stores data
Access to this function MUST be protected and allowed only for Data Index Implementation registered for this DataPoint
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | Identifier of the DataPoint |
operation | bytes4 | Write operation to execute on the data |
data | bytes | Operation-specific data |
Return Values
Name | Type | Description |
---|---|---|
[0] | bytes | Operation-specific data (can be empty) |
withdrawNativeBalance
Function to withdraw locked native balance
_dispatchRead
_dispatchWrite
_setDataIndexImplementation
_dataIndex
_tryDataIndex
_diid
_tryDiid
_dpDataIndex
_tryDpDataIndex
Returns 0 if index is not created
_diidDataIndex
_diidHasData
_moveDataIndexIfTargetEmpty
_tryDiidDataIndex
Returns 0 if index is not created
_requireDataIndexImplIsValid
_isDataPointAdmin
_handleNativePaymentInWrite
Override this function to support native coin payment for write() call