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/dao): add social feed message create post daokit for govdao #1509

Merged
merged 34 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
52fd5ce
feat: export functions daokit
MikaelVallenet Feb 11, 2025
8114e90
feat: add t1 & t2 conditions
MikaelVallenet Feb 11, 2025
f9ed92b
feat: update
MikaelVallenet Feb 12, 2025
c27a77a
feat: add messages
MikaelVallenet Feb 12, 2025
3929c8d
feat: update
MikaelVallenet Feb 13, 2025
c4439c1
fix: dao
MikaelVallenet Feb 13, 2025
b52ef34
fix: dao
MikaelVallenet Feb 13, 2025
8f42eb7
feat: add invitations system for T3
MikaelVallenet Feb 13, 2025
d697d41
feat: add withdrawal mechanism for T3
MikaelVallenet Feb 13, 2025
84e0342
feat: add limit size membership for T2
MikaelVallenet Feb 14, 2025
8c2416e
feat: rename msg
MikaelVallenet Feb 14, 2025
4fa1ed6
chore: up
MikaelVallenet Feb 14, 2025
d4cf516
feat: add configurables roles for govdao
MikaelVallenet Feb 14, 2025
48a3253
feat: wip adapt govdao condition
MikaelVallenet Feb 15, 2025
db0f641
feat: merge main
MikaelVallenet Feb 15, 2025
fd61c96
feat: merge refactor and adapt code
MikaelVallenet Feb 15, 2025
d246194
feat: merge main
MikaelVallenet Feb 15, 2025
f4a1015
fix: review
MikaelVallenet Feb 15, 2025
c17d5db
fix: enhance comments
MikaelVallenet Feb 15, 2025
5b23f8a
Merge branch 'dev/gno/gov-dao-t3-membership' into dev/gno/handle-t3-a…
MikaelVallenet Feb 15, 2025
5863cd9
fix: use roles
MikaelVallenet Feb 15, 2025
9a87559
Merge branch 'dev/gno/gov-dao-t3-membership' into dev/gno/handle-t3-a…
MikaelVallenet Feb 15, 2025
d0014b3
feat: adapt govdao conditions
MikaelVallenet Feb 15, 2025
de9c380
feat: abstain T3 from voting
MikaelVallenet Feb 15, 2025
8c3a02a
feat: adapt test
MikaelVallenet Feb 17, 2025
a4f4b2d
fix: test
MikaelVallenet Feb 17, 2025
8fff4a8
feat: merge main
MikaelVallenet Feb 17, 2025
fd485b4
fix: adapt to latest changes
MikaelVallenet Feb 17, 2025
f360da2
fix: remove useless duplicate declaration
MikaelVallenet Feb 17, 2025
fd8ba17
feat: enhance render
MikaelVallenet Feb 17, 2025
799a392
feat: add social feed daokit message for govdao
MikaelVallenet Feb 17, 2025
3756252
feat: merge main
MikaelVallenet Feb 18, 2025
be44e24
feat: remove event
MikaelVallenet Feb 18, 2025
f69662f
feat: remove T3 from initialization
MikaelVallenet Feb 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gno/p/basedao/render.gno
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const (
PROPOSAL_HISTORY_PATH = "history"
MEMBER_DETAIL_PATH = "member/{address}"
PROPOSAL_DETAIL_PATH = "proposal/{id}"
FALLBACK_DISPLAY_NAME = "Anon"
FALLBACK_DISPLAY_NAME = "Anon"
)

func (d *DAO) initRenderingRouter() {
Expand Down
9 changes: 6 additions & 3 deletions gno/r/govdao/govdao.gno
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"gno.land/p/teritori/role_manager"
"gno.land/r/demo/profile"
"gno.land/r/teritori/ghverify"
"gno.land/r/teritori/social_feeds"
)

const (
Expand All @@ -32,9 +33,6 @@ func init() {
{Address: "g126gx6p6d3da4ymef35ury6874j6kys044r7zlg", Roles: []string{Tier1}},
{Address: "g1ld6uaykyugld4rnm63rcy7vju4zx23lufml3jv", Roles: []string{Tier2}},
{Address: "g1r69l0vhp7tqle3a0rk8m8fulr8sjvj4h7n0tth", Roles: []string{Tier2}},
{Address: "g1ns5vfj5app8sqqgc5jzst79rmahws8p9asfryd", Roles: []string{Tier3}},
{Address: "g1jkfwvm7pxr65r75tnyzt0s8k6cfjjdh7533q35", Roles: []string{Tier3}},
{Address: "g16jv3rpz7mkt0gqulxas56se2js7v5vmc6n6e0r", Roles: []string{Tier3}},
}
dao = basedao.New(&basedao.Config{
Name: "GovDAO",
Expand All @@ -48,6 +46,7 @@ func init() {
Members: basedao.NewMembersStore(initialRoles, initialMembers),
SetProfileString: profile.SetStringField,
GetProfileString: profile.GetStringField,
NoEvents: true,
})

// XXX: t1Supermajority won't work because daocond.RoleThreshold uses events
Expand All @@ -68,6 +67,10 @@ func init() {
Handler: basedao.NewEditProfileHandler(profile.SetStringField, nil),
Condition: supermajority,
},
{
Handler: social_feeds.NewCreatePostDaokitHandler(),
Condition: supermajority,
},
}
for _, r := range resources {
dao.Core.SetResource(r)
Expand Down
37 changes: 37 additions & 0 deletions gno/r/social_feeds/messages_daokit.gno
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package social_feeds

import (
"gno.land/p/demo/ufmt"
"gno.land/p/teritori/daokit"
)

const MsgCreatePostDaokitKind = "gno.land/r/teritori/social_feeds.CreatePost"

type MsgCreatePostDaokit struct {
FeedID FeedID
ParentID PostID
Category uint64
Metadata string
}

func (m *MsgCreatePostDaokit) String() string {
buf := ""
buf += ufmt.Sprintf("Create post in feed %s", m.FeedID.String())
if m.ParentID != 0 {
buf += ufmt.Sprintf(" as a reply to post %s", m.ParentID.String())
}
buf += ufmt.Sprintf(" with category %d", m.Category)
buf += ufmt.Sprintf(" and metadata %s", m.Metadata)
return buf
}

func NewCreatePostDaokitHandler() daokit.MessageHandler {
return daokit.NewMessageHandler(MsgCreatePostDaokitKind, func(msg interface{}) {
message := msg.(*MsgCreatePostDaokit)
CreatePost(message.FeedID, message.ParentID, message.Category, message.Metadata)
})
}

func NewCreatePostDaokitMsg(payload *MsgCreatePostDaokit) daokit.ExecutableMessage {
return daokit.NewMessage(MsgCreatePostDaokitKind, payload)
}
Loading