-
Notifications
You must be signed in to change notification settings - Fork 375
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
base: master
Are you sure you want to change the base?
feat: DAO SDK #1925
Conversation
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>
Signed-off-by: Norman Meier <norman@samourai.coop>
Thanks for the review @leohhhn, I addressed your comments I have two remarks to spark discussion around guidelines:
|
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>
…alm name Signed-off-by: Norman Meier <norman@samourai.coop>
impressive work, keep grinding |
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.
Left some minor suggestions to the docs page. Otherwise we should be good to go.
Sorry for the delay, and great work.
Co-authored-by: Leon Hudak <33522493+leohhhn@users.noreply.github.com>
Co-authored-by: Leon Hudak <33522493+leohhhn@users.noreply.github.com>
@@ -12,3 +16,14 @@ func (aon AddressOrName) GetName() (string, bool) { | |||
} | |||
return "", false | |||
} | |||
|
|||
func (aon AddressOrName) IsValid() bool { |
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.
what about using users.Resolve(aon).IsValid()
?
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.
can't call the realm method users.Resolve
from a p
package
@@ -0,0 +1,133 @@ | |||
package havl |
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.
can you add more info about what is this package about?
it looks like something that should be located in p/demo/havl
.
and add some tests.
-> could eventually have it's own PR.
@@ -0,0 +1,7 @@ | |||
module gno.land/p/demo/dao_maker/jsonutil |
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.
The current p/demo/json
library should be suitable for your needs.
I'm against having any JSON library written in userland because I expect that we can use @gfanton's #1776 and avoid any boilerplate code that isn't either for humans (rendering) or for other contracts (imports). Generally, anything about marshalling doesn't fall into these categories.
In the meantime, you can reuse the existing JSON library if needed. However, as soon as possible, I expect we can delete it completely. Additionally, if possible, I expect we don't merge any new JSON library in the meantime.
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.
this extends p/demo/json
func (v *VotingGroup) Render(path string) string { | ||
sb := strings.Builder{} | ||
sb.WriteString("Member count: ") | ||
sb.WriteString(strconv.FormatUint(uint64(v.MemberCount(havl.Latest)), 10)) |
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.
sb.WriteString(strconv.FormatUint(uint64(v.MemberCount(havl.Latest)), 10)) | |
sb.WriteString(ufmt.Sprintf("%d", havl.Latest)) |
g.powerByAddr.Iterate(start, end, height, func(k string, v interface{}) bool { | ||
if limit > 0 && uint64(len(members)) >= limit { | ||
return true | ||
} |
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 can use avl.Tree.IterateByOffset
.
} | ||
|
||
func (g *VotingGroup) MemberCount(height int64) uint32 { | ||
val, ok := g.memberCount.Get("", height) |
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.
isn't avl.Tree.Size
enough for you?
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.
can you move this to gno.land/r/teritori/tori
?
type ExecutableMessage interface { | ||
ToJSON() *json.Node | ||
FromJSON(ast *json.Node) | ||
|
||
String() string | ||
Type() string | ||
} |
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.
why is this needed?
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.
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).
from gnolang/gno#1925 Signed-off-by: Norman Meier <norman@samourai.coop>
* 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>
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:
gno.land/p/demo/dao_maker/dao_interfaces
gno.land/p/demo/dao_maker/dao_core
gno.land/p/demo/dao_maker/dao_voting_group
gno.land/p/demo/dao_maker/dao_proposal_single
gno.land/r/demo/dao_maker/dao_realm
gno.land/r/demo/dao_maker/dao_registry
For usage see the tutorial, it is integrated into docusaurus
There is an example membership-based DAO at
gno.land/r/demo/teritori/dao_realm
that can administer itself and a grc20 token atgno.land/r/demo/teritori/tori
Here is it's GnoWeb Render:
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.
Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description