-
Notifications
You must be signed in to change notification settings - Fork 20
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
base: main
Are you sure you want to change the base?
Conversation
@rk-rishikesh thank you for contributing! we will take a look soon 💙 |
This might be a good foundation for https://www.notion.so/pl-strflt/Filecoin-State-Persistence-DAO-e6ae423e20f74d4abed32418a3414001#9ecf5f44c8cb4ccc8b5111f2dfa9bf9c |
There was a problem hiding this 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"; |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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.
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.