DataDAO is an organization that curates data stored in Filecoin, allowing its members to vote on the CIDs that should be part of the collection of curated data.
There has been increased demand for useful data on the Filecoin network. Allowing peers to vote on CIDs that contain this type of data incentivizes more quality of data in Filecoin.
Non-goals
We are not trying to ensure that the accepted CIDs actually have "useful" data (whatever the definition of "useful" is). We only allow for voting. It is up to the members of the organization to revise the contents of the proposals and vote wisely.
Design Overview
Storage Provider (SP) creates a proposal to add a CID to DataDAO.
DataDAO members vote on the proposal until it expires.
Once expired, if upvotes > downvotes, the CID is added to the DataDAO.
Detailed Design
Another level of detail beyond the design overview, if needed.
Creating Proposal
SP will create a proposal using the following function
function voteCIDProposal(uint256 proposalID, bool upvote) public {
require(proposals[proposalID].storageProvider != msg.sender, "Storage Provider cannot vote his own proposal");
require(!hasVotedForProposal[msg.sender][proposalID], "Already Voted");
require(!votingIsExpired(proposalID), "Voting Period Finished");
if (upvote == true) {
proposals[proposalID].upVoteCount = proposals[proposalID].upVoteCount + 1;
} else {
proposals[proposalID].downVoteCount = proposals[proposalID].downVoteCount + 1;
}
hasVotedForProposal[msg.sender][proposalID] = true;
}
Add voted CID to DataDAO
TODO
Miscellaneous
Data and auxiliary variables
contract DataDAO {
uint64 constant public AUTHORIZE_MESSAGE_METHOD_NUM = 2643134072;
// number of proposals currently in DAO
uint256 public proposalCount;
// mapping to check whether the cid is set for voting
mapping(bytes => bool) public cidSet;
// storing the size of the cid
mapping(bytes => uint) public cidSizes;
mapping(bytes => mapping(bytes => bool)) public cidProviders;
// address of the owner of DataDAO
address public immutable owner;
struct Proposal {
uint256 proposalID;
address storageProvider;
bytes cidraw;
uint size;
uint256 upVoteCount;
uint256 downVoteCount;
uint256 proposedAt;
uint256 proposalExpireAt;
}
// mapping to keep track of proposals
mapping(uint256 => Proposal) public proposals;
// mapping array to track whether the user has voted for the proposal
mapping(address => mapping(uint256 => bool)) public hasVotedForProposal;
/**
* @dev constructor: to set the owner address
*/
constructor(address _owner) {
require(_owner != address(0), "invalid owner!");
owner = _owner;
}
Check if voting time has expired
function votingIsExpired(uint256 proposalID) view public returns(bool) {
return proposals[proposalID].proposalExpireAt <= block.timestamp;
}
Proposal: DataDAO
Proposal/Overview
DataDAO is an organization that curates data stored in Filecoin, allowing its members to vote on the CIDs that should be part of the collection of curated data.
Obs: heavily inspired in idea and code snippets from https://aayushguptaji.hashnode.dev/how-to-build-your-first-datadao-factory-on-fvm
Why this is important
There has been increased demand for useful data on the Filecoin network. Allowing peers to vote on CIDs that contain this type of data incentivizes more quality of data in Filecoin.
Non-goals
We are not trying to ensure that the accepted CIDs actually have "useful" data (whatever the definition of "useful" is). We only allow for voting. It is up to the members of the organization to revise the contents of the proposals and vote wisely.
Design Overview
Detailed Design
Another level of detail beyond the design overview, if needed.
Creating Proposal
SP will create a proposal using the following function
Voting on a Proposal
DataDAO members upvote or downvote the Proposal
Add voted CID to DataDAO
TODO
Miscellaneous
Data and auxiliary variables
Check if voting time has expired
https://github.com/application-research/estuary/issues/880