Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
9d9a5de
better rendering
leohhhn Apr 15, 2025
1cacd12
chore: fixup
leohhhn Apr 15, 2025
f2edc21
chore: fixup
leohhhn Apr 15, 2025
4bcc36e
chore: fixup
leohhhn Apr 15, 2025
f7dd727
fix tests
leohhhn Apr 16, 2025
24a52e7
chore: fixup
leohhhn Apr 16, 2025
8516032
chore(govdao): merge master
MikaelVallenet Jun 26, 2025
d692004
chore(govdao): merge master
MikaelVallenet Jun 26, 2025
c32214f
chore(govdao): merge master add cross
MikaelVallenet Jun 26, 2025
101d22e
tests: fix
MikaelVallenet Jun 26, 2025
dd9ba73
tests: fix
MikaelVallenet Jun 26, 2025
e14eef6
tests: fix
MikaelVallenet Jun 26, 2025
ae7bb47
tests: fix
MikaelVallenet Jun 26, 2025
8862675
tests: fix
MikaelVallenet Jun 26, 2025
016085c
Merge branch 'master' into govdao3-rendering
MikaelVallenet Jun 26, 2025
195e5e4
Merge branch 'master' into govdao3-rendering
MikaelVallenet Jul 1, 2025
955ff21
Merge branch 'master' into mikael/govdao3-rendering
MikaelVallenet Jul 2, 2025
012409f
Merge branch 'master' into mikael/govdao3-rendering
MikaelVallenet Jul 2, 2025
e22686d
fix(govdao): use seqid format with avl tree
MikaelVallenet Jul 2, 2025
12946c1
fix(govdao): use seqid format with avl tree
MikaelVallenet Jul 2, 2025
5224ffc
style(govdao): enhance rendering
MikaelVallenet Jul 2, 2025
e5a7d16
refacto(users): refacto code & change prop title
MikaelVallenet Jul 2, 2025
dc1a156
fix(users): user registry proposals title
MikaelVallenet Jul 2, 2025
ae0c5a1
chore: restore loader members
MikaelVallenet Jul 2, 2025
f42196c
fix(users): file test
MikaelVallenet Jul 2, 2025
9851ccd
style(users): enhance explanation of rules to register
MikaelVallenet Jul 2, 2025
690e7fa
Merge branch 'master' into govdao3-rendering
MikaelVallenet Jul 2, 2025
6e5444f
Merge branch 'master' into govdao3-rendering
MikaelVallenet Jul 4, 2025
689f61a
remove usage of uint64
MikaelVallenet Jul 4, 2025
cae0f37
fix(govdao): use parseint instead of atoi to get int64 directly
MikaelVallenet Jul 4, 2025
5cd4780
Merge branch 'master' into govdao3-rendering
MikaelVallenet Jul 4, 2025
9df9aef
small fixups
leohhhn Jul 6, 2025
1e66229
save
leohhhn Jul 6, 2025
a2f89ef
fix test
leohhhn Jul 6, 2025
6d47f9c
save
leohhhn Jul 6, 2025
8390d08
Merge branch 'master' into govdao3-rendering
MikaelVallenet Jul 7, 2025
54c4094
Merge branch 'master' into mikael/govdao3-rendering
MikaelVallenet Jul 7, 2025
dd70b34
Merge branch 'master' into mikael/govdao3-rendering
MikaelVallenet Jul 9, 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
23 changes: 18 additions & 5 deletions examples/gno.land/r/gnoland/users/v1/admin.gno
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package users
import (
"std"

"gno.land/p/demo/ufmt"
"gno.land/r/gov/dao"
susers "gno.land/r/sys/users"
)
Expand Down Expand Up @@ -42,7 +43,11 @@ func NewSetPausedExecutor(newPausedValue bool) dao.ProposalRequest {

e := dao.NewSimpleExecutor(cb, "")

return dao.NewProposalRequest("Pause users/v1 realm", "", e)
if newPausedValue {
return dao.NewProposalRequest("User Registry V1: Pause", "", e)
}

return dao.NewProposalRequest("User Registry V1: Unpause", "", e)
}

