-
Notifications
You must be signed in to change notification settings - Fork 443
feat(govdao): add proposal fee-based for non-member #4944
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
Open
Davphla
wants to merge
18
commits into
gnolang:master
Choose a base branch
from
Davphla:feat/govdao-fee
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+287
−47
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
70e6a10
feat(gnokey): add missing -send flag to maketx run
tbruyelle 25601e0
Merge branch 'master' into tbruyelle/feat/maketx-run-send
tbruyelle 6c95ed3
fix typo in comment
tbruyelle ea1804b
feat(govdao): made r/gov/dao proposals fee-based for non-members
Davphla 19a819a
fix(govdao): remove unecessary comment addition
Davphla 640b24f
feat(govdao): replace AbortsWithMessage with AbortsContains
Davphla a75dd70
fix(govdao): update error message for non-member proposal creation
Davphla 1dcd085
refactor(render): more consistent MembershipBadge usage
Davphla 44d0a1b
fix(render): correct non-member badge test assertion
Davphla 75ca012
refactor(govdao): remove useless comment
Davphla 3ac4368
Update examples/gno.land/r/gov/dao/v3/impl/govdao.gno
Davphla 856c91e
feat(govdao): add functionality to set and update proposal fee amount…
Davphla 2d60019
fix(test): remove unnecessary realm setting line
Davphla 9d35062
Merge branch 'tbruyelle/feat/maketx-run-send' into feat/govdao-fee
Davphla 9ce647e
refactor(govdao): remove useless function
Davphla afbb935
feat(govdao): add txtars
Davphla 3334b17
Merge branch 'master' into feat/govdao-fee
Davphla 288623b
feat(govdao): simplify txtar to test non-member
Davphla File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,6 @@ | ||
| package impl | ||
|
|
||
| import ( | ||
| "chain/runtime" | ||
|
|
||
| "gno.land/p/aeddi/panictoerr" | ||
| "gno.land/p/moul/md" | ||
| trs_pkg "gno.land/p/nt/treasury" | ||
|
|
@@ -14,11 +12,6 @@ import ( | |
| ) | ||
|
|
||
| func NewChangeLawRequest(_ realm, newLaw *Law) dao.ProposalRequest { | ||
| member, _ := memberstore.Get().GetMember(runtime.OriginCaller()) | ||
| if member == nil { | ||
| panic("proposer is not a member") | ||
| } | ||
|
|
||
| cb := func(_ realm) error { | ||
| law = newLaw | ||
| return nil | ||
|
|
@@ -30,11 +23,6 @@ func NewChangeLawRequest(_ realm, newLaw *Law) dao.ProposalRequest { | |
| } | ||
|
|
||
| func NewUpgradeDaoImplRequest(newDao dao.DAO, realmPkg, reason string) dao.ProposalRequest { | ||
| member, _ := memberstore.Get().GetMember(runtime.OriginCaller()) | ||
| if member == nil { | ||
| panic("proposer is not a member") | ||
| } | ||
|
|
||
| cb := func(_ realm) error { | ||
| // dao.UpdateImpl() must be cross-called from v3/impl but | ||
| // what calls this cb function is r/gov/dao. | ||
|
|
@@ -66,17 +54,7 @@ func NewAddMemberRequest(_ realm, addr address, tier string, portfolio string) d | |
| panic("A portfolio for the proposed member is required") | ||
| } | ||
|
|
||
| member, _ := memberstore.Get().GetMember(runtime.OriginCaller()) | ||
| if member == nil { | ||
| panic("proposer is not a member") | ||
| } | ||
|
|
||
| if member.InvitationPoints <= 0 { | ||
| panic("proposer does not have enough invitation points for inviting new people to the board") | ||
| } | ||
|
|
||
| cb := func(_ realm) error { | ||
| member.RemoveInvitationPoint() | ||
| err := memberstore.Get().SetMember(tier, addr, memberByTier(tier)) | ||
|
|
||
| return err | ||
|
|
@@ -209,6 +187,43 @@ func NewTreasuryGRC20TokensUpdate(newTokenKeys []string) dao.ProposalRequest { | |
| ) | ||
| } | ||
|
|
||
| // NewProposalFeeAmountRequest creates a proposal request to update the proposal fee amount | ||
| // required for non-members to create proposals. | ||
| func NewProposalFeeAmountRequest(newAmount int64, reason string) dao.ProposalRequest { | ||
| if newAmount < 0 { | ||
| panic("proposal fee amount must be non-negative") | ||
| } | ||
|
|
||
| if reason == "" { | ||
| panic("proposal fee amount change requires a reason") | ||
| } | ||
|
Comment on lines
+192
to
+199
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think we should add a txtar test flow of changing the proposal fee else the PR looks good to me i will approve once this done
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| cb := func(_ realm) error { | ||
| ProposalFeeAmount = newAmount | ||
| return nil | ||
| } | ||
|
|
||
| e := dao.NewSimpleExecutor( | ||
| cb, | ||
| ufmt.Sprintf( | ||
| "The proposal fee amount for non-members will be changed to %d ugnot.\n\nReason: %s", | ||
| newAmount, | ||
| reason, | ||
| ), | ||
| ) | ||
|
|
||
| return dao.NewProposalRequest( | ||
| "Proposal Fee Amount Change", | ||
| ufmt.Sprintf( | ||
| "This proposal is looking to change the proposal fee amount for non-members from %d ugnot to %d ugnot.\n\nReason: %s", | ||
| ProposalFeeAmount, | ||
| newAmount, | ||
| reason, | ||
| ), | ||
| e, | ||
| ) | ||
| } | ||
|
|
||
| func memberByTier(tier string) *memberstore.Member { | ||
| switch tier { | ||
| case memberstore.T1: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package impl | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "gno.land/p/nt/urequire" | ||
| ) | ||
|
|
||
| // TestRenderMembershipBadge verifies that the non-member badge is displayed correctly | ||
| func TestRenderMembershipBadge(t *testing.T) { | ||
| loadMembers() | ||
| dao := NewGovDAO() | ||
|
|
||
| // Test member (should not show badge) | ||
| badge := renderMembershipBadge(m1, dao) | ||
| urequire.Equal(t, "", badge, "Members should not have a badge") | ||
|
|
||
| // Test non-member (should show badge) | ||
| badge = renderMembershipBadge(noMember, dao) | ||
| urequire.Equal(t, "`[non-member]`", badge, "Non-members should have a badge") | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
for me this line should never have been there, invitations point should be only for the T3 AddMember function but since it was here it makes me wondering if we should keep it in case the proposal is coming from a member ?
Uh oh!
There was an error while loading. Please reload this page.
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 agree, in the end this is just a helper function to create a
ProposalRequestobject, any non-member could bypass this condition by creating their ownProposalRequestobject.But I don't think we should keep it as it is not protective, or we should rethink how invitationPoint work in GovDAO.