Stream Contract
Stream contract represents a video transcode job created by a client. Input video stream is split into chunks. Miners transcode video chunks and submit proof for each chunk of each profile. Validators approve proof submitted by miners.

Constructor

1
constructor(uint256 _id, address payable client, uint256[] memory profiles) Escrow(client) public
Copied!
It takes the stream id, address of the client that created the stream and array of profiles requested by client. Stream contract is also an Escrow contract.

Add input chunk ID.

1
function addInputChunkId(uint256 chunkId, uint256[] memory wattage) public onlyManager
Copied!
Stream Manager will add more input chunkIds as they become available. Function is called only by the manager. Function requires chunkId which is not already registered from a stream that is alive.

End Stream

1
function endStream() public onlyManager
Copied!
Signals that the input stream has ended and no more input chunks are available.

Submit proof

1
function submitProof(uint256 profile, uint256 chunkId, uint256 proof, uint256 outChunkId) public
Copied!
Miners use the method to submit proofs & output chunkIds. Proofs of transcoding must be submitted for each input chunk for each each profile.
Emits event ChunkProofSubmited

Validate proof

1
function validateProof(uint256 profile, uint256 chunkId) public onlyValidator
Copied!
Validators use the method to validate the first proof available in the queue.
Emits event ChunkProofValidated

Scrap proof

1
function scrapProof(uint256 profile, uint256 chunkId) public onlyValidator
Copied!
Validators can scrap the first proof available in the queue if they consider so. This will increment the proofs queue head to point to the next proof. This would result in decrease in miner's reputation.
Emits event ChunkProofScrapped

Has Valid proof

1
function hasValidProof(uint256 profile, uint256 chunkId) public view returns (bool)
Copied!
Query whether the chunk has been validated.

Get valid proof

1
function getValidProof(uint256 profile, uint256 chunkId) public view
2
returns (address miner,
3
address validator,
4
uint256 outputChunkId,
5
uint256 proof)
Copied!
Returns the proof of a validated chunk. Requires that the proof has been validated.

Get candidate proof

1
function getCandidateProof(uint256 profile, uint256 chunkId) public view
2
returns (address miner,
3
uint256 outputChunkId,
4
uint256 proof)
Copied!
Returns the first proof candidate for validation/scraping. Validators should use this to query the current proof candidate before validating it.

Get proof count

1
function getProofCount(uint256 profile, uint256 chunkId) public view returns (uint256)
Copied!
Query proof count for given chunk&profile.

Get proof

1
function getProof(uint256 profile, uint256 chunkId, uint256 idx) public view
2
returns (address miner,
3
uint256 outputChunkId,
4
uint256 proof)
Copied!
Returns any proof that has been submitted for the given chunk & profile from the proof queue.

Is Transcoding Done

1
function isTranscodingDone() public view returns (bool)
Copied!
Query whether transcoding is done for the given input chunks for all profiles.

Is profile transcoded

1
function isProfileTranscoded(uint256 profile) public view returns (bool)
Copied!
Query whether transcoding is done for the given input chunks for given profile.

Get profiles

1
function getprofiles() public view returns (uint256[] memory)
Copied!
Query profile hashes; the hashes refer to the index array stored in the manager contract.

Get profile count

1
function getProfileCount() public view returns (uint256)
Copied!
Query profile count.

Get In chunks

1
function getInChunks() public view returns (uint256[] memory)
Copied!
Query input chunk ids.

Get in chunks count

1
function getInChunkCount() public view returns (uint256)
Copied!
Query input chunk count.

Get out chunks

1
function getOutChunks(uint256 profile) public view returns (uint256[] memory)
Copied!
Query output chunk ids.

Refund allowed

1
function refundAllowed() public view returns (bool)
Copied!
Query if refund is allowed.
Last modified 2yr ago