// ProposeNewName allows GovDAO to propose a new name for an existing user
Expand All @@ -65,13 +70,17 @@ func ProposeNewName(addr std.Address, newName string) dao.ProposalRequest {

e := dao.NewSimpleExecutor(cb, "")

return dao.NewProposalRequest("Propose a new name using users/v1 realm", "", e)
return dao.NewProposalRequest(
ufmt.Sprintf("User Registry V1: Rename user `%s` to `%s`", userData.Name(), newName),
"",
e,
)
}

// ProposeDeleteUser allows GovDAO to propose deletion of a user
// This will make the associated address and names unresolvable.
// WARN: After deletion, the same address WILL NOT be able to register a new name.
func ProposeDeleteUser(addr std.Address, desc string) dao.ProposalRequest {
func ProposeDeleteUser(addr std.Address, reason string) dao.ProposalRequest {
userData := susers.ResolveAddress(addr)
if userData == nil {
panic(susers.ErrUserNotExistOrDeleted)
Expand All @@ -83,7 +92,11 @@ func ProposeDeleteUser(addr std.Address, desc string) dao.ProposalRequest {

e := dao.NewSimpleExecutor(cb, "")

return dao.NewProposalRequest("Propose deleting a name using users/v1 realm", desc, e)
return dao.NewProposalRequest(
ufmt.Sprintf("User Registry V1: Delete user `%s`", userData.Name()),
reason,
e,
)
}

// ProposeNewRegisterPrice allows GovDAO to update the price of registration
Expand All @@ -100,7 +113,7 @@ func ProposeNewRegisterPrice(newPrice int64) dao.ProposalRequest {
e := dao.NewSimpleExecutor(cb, "")

return dao.NewProposalRequest(
"Propose change the price for name registration using users/v1 realm",
ufmt.Sprintf("User Registry V1: Update registration price to `%d`", newPrice),
"",
e,
)
Expand Down
3 changes: 2 additions & 1 deletion examples/gno.land/r/gnoland/users/v1/render.gno
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ will gain permission to deploy packages and realms to package paths with the pat

out += md.Paragraph("In V1, usernames must follow these rules, in order to prevent username squatting:")
items := []string{
"Must start with 3 characters",
"Must start with 3 letters",
"Letters must be lowercase",
"Must end with 3 numbers",
"Have a maximum length of 20 characters",
"With the only special character allowed being `_`",
Expand Down
77 changes: 44 additions & 33 deletions examples/gno.land/r/gnoland/users/v1/z_0_prop1_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -62,78 +62,89 @@ func main() {

// Output:
// --
// # Active Proposals:
// ## Proposal with id: 0
// ### Title: Propose a new name using users/v1 realm
// # GovDAO Proposals
// ### [Prop #0 - User Registry V1: Rename user `alice123` to `alice_new123`](/r/gov/dao:0)
// Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
//
// ### Proposed by: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
// Status: ACTIVE
//
// Tiers eligible to vote: T1, T2, T3
//
//
//
// ### Proposal Status:
//
// - **Proposal open for votes**
// - Allowed tiers to vote: T1 T2 T3
// - YES PERCENT: 0%
// - NO PERCENT: 0%
// - [Go to votes list](/r/gov/dao:0/votes).
// ---
//
//
// --
// ## Proposal with id: 0
// ### Title: Propose a new name using users/v1 realm
// ## Prop #0 - User Registry V1: Rename user `alice123` to `alice_new123`
// Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
//
// ### Proposed by: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
//
//
//
//
// ### Proposal Status:
// ---
//
// - **Proposal open for votes**
// - Allowed tiers to vote: T1 T2 T3
// ### Stats
// - **Proposal is open for votes**
// - Tiers eligible to vote: T1, T2, T3
// - YES PERCENT: 0%
// - NO PERCENT: 0%
// - [Go to votes list](/r/gov/dao:0/votes).
//
// [Detailed voting list](/r/gov/dao:0/votes)
//
// ---
//
// ### Actions
// [Vote YES](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=YES&pid=0) | [Vote NO](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=NO&pid=0) | [Vote ABSTAIN](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=ABSTAIN&pid=0)
//
// WARNING: Please double check transaction data before voting.
// --
// --
// ## Proposal with id: 0
// ### Title: Propose a new name using users/v1 realm
// ## Prop #0 - User Registry V1: Rename user `alice123` to `alice_new123`
// Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
//
// ### Proposed by: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
//
//
//
//
// ### Proposal Status:
// ---
//
// - **Proposal open for votes**
// - Allowed tiers to vote: T1 T2 T3
// ### Stats
// - **Proposal is open for votes**
// - Tiers eligible to vote: T1, T2, T3
// - YES PERCENT: 100%
// - NO PERCENT: 0%
// - [Go to votes list](/r/gov/dao:0/votes).
//
// [Detailed voting list](/r/gov/dao:0/votes)
//
// ---
//
// ### Actions
// [Vote YES](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=YES&pid=0) | [Vote NO](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=NO&pid=0) | [Vote ABSTAIN](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=ABSTAIN&pid=0)
//
// WARNING: Please double check transaction data before voting.
// --
// --
// ## Proposal with id: 0
// ### Title: Propose a new name using users/v1 realm
// ## Prop #0 - User Registry V1: Rename user `alice123` to `alice_new123`
// Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
//
// ### Proposed by: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
//
//
//
//
// ### Proposal Status:
// ---
//
// ### Stats
// - **PROPOSAL HAS BEEN ACCEPTED**
// - Allowed tiers to vote: T1 T2 T3
// - Tiers eligible to vote: T1, T2, T3
// - YES PERCENT: 100%
// - NO PERCENT: 0%
// - [Go to votes list](/r/gov/dao:0/votes).
//
// [Detailed voting list](/r/gov/dao:0/votes)
//
// ---
//
// ### Actions
// [Vote YES](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=YES&pid=0) | [Vote NO](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=NO&pid=0) | [Vote ABSTAIN](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=ABSTAIN&pid=0)
//
// WARNING: Please double check transaction data before voting.
// g1v9kxjcm9ta047h6lta047h6lta047h6lzd40gh
83 changes: 47 additions & 36 deletions examples/gno.land/r/gnoland/users/v1/z_1_prop2_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -65,78 +65,89 @@ func main() {

// Output:
// --
// # Active Proposals:
// ## Proposal with id: 0
// ### Title: Propose deleting a name using users/v1 realm
// # GovDAO Proposals
// ### [Prop #0 - User Registry V1: Delete user `alice123`](/r/gov/dao:0)
// Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
//
// ### Proposed by: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
// Status: ACTIVE
//
// delete user test
//
//
// ### Proposal Status:
// Tiers eligible to vote: T1, T2, T3
//
// - **Proposal open for votes**
// - Allowed tiers to vote: T1 T2 T3
// - YES PERCENT: 0%
// - NO PERCENT: 0%
// - [Go to votes list](/r/gov/dao:0/votes).
// ---
//
//
// --
// ## Proposal with id: 0
// ### Title: Propose deleting a name using users/v1 realm
//
// ### Proposed by: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
// ## Prop #0 - User Registry V1: Delete user `alice123`
// Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
//
// delete user test
//
//
// ### Proposal Status:
//
// - **Proposal open for votes**
// - Allowed tiers to vote: T1 T2 T3
// ---
//
// ### Stats
// - **Proposal is open for votes**
// - Tiers eligible to vote: T1, T2, T3
// - YES PERCENT: 0%
// - NO PERCENT: 0%
// - [Go to votes list](/r/gov/dao:0/votes).
//
// [Detailed voting list](/r/gov/dao:0/votes)
//
// ---
//
// ### Actions
// [Vote YES](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=YES&pid=0) | [Vote NO](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=NO&pid=0) | [Vote ABSTAIN](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=ABSTAIN&pid=0)
//
// WARNING: Please double check transaction data before voting.
// --
// --
// ## Proposal with id: 0
// ### Title: Propose deleting a name using users/v1 realm
//
// ### Proposed by: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
// ## Prop #0 - User Registry V1: Delete user `alice123`
// Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
//
// delete user test
//
//
// ### Proposal Status:
//
// - **Proposal open for votes**
// - Allowed tiers to vote: T1 T2 T3
// ---
//
// ### Stats
// - **Proposal is open for votes**
// - Tiers eligible to vote: T1, T2, T3
// - YES PERCENT: 100%
// - NO PERCENT: 0%
// - [Go to votes list](/r/gov/dao:0/votes).
//
// [Detailed voting list](/r/gov/dao:0/votes)
//
// ---
//
// ### Actions
// [Vote YES](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=YES&pid=0) | [Vote NO](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=NO&pid=0) | [Vote ABSTAIN](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=ABSTAIN&pid=0)
//
// WARNING: Please double check transaction data before voting.
// --
// --
// ## Proposal with id: 0
// ### Title: Propose deleting a name using users/v1 realm
//
// ### Proposed by: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
// ## Prop #0 - User Registry V1: Delete user `alice123`
// Author: g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
//
// delete user test
//
//
// ### Proposal Status:
//
// ---
//
// ### Stats
// - **PROPOSAL HAS BEEN ACCEPTED**
// - Allowed tiers to vote: T1 T2 T3
// - Tiers eligible to vote: T1, T2, T3
// - YES PERCENT: 100%
// - NO PERCENT: 0%
// - [Go to votes list](/r/gov/dao:0/votes).
//
// [Detailed voting list](/r/gov/dao:0/votes)
//
// ---
//
// ### Actions
// [Vote YES](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=YES&pid=0) | [Vote NO](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=NO&pid=0) | [Vote ABSTAIN](/r/gov/dao$help&func=MustVoteOnProposalSimple&option=ABSTAIN&pid=0)
//
// WARNING: Please double check transaction data before voting.
// Successfully deleted alice
30 changes: 6 additions & 24 deletions examples/gno.land/r/gnoland/valopers_proposal/z_1_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -46,30 +46,12 @@ func main() {

// Output:
// OK
// # Active Proposals:
// ## Proposal with id: 0
// ### Title: Add valoper test-1 to the valset
// # GovDAO Proposals
// ### [Prop #0 - Add valoper test-1 to the valset](/r/gov/dao:0)
// Author: g1vuch2um9wf047h6lta047h6lta047h6l2ewm6w
//
// ### Proposed by: g1vuch2um9wf047h6lta047h6lta047h6l2ewm6w
//
// Valoper profile: [test-1](/r/gnoland/valopers:g1sp8v98h2gadm5jggtzz9w5ksexqn68ympsd68h)
//
// ## test-1
// test-1's description
//
// - Address: g1sp8v98h2gadm5jggtzz9w5ksexqn68ympsd68h
// - PubKey: gpub1pggj7ard9eg82cjtv4u52epjx56nzwgjyg9zqwpdwpd0f9fvqla089ndw5g9hcsufad77fml2vlu73fk8q8sh8v72cza5p
//
// [Profile link](/r/demo/profile:u/g1sp8v98h2gadm5jggtzz9w5ksexqn68ympsd68h)
//
//
//
// ### Proposal Status:
//
// - **Proposal open for votes**
// - Allowed tiers to vote: T1 T2 T3
// - YES PERCENT: 0%
// - NO PERCENT: 0%
// - [Go to votes list](/r/gov/dao:0/votes).
// Status: ACTIVE
//
// Tiers eligible to vote: T1, T2, T3
//
// ---
5 changes: 1 addition & 4 deletions examples/gno.land/r/gov/dao/types.gno
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import (

"gno.land/p/demo/avl"
"gno.land/p/demo/seqid"
"gno.land/p/demo/ufmt"
)

type ProposalID int64

func (pid ProposalID) String() string {
return ufmt.Sprintf("%v", int64(pid))
return seqid.ID(pid).String()
}

// VoteOption is the limited voting option for a DAO proposal
Expand Down Expand Up @@ -119,9 +118,7 @@ func (ps *Proposals) SetProposal(p *Proposal) ProposalID {
if updated {
panic("fatal error: Override proposals is not allowed")
}

ps.seq = ps.seq.Next()

return pid
}

Expand Down
4 changes: 1 addition & 3 deletions examples/gno.land/r/gov/dao/v3/impl/govdao.gno
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ func (g *GovDAO) PostCreateProposal(r dao.ProposalRequest, pid dao.ProposalID) {
tatv = []string{memberstore.T1, memberstore.T2}
}
}

pids := ufmt.Sprintf("%v", int(pid))
g.pss.Set(pids, newProposalStatus(tatv))
g.pss.Set(pid.String(), newProposalStatus(tatv))
}

func (g *GovDAO) VoteOnProposal(r dao.VoteRequest) error {
Expand Down
Loading
Loading