Skip to content

Commit

Permalink
feat: add CommunityCDPRepayDebtPermission (#1566)
Browse files Browse the repository at this point in the history
* feat: add CommunityCDPRepayDebtPermission

When granted, the new permission allows a committee to submit a
CommunityCDPRepayDebtProposal to lower principal owed on a cdp
owned by the x/community module.

* update changelog

* update protonet genesis.json
  • Loading branch information
pirtleshell authored Apr 20, 2023
1 parent c5f414e commit 14a0860
Show file tree
Hide file tree
Showing 8 changed files with 229 additions and 35 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
- (x/community) [#1563] Include x/community module pool balance in x/distribution
community_pool query response.
- (x/community) [#1565] Add CommunityCDPRepayDebtProposal
- (x/committee) [#1566] Add CommunityCDPRepayDebtPermission

### Deprecated

Expand Down Expand Up @@ -233,6 +234,7 @@ the [changelog](https://github.com/cosmos/cosmos-sdk/blob/v0.38.4/CHANGELOG.md).
large-scale simulations remotely using aws-batch


[#1566]: https://github.com/Kava-Labs/kava/pull/1566
[#1565]: https://github.com/Kava-Labs/kava/pull/1565
[#1563]: https://github.com/Kava-Labs/kava/pull/1563
[#1562]: https://github.com/Kava-Labs/kava/pull/1562
Expand Down
6 changes: 6 additions & 0 deletions ci/env/kava-protonet/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,12 @@
{
"@type": "/kava.committee.v1beta1.TextPermission"
},
{
"@type": "/kava.committee.v1beta1.CommunityPoolLendWithdrawPermission"
},
{
"@type": "/kava.committee.v1beta1.CommunityCDPRepayDebtPermission"
},
{
"@type": "/kava.committee.v1beta1.ParamsChangePermission",
"allowed_params_changes": [
Expand Down
11 changes: 11 additions & 0 deletions docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@

- [kava/committee/v1beta1/permissions.proto](#kava/committee/v1beta1/permissions.proto)
- [AllowedParamsChange](#kava.committee.v1beta1.AllowedParamsChange)
- [CommunityCDPRepayDebtPermission](#kava.committee.v1beta1.CommunityCDPRepayDebtPermission)
- [CommunityPoolLendWithdrawPermission](#kava.committee.v1beta1.CommunityPoolLendWithdrawPermission)
- [GodPermission](#kava.committee.v1beta1.GodPermission)
- [ParamsChangePermission](#kava.committee.v1beta1.ParamsChangePermission)
Expand Down Expand Up @@ -2325,6 +2326,16 @@ AllowedParamsChange contains data on the allowed parameter changes for subspace,



<a name="kava.committee.v1beta1.CommunityCDPRepayDebtPermission"></a>

### CommunityCDPRepayDebtPermission
CommunityCDPRepayDebtPermission allows submission of CommunityCDPRepayDebtProposal






<a name="kava.committee.v1beta1.CommunityPoolLendWithdrawPermission"></a>

### CommunityPoolLendWithdrawPermission
Expand Down
5 changes: 5 additions & 0 deletions proto/kava/committee/v1beta1/permissions.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ message TextPermission {
option (cosmos_proto.implements_interface) = "Permission";
}

// CommunityCDPRepayDebtPermission allows submission of CommunityCDPRepayDebtProposal
message CommunityCDPRepayDebtPermission {
option (cosmos_proto.implements_interface) = "Permission";
}

// CommunityPoolLendWithdrawPermission allows submission of CommunityPoolLendWithdrawProposal
message CommunityPoolLendWithdrawPermission {
option (cosmos_proto.implements_interface) = "Permission";
Expand Down
6 changes: 5 additions & 1 deletion x/committee/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ func init() {
RegisterProposalTypeCodec(govv1beta1.TextProposal{}, "cosmos-sdk/TextProposal")
RegisterProposalTypeCodec(upgradetypes.SoftwareUpgradeProposal{}, "cosmos-sdk/SoftwareUpgradeProposal")
RegisterProposalTypeCodec(upgradetypes.CancelSoftwareUpgradeProposal{}, "cosmos-sdk/CancelSoftwareUpgradeProposal")
RegisterProposalTypeCodec(communitytypes.CommunityCDPRepayDebtProposal{}, "kava/CommunityCDPRepayDebtProposal")
RegisterProposalTypeCodec(communitytypes.CommunityPoolLendWithdrawProposal{}, "kava/CommunityPoolLendWithdrawProposal")
RegisterProposalTypeCodec(kavadisttypes.CommunityPoolMultiSpendProposal{}, "kava/CommunityPoolMultiSpendProposal")
}

// RegisterLegacyAminoCodec registers all the necessary types and interfaces for the module.
Expand All @@ -70,6 +72,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(TextPermission{}, "kava/TextPermission", nil)
cdc.RegisterConcrete(SoftwareUpgradePermission{}, "kava/SoftwareUpgradePermission", nil)
cdc.RegisterConcrete(ParamsChangePermission{}, "kava/ParamsChangePermission", nil)
cdc.RegisterConcrete(CommunityCDPRepayDebtPermission{}, "kava/CommunityCDPRepayDebtPermission", nil)
cdc.RegisterConcrete(CommunityPoolLendWithdrawPermission{}, "kava/CommunityPoolLendWithdrawPermission", nil)

// Msgs
Expand Down Expand Up @@ -106,6 +109,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
&TextPermission{},
&SoftwareUpgradePermission{},
&ParamsChangePermission{},
&CommunityCDPRepayDebtPermission{},
&CommunityPoolLendWithdrawPermission{},
)

Expand All @@ -121,8 +125,8 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
&proposaltypes.ParameterChangeProposal{},
&upgradetypes.SoftwareUpgradeProposal{},
&upgradetypes.CancelSoftwareUpgradeProposal{},
&communitytypes.CommunityCDPRepayDebtProposal{},
&communitytypes.CommunityPoolLendWithdrawProposal{},
&kavadisttypes.CommunityPoolMultiSpendProposal{},
)

registry.RegisterImplementations(
Expand Down
7 changes: 7 additions & 0 deletions x/committee/types/permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ var (
_ Permission = TextPermission{}
_ Permission = SoftwareUpgradePermission{}
_ Permission = ParamsChangePermission{}
_ Permission = CommunityCDPRepayDebtPermission{}
_ Permission = CommunityPoolLendWithdrawPermission{}
)

Expand All @@ -72,6 +73,12 @@ func (SoftwareUpgradePermission) Allows(_ sdk.Context, _ ParamKeeper, p PubPropo
return ok
}

// Allows implement permission interface for CommunityCDPRepayDebtPermission.
func (CommunityCDPRepayDebtPermission) Allows(_ sdk.Context, _ ParamKeeper, p PubProposal) bool {
_, ok := p.(*communitytypes.CommunityCDPRepayDebtProposal)
return ok
}

// Allows implement permission interface for CommunityPoolLendWithdrawPermission.
func (CommunityPoolLendWithdrawPermission) Allows(_ sdk.Context, _ ParamKeeper, p PubProposal) bool {
_, ok := p.(*communitytypes.CommunityPoolLendWithdrawProposal)
Expand Down
189 changes: 155 additions & 34 deletions x/committee/types/permissions.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 14a0860

Please sign in to comment.