Stream Manager manages the stream approval and creation, validator list, and refunds when necessary.
Per contract creation, contract version is added by constructor.
function addValidator(address v) public onlyOwner
Manager can add validators. Function requires that the address was not already added and that it's non-zero address.
function removeValidator(address v) public onlyOwner
Manager can remove validators. Function requires that the address was previously added and that it's non-zero address.
function isValidator(address v) public view returns (bool)
Query whether a certain address is a validator
function requestStream(uint256 streamId, string memory profileNames) public returns (uint256)
Users can request new streams.
Function requires that the client account has not made a request with the same stream id before and that the array of profiles is non empty.
Upon completion function emits event
StreamRequestedand returns Stream ID
function approveStreamCreation(uint256 streamId) public onlyOwner
Manager can review stream requests, add extra data and approve them. Function requires that the request has been registered before.
function createStream(uint256 streamId) public payable returns (address)
After approval the client can create the stream. Also the client needs to fund the stream contract upon creation.
Function requires that the request is approved. Caller is the same account that registered the request and that the stream has not already been created.
function addInputChunkId(uint256 streamId, uint256 chunkId, uint256 memory wattages) public onlyOwner
Registers a new input chunk id with the given stream. Called by manager for now. Method is called as input chunk ids are created.
Function requires that the stream corresponding to this id was already created. The array of wattages/rewards should be non-empty
function endStream(uint256 streamId) public
Signals that a stream has ended and no more input chunks are available. Can be called by manager or client(owner of the stream).
Function requires that the stream was not already ended.
function refundAllowed(uint256 streamId) public view returns (bool)
Can query whether a client can refund the coins from a stream contract.
function allowRefund(uint256 streamId) public onlyOwner
Manager can allow client refunds. Requested stream id must be available.
function revokeRefund(uint256 streamId) public onlyOwner
Manager can revoke refund permission.