2022-01-04 01:33:00 -08:00
<!--
order: 3
-->
# Msg Service
## Msg/CreateGroup
2022-04-15 01:51:44 -07:00
A new group can be created with the `MsgCreateGroup` , which has an admin address, a list of members and some optional metadata.
2022-01-04 01:33:00 -08:00
2022-02-03 04:40:45 -08:00
The metadata has a maximum length that is chosen by the app developer, and
passed into the group keeper as a config.
2022-04-15 01:51:44 -07:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.46.0-beta2/proto/cosmos/group/v1/tx.proto#L65-L76
2022-01-04 01:33:00 -08:00
2022-04-15 01:51:44 -07:00
It's expected to fail if
- metadata length is greater than `MaxMetadataLen`
config
- members are not correctly set (e.g. wrong address format, duplicates, or with 0 weight).
2022-01-04 01:33:00 -08:00
## Msg/UpdateGroupMembers
Group members can be updated with the `UpdateGroupMembers` .
2022-04-15 01:51:44 -07:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.46.0-beta2/proto/cosmos/group/v1/tx.proto#L85-L98
2022-01-04 01:33:00 -08:00
In the list of `MemberUpdates` , an existing member can be removed by setting its weight to 0.
2022-04-15 01:51:44 -07:00
It's expected to fail if:
- the signer is not the admin of the group.
- for any one of the associated group policies, if its decision policy's `Validate()` method fails against the updated group.
2022-01-04 01:33:00 -08:00
## Msg/UpdateGroupAdmin
The `UpdateGroupAdmin` can be used to update a group admin.
2022-04-15 01:51:44 -07:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.46.0-beta2/proto/cosmos/group/v1/tx.proto#L103-L115
2022-01-04 01:33:00 -08:00
2022-04-15 01:51:44 -07:00
It's expected to fail if the signer is not the admin of the group.
2022-01-04 01:33:00 -08:00
## Msg/UpdateGroupMetadata
The `UpdateGroupMetadata` can be used to update a group metadata.
2022-04-15 01:51:44 -07:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.46.0-beta2/proto/cosmos/group/v1/tx.proto#L120-L132
2022-01-04 01:33:00 -08:00
2022-04-15 01:51:44 -07:00
It's expected to fail if:
2022-02-10 04:07:01 -08:00
2022-04-15 01:51:44 -07:00
- new metadata length is greater than `MaxMetadataLen` config.
- the signer is not the admin of the group.
2022-01-04 01:33:00 -08:00
2022-01-05 00:54:52 -08:00
## Msg/CreateGroupPolicy
2022-01-04 01:33:00 -08:00
2022-04-15 01:51:44 -07:00
A new group policy can be created with the `MsgCreateGroupPolicy` , which has an admin address, a group id, a decision policy and some optional metadata.
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.46.0-beta2/proto/cosmos/group/v1/tx.proto#L141-L158
2022-01-04 01:33:00 -08:00
2022-04-15 01:51:44 -07:00
It's expected to fail if:
2022-01-04 01:33:00 -08:00
2022-04-15 01:51:44 -07:00
- the signer is not the admin of the group.
- metadata length is greater than `MaxMetadataLen` config.
- the decision policy's `Validate()` method doesn't pass against the group.
2022-01-04 01:33:00 -08:00
2022-02-18 05:47:04 -08:00
## Msg/CreateGroupWithPolicy
2022-04-15 01:51:44 -07:00
A new group with policy can be created with the `MsgCreateGroupWithPolicy` , which has an admin address, a list of members, a decision policy, a `group_policy_as_admin` field to optionally set group and group policy admin with group policy address and some optional metadata for group and group policy.
2022-02-18 05:47:04 -08:00
2022-04-15 01:51:44 -07:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.46.0-beta2/proto/cosmos/group/v1/tx.proto#L181-L202
2022-02-18 05:47:04 -08:00
2022-04-15 01:51:44 -07:00
It's expected to fail for the same reasons as `Msg/CreateGroup` and `Msg/CreateGroupPolicy` .
2022-02-18 05:47:04 -08:00
2022-01-05 00:54:52 -08:00
## Msg/UpdateGroupPolicyAdmin
2022-01-04 01:33:00 -08:00
2022-01-05 00:54:52 -08:00
The `UpdateGroupPolicyAdmin` can be used to update a group policy admin.
2022-01-04 01:33:00 -08:00
2022-04-15 01:51:44 -07:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.46.0-beta2/proto/cosmos/group/v1/tx.proto#L167-L179
2022-01-04 01:33:00 -08:00
2022-04-15 01:51:44 -07:00
It's expected to fail if the signer is not the admin of the group policy.
2022-01-04 01:33:00 -08:00
2022-01-05 00:54:52 -08:00
## Msg/UpdateGroupPolicyDecisionPolicy
2022-01-04 01:33:00 -08:00
2022-01-05 00:54:52 -08:00
The `UpdateGroupPolicyDecisionPolicy` can be used to update a decision policy.
2022-01-04 01:33:00 -08:00
2022-04-15 01:51:44 -07:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.46.0-beta2/proto/cosmos/group/v1/tx.proto#L217-L231
2022-01-04 01:33:00 -08:00
2022-04-15 01:51:44 -07:00
It's expected to fail if:
- the signer is not the admin of the group policy.
- the new decision policy's `Validate()` method doesn't pass against the group.
2022-01-04 01:33:00 -08:00
2022-01-05 00:54:52 -08:00
## Msg/UpdateGroupPolicyMetadata
2022-01-04 01:33:00 -08:00
2022-01-05 00:54:52 -08:00
The `UpdateGroupPolicyMetadata` can be used to update a group policy metadata.
2022-01-04 01:33:00 -08:00
2022-04-15 01:51:44 -07:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.46.0-beta2/proto/cosmos/group/v1/tx.proto#L236-L248
2022-01-04 01:33:00 -08:00
2022-04-15 01:51:44 -07:00
It's expected to fail if:
2022-02-10 04:07:01 -08:00
2022-04-15 01:51:44 -07:00
- new metadata length is greater than `MaxMetadataLen` config.
- the signer is not the admin of the group.
2022-01-04 01:33:00 -08:00
2022-04-15 01:51:44 -07:00
## Msg/SubmitProposal
2022-01-04 01:33:00 -08:00
2022-04-15 01:51:44 -07:00
A new proposal can be created with the `MsgSubmitProposal` , which has a group policy account address, a list of proposers addresses, a list of messages to execute if the proposal is accepted and some optional metadata.
2022-01-04 01:33:00 -08:00
An optional `Exec` value can be provided to try to execute the proposal immediately after proposal creation. Proposers signatures are considered as yes votes in this case.
2022-04-15 01:51:44 -07:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.46.0-beta2/proto/cosmos/group/v1/tx.proto#L271-L294
It's expected to fail if:
2022-01-04 01:33:00 -08:00
2022-04-15 01:51:44 -07:00
- metadata length is greater than `MaxMetadataLen` config.
- if any of the proposers is not a group member.
2022-01-04 01:33:00 -08:00
2022-02-04 00:37:45 -08:00
## Msg/WithdrawProposal
2022-04-15 01:51:44 -07:00
A proposal can be withdrawn using `MsgWithdrawProposal` which has an `address` (can be either a proposer or the group policy admin) and a `proposal_id` (which has to be withdrawn).
2022-02-04 00:37:45 -08:00
2022-04-15 01:51:44 -07:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.46.0-beta2/proto/cosmos/group/v1/tx.proto#L303-L310
2022-02-04 00:37:45 -08:00
2022-04-15 01:51:44 -07:00
It's expected to fail if:
2022-02-10 04:07:01 -08:00
2022-04-15 01:51:44 -07:00
- the signer is neither the group policy admin nor proposer of the proposal.
- the proposal is already closed or aborted.
2022-02-04 00:37:45 -08:00
2022-01-04 01:33:00 -08:00
## Msg/Vote
2022-04-15 01:51:44 -07:00
A new vote can be created with the `MsgVote` , given a proposal id, a voter address, a choice (yes, no, veto or abstain) and some optional metadata.
2022-01-04 01:33:00 -08:00
An optional `Exec` value can be provided to try to execute the proposal immediately after voting.
2022-04-15 01:51:44 -07:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.46.0-beta2/proto/cosmos/group/v1/tx.proto#L315-L333
It's expected to fail if:
2022-01-04 01:33:00 -08:00
2022-04-15 01:51:44 -07:00
- metadata length is greater than `MaxMetadataLen` config.
- the proposal is not in voting period anymore.
2022-01-04 01:33:00 -08:00
## Msg/Exec
A proposal can be executed with the `MsgExec` .
2022-04-15 01:51:44 -07:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.46.0-beta2/proto/cosmos/group/v1/tx.proto#L338-L347
2022-01-04 01:33:00 -08:00
The messages that are part of this proposal won't be executed if:
2022-02-10 04:07:01 -08:00
2022-04-15 01:51:44 -07:00
- the proposal has not been accepted by the group policy.
- the proposal has already been successfully executed.
2022-03-04 06:03:31 -08:00
## Msg/LeaveGroup
The `MsgLeaveGroup` allows group member to leave a group.
2022-04-15 01:51:44 -07:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.46.0-beta2/proto/cosmos/group/v1/tx.proto#L352-L361
2022-03-04 06:03:31 -08:00
2022-04-15 01:51:44 -07:00
It's expected to fail if:
2022-03-04 06:03:31 -08:00
2022-04-15 01:51:44 -07:00
- the group member is not part of the group.
- for any one of the associated group policies, if its decision policy's `Validate()` method fails against the updated group.