Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataDAO Example Contract #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rk-rishikesh
Copy link

I have added an actor for a simple Data DAO with a client that adds CIDs through a voting mechanism. This actor can be deployed on Wallaby Testnet using Remix IDE and one would be able to directly interact with the actor using Remix IDE.

@jennijuju
Copy link
Contributor

@rk-rishikesh thank you for contributing! we will take a look soon 💙

@jennijuju
Copy link
Contributor

jennijuju commented Nov 25, 2022

Copy link
Contributor

@ZenGround0 ZenGround0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this, great work. I left some cleanup suggestions, if you don't get to them in a few days I'll add them in and then merge.

Random musings for the future, maybe it makes sense to abstract out the basic deal client functionality into a contract that other contracts can call making a mini framework? So for example this contract would call addCID and expose proposalOK method to be called by deal client contract. This way we would need way less copy paste. Probably too early to actually do this but fyi @jennijuju

import {specific_authenticate_message_params_parse, specific_deal_proposal_cbor_parse} from "./CBORParse.sol";

// import "https://github.com/foundry-rs/forge-std/blob/5bafa16b4a6aa67c503d96294be846a22a6f6efb/src/StdStorage.sol";
// import "https://github.com/lotus-web3/client-contract/blob/main/src/CBORParse.sol";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these

// import "https://github.com/lotus-web3/client-contract/blob/main/src/CBORParse.sol";


contract MockMarket {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need this here, its in the DealClient solidity file, please remove

function upvoteCIDProposal(uint256 proposalID) public {
require(!isCallerSP(proposalID), "Storage Provider cannot vote his own proposal");
require(!hasVotedForProposal[msg.sender][proposalID], "Already Voted");
require(isVotingOn(proposalID), "Voting Period Finished");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you could extract these checks into a little subfuction: voteValid

}

function policyOK(uint256 proposalID) internal view returns (bool) {
//require(proposals[proposalID].proposalExpireAt > block.timestamp, "Voting in On");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be < so that we only allow proposals that have expired their voting phase to pass the policy check. I think this prevents a single upvoter from rushing through a proposal.

But for now delete this pseudo code and if you want to indicate this as a future direction spell it out more clearly in a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants