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

feat(gno/daokit): new dao sdk pkg (conditions based w/ roles) #1487

Merged
merged 44 commits into from
Feb 8, 2025

Conversation

MikaelVallenet
Copy link
Member

@MikaelVallenet MikaelVallenet commented Jan 7, 2025

DAO Roles & Conditions Based

This Pull Request follows the discussion between zooma, norman and myself to define the management of votes on DAOs that have a role system.

This PR implements the chosen solution, which is that in order to be validated, a vote must fulfill a set of conditions (see #1479) that are defined by the DAO. Each resource/action that the DAO can perform has a linked set of conditions (example: posting an article on the social feed might require validation by 1 community manager and 2 members).


Implementation choices

I decided to implement this under a single package that communicates with the conditions package & the role manager package.

The DAO is simple to create, which makes it easier for the user to generate contracts during deployment.

DAO example: https://github.com/TERITORI/teritori-dapp/blob/d221981f1ef875376a163eb5caeadf4c87bb59ec/gno/r/dao_realm/dao_realm.gno

Conditions & resources are sent in JSON format as this is easier to write/generate in my opinion.

Using the DAO

Once the DAO contract has been deployed, there are four ways to interact with it: new proposal, vote, execute & instant execute.
All four actions require DAO membership.

Gnoweb UI

The Gnoweb interface has 5 pages

Home Page
image

Config Page (Roles & Resources of the org.)
image

Member Detail Page (List role of a member)
image

Proposal Detail Page
image

List all proposals
image

@MikaelVallenet MikaelVallenet self-assigned this Jan 7, 2025
Copy link

netlify bot commented Jan 7, 2025

Deploy Preview for teritori-dapp ready!

Name Link
🔨 Latest commit f6f27b2
🔍 Latest deploy log https://app.netlify.com/sites/teritori-dapp/deploys/67a4e07b2e4e5500085f729e
😎 Deploy Preview https://deploy-preview-1487--teritori-dapp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Jan 7, 2025

Deploy Preview for gno-dapp ready!

Name Link
🔨 Latest commit f6f27b2
🔍 Latest deploy log https://app.netlify.com/sites/gno-dapp/deploys/67a4e07bf56a820008673fa3
😎 Deploy Preview https://deploy-preview-1487--gno-dapp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@MikaelVallenet MikaelVallenet changed the title feat(organizations): new contract explo w/ conditions feat(gno/organizations): new dao pkg w/ roles & conditions integrations Jan 12, 2025
@MikaelVallenet
Copy link
Member Author

ADD unit test & link to vote or execute when the proposal is ready to be execute
Add a link to add a proposal from the UI

@MikaelVallenet MikaelVallenet marked this pull request as ready for review January 13, 2025 10:19
}

proposal.state.HandleEvent(e, proposal.votes)
proposal.votes[voter.String()] = daocond.Vote(vote)
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe a bad idea, but what do you think of handling the vote record inside the p realm ? like that is not resposability of the realm caller to register that vote.

If the vote is not registered it could lead to bugs right ? (for example we could be able to vote multiple times )

Copy link
Member Author

@MikaelVallenet MikaelVallenet Jan 29, 2025

Choose a reason for hiding this comment

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

I disagree, i don't see any advantage to let the realm handle the voting records
I think we should have minimal realm and abstract all dao related logic in the daokit package

panic("proposal not found")
}

if proposal.status != ProposalStatusOpen {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Something to discuss during our point:
State and status seems like too close one to another maybe we need to rename one or another

Copy link
Member Author

Choose a reason for hiding this comment

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

condition state

@MikaelVallenet MikaelVallenet changed the title feat(gno/organizations): new dao pkg w/ roles & conditions integrations feat(gno/daokit): new dao sdk pkg (conditions based w/ roles) Jan 30, 2025
@n0izn0iz n0izn0iz merged commit 30e9edd into main Feb 8, 2025
21 of 23 checks passed
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