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: DAO SDK #1925

Closed
wants to merge 121 commits into from
Closed

feat: DAO SDK #1925

wants to merge 121 commits into from

Conversation

n0izn0iz
Copy link
Contributor

@n0izn0iz n0izn0iz commented Apr 12, 2024

This implement a DAO SDK inspired by DA0-DA0

The code in this PR has been extracted from #1154 and cleaned (reviews on the previous PR should have been addressed)

It includes:

  • Interfaces for the DAO gno.land/p/demo/dao_maker/dao_interfaces
  • A reference implementation for the core of the DAO gno.land/p/demo/dao_maker/dao_core
  • A membership-based voting module gno.land/p/demo/dao_maker/dao_voting_group
  • A single-choice proposal module gno.land/p/demo/dao_maker/dao_proposal_single
  • An example DAO gno.land/r/demo/dao_maker/dao_realm
  • A registry to dynamically interact with any registered DAO using it's address gno.land/r/demo/dao_maker/dao_registry

For usage see the tutorial, it is integrated into docusaurus

Screenshot 2024-04-12 at 18 41 10

There is an example membership-based DAO at gno.land/r/demo/teritori/dao_realm that can administer itself and a grc20 token at gno.land/r/demo/teritori/tori

Here is it's GnoWeb Render:
Screenshot 2024-04-12 at 18 28 41


This powers the "Organizations" feature of Teritori dApp on Gno as shown below

The DAO creation UI uses a Gno template and instantiates a new realm.

Screenshot 2024-04-12 at 18 43 23 Screenshot 2024-04-12 at 18 44 50 Screenshot 2024-04-12 at 18 44 15 Screenshot 2024-04-12 at 18 42 26
Contributors' checklist...
  • Added new tests, or not needed, or not feasible
  • Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • Updated the official documentation or not needed
  • No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • Added references to related issues and PRs
  • Provided any useful hints for running manual tests
  • Added new benchmarks to generated graphs, if any. More info here.

