MasterStreamDataSpotter

FinalizedData

struct FinalizedData {
  uint256 timestamp;
  bytes finalizedData;
}

MasterStreamDataSpotter

MasterStreamDataSpotter__OnlyDataSpotter

error MasterStreamDataSpotter__OnlyDataSpotter()

MasterStreamDataSpotter__OnlyDataSpotterFactory

error MasterStreamDataSpotter__OnlyDataSpotterFactory()

MasterStreamDataSpotter__DataKeyNotAllowed

error MasterStreamDataSpotter__DataKeyNotAllowed(bytes32)

DataFinalized

event DataFinalized(bytes32 protocolId, bytes32 sourceId, bytes32 dataKey, uint256 timestamp, bytes data, bytes32 newMerkleRoot)

ConsensusReadyToFinalize

event ConsensusReadyToFinalize(bytes32 protocolId, bytes32 sourceId, bytes32 dataKey)

ADMIN

bytes32 ADMIN

factory

contract StreamDataSpotterFactory factory

SpotterData

struct SpotterData {
  bytes32[] allowedKeys;
  bytes32 merkleRoot;
  mapping(bytes32 => struct FinalizedData) finalizedData;
}

spotterData

mapping(bytes32 => mapping(bytes32 => struct MasterStreamDataSpotter.SpotterData)) spotterData

initialize

function initialize(address[2] initAddr) public

Initializer

Parameters

NameTypeDescription

initAddr

address[2]

- 0: admin, 1: factory

_authorizeUpgrade

function _authorizeUpgrade(address) internal

_onlyDataSpotter

function _onlyDataSpotter() internal view

onlyDataSpotter

modifier onlyDataSpotter()

_onlyDataSpotterFactory

function _onlyDataSpotterFactory() internal view

onlyDataSpotterFactory

modifier onlyDataSpotterFactory()

setAllowedKeys

function setAllowedKeys(bytes32 protocolId, bytes32 sourceId, bytes32[] allowedKeys) external

factory function to set allowed keys for spotter

Parameters

NameTypeDescription

protocolId

bytes32

protocol id

sourceId

bytes32

source id

allowedKeys

bytes32[]

array of allowed dataKeys

checkIsAllowedKey

function checkIsAllowedKey(bytes32 protocolId, bytes32 sourceId, bytes32 dataKey) internal view returns (bool)

calcMerkleRoot

function calcMerkleRoot(bytes32[] merkleProofs) internal pure returns (bytes32)

Build the merkle tree from provided proofs and return the root

pushFinalizedData

function pushFinalizedData(bytes32 dataKey, struct FinalizedData data) external

Function for spotters to push their finalized data to proceed with aggregation

Parameters

NameTypeDescription

dataKey

bytes32

data key

data

struct FinalizedData

finalized data

declareConsensusReadyToFinalize

function declareConsensusReadyToFinalize(bytes32 protocolId, bytes32 sourceId, bytes32 dataKey) external

Function for spotters to declare consensus ready to finalize

called by any Stream Data Spotter contract

Parameters

NameTypeDescription

protocolId

bytes32

protocol id

sourceId

bytes32

source id

dataKey

bytes32

data key

getFinalizedData

function getFinalizedData(bytes32 protocolId, bytes32 sourceId, bytes32 dataKey) external view returns (struct FinalizedData)

get finalized data for specific sourceId and dataKey

Parameters

NameTypeDescription

protocolId

bytes32

protocol id

sourceId

bytes32

source id

dataKey

bytes32

data key

getAllowedKeys

function getAllowedKeys(bytes32 protocolId, bytes32 sourceId) external view returns (bytes32[])

Get allowed keys list for specific protocolId and sourceId

Parameters

NameTypeDescription

protocolId

bytes32

protocol id

sourceId

bytes32

source id

Last updated