n0izn0iz added 30 commits April 10, 2024 19:11
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
Signed-off-by: Norman Meier <norman@berty.tech>
func (v *VotingGroup) Render(path string) string {
sb := strings.Builder{}
sb.WriteString("Member count: ")
sb.WriteString(strconv.FormatUint(uint64(v.MemberCount(havl.Latest)), 10))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
sb.WriteString(strconv.FormatUint(uint64(v.MemberCount(havl.Latest)), 10))
sb.WriteString(ufmt.Sprintf("%d", havl.Latest))

Comment on lines 138 to 141
g.powerByAddr.Iterate(start, end, height, func(k string, v interface{}) bool {
if limit > 0 && uint64(len(members)) >= limit {
return true
}
Copy link
Member

Choose a reason for hiding this comment

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

You can use avl.Tree.IterateByOffset.

}

func (g *VotingGroup) MemberCount(height int64) uint32 {
val, ok := g.memberCount.Get("", height)
Copy link
Member

Choose a reason for hiding this comment

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

isn't avl.Tree.Size enough for you?

Copy link
Member

Choose a reason for hiding this comment

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

can you move this to gno.land/r/teritori/tori?

Comment on lines 7 to 13
type ExecutableMessage interface {
ToJSON() *json.Node
FromJSON(ast *json.Node)

String() string
Type() string
}
Copy link
Member

Choose a reason for hiding this comment

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

why is this needed?

Copy link
Member

@moul moul left a comment

Choose a reason for hiding this comment

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

There are several interesting aspects in that PR, but there is too much work to review at the moment. Therefore, I will mark it as "request changes" to allow more time for a thorough review.

A high-level suggestion I can provide is to:

  • Simplify the codebase by reducing the number of packages, files, functions, types, and boilerplate, and avoiding the use of JSON, etc. Consider merging some packages together.
  • Improve the naming conventions. For instance, use more specific names like "Teritori Realms" and "Daomaker" (a better name could facilitate faster merging, as "Daomaker" is currently too generic and sounds overly official, while "Teritori" would make it easier to integrate).

@moul moul marked this pull request as draft July 8, 2024 01:12
n0izn0iz added a commit to TERITORI/teritori-dapp that referenced this pull request Sep 8, 2024
from gnolang/gno#1925

Signed-off-by: Norman Meier <norman@samourai.coop>
n0izn0iz added a commit to TERITORI/teritori-dapp that referenced this pull request Oct 9, 2024
* feat: dao_maker

from gnolang/gno#1925

Signed-off-by: Norman Meier <norman@samourai.coop>

* tmp

Signed-off-by: Norman Meier <norman@samourai.coop>

* chore: add back ujson and fix social feed

Signed-off-by: Norman Meier <norman@samourai.coop>

* chore: remove artifact

Signed-off-by: Norman Meier <norman@samourai.coop>

* chore: remove artifact

Signed-off-by: Norman Meier <norman@samourai.coop>

* chore: ci fix

Signed-off-by: Norman Meier <norman@samourai.coop>

* fix: revert bad change

Signed-off-by: Norman Meier <norman@samourai.coop>

---------

Signed-off-by: Norman Meier <norman@samourai.coop>
Copy link

github-actions bot commented Dec 8, 2024

This PR is stale because it has been open 3 months with no activity. Remove stale label or comment or this will be closed in 3 months.

@github-actions github-actions bot added the Stale label Dec 8, 2024
@moul
Copy link
Member

moul commented Dec 8, 2024

Can you move all the packages under {r,p}/teritori/... and relocate the docs/... into r/teritori/dao_maker/README.md?

I believe we should merge your PR in its current state but under teritori.

@Gno2D2 Gno2D2 requested review from a team December 8, 2024 12:28
@Gno2D2
Copy link
Collaborator

Gno2D2 commented Dec 8, 2024

🛠 PR Checks Summary

🔴 Maintainers must be able to edit this pull request (more info)

Manual Checks (for Reviewers):
  • SKIP: Do not block the CI for this PR
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

🔴 Maintainers must be able to edit this pull request (more info)
🟢 The pull request head branch must be up-to-date with its base (more info)

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Automated Checks
Maintainers must be able to edit this pull request (more info)

If

🟢 Condition met
└── 🟢 The pull request was created from a fork (head branch repo: TERITORI/gno)

Then

🔴 Requirement not satisfied
└── 🔴 Maintainer can modify this pull request

The pull request head branch must be up-to-date with its base (more info)

If

🟢 Condition met
└── 🟢 On every pull request

Then

🟢 Requirement satisfied
└── 🟢 Head branch (TERITORI:daosdk) is up to date with base (master): behind by 0 / ahead by 121

Manual Checks
**SKIP**: Do not block the CI for this PR

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission

@github-actions github-actions bot removed the Stale label Dec 9, 2024
MikaelVallenet and others added 10 commits December 17, 2024 15:42
Signed-off-by: Norman Meier <norman@samourai.coop>
Signed-off-by: Norman Meier <norman@samourai.coop>
Signed-off-by: Norman Meier <norman@samourai.coop>
Signed-off-by: Norman Meier <norman@samourai.coop>
Signed-off-by: Norman Meier <norman@samourai.coop>
This PR aims to fix some of remaining UI bugs on gnoweb after the revamp
merge.

Some of: gnolang#3355

- Fixes Safari select input design and icons
- Fixes input hover
- Fixes ToC font style
- Fixes UI details and improve CSS
- Fixes Responsive with long content
- Fixes Scrollbar
- Fixes fonts loading strategy and size
- Fixes ts issue with copy btn (quick clicks)
- Fixes some A11y
@n0izn0iz
Copy link
Contributor Author

closing in favor of #3358
will address reviews there

@n0izn0iz n0izn0iz closed this Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧾 package/realm Tag used for new Realms or Packages.
Projects
Status: Done
Status: Done
Status: No status
Development

Successfully merging this pull request may close these issues.

9 participants