mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-10 10:05:18 +00:00
feat: add CommunityCDPWithdrawCollateralPermission (#1568)
* Add CommunityCDPWithdrawCollateralPermission * Add changelog entry * Move permission Allow func closer to its other cdp friend
This commit is contained in:
parent
fff3f50877
commit
95d9fb9aca
@ -50,6 +50,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
- (x/community) [#1565] Add CommunityCDPRepayDebtProposal
|
||||
- (x/committee) [#1566] Add CommunityCDPRepayDebtPermission
|
||||
- (x/community) [#1567] Add CommunityCDPWithdrawCollateralProposal
|
||||
- (x/committee) [#1568] Add CommunityCDPWithdrawCollateralPermission
|
||||
|
||||
### Deprecated
|
||||
|
||||
@ -234,7 +235,7 @@ the [changelog](https://github.com/cosmos/cosmos-sdk/blob/v0.38.4/CHANGELOG.md).
|
||||
- [#257](https://github.com/Kava-Labs/kava/pulls/257) Include scripts to run
|
||||
large-scale simulations remotely using aws-batch
|
||||
|
||||
|
||||
[#1568]: https://github.com/Kava-Labs/kava/pull/1568
|
||||
[#1567]: https://github.com/Kava-Labs/kava/pull/1567
|
||||
[#1566]: https://github.com/Kava-Labs/kava/pull/1566
|
||||
[#1565]: https://github.com/Kava-Labs/kava/pull/1565
|
||||
|
3
ci/env/kava-protonet/genesis.json
vendored
3
ci/env/kava-protonet/genesis.json
vendored
@ -1097,6 +1097,9 @@
|
||||
{
|
||||
"@type": "/kava.committee.v1beta1.CommunityCDPRepayDebtPermission"
|
||||
},
|
||||
{
|
||||
"@type": "/kava.committee.v1beta1.CommunityCDPWithdrawCollateralPermission"
|
||||
},
|
||||
{
|
||||
"@type": "/kava.committee.v1beta1.ParamsChangePermission",
|
||||
"allowed_params_changes": [
|
||||
|
@ -139,6 +139,7 @@
|
||||
- [kava/committee/v1beta1/permissions.proto](#kava/committee/v1beta1/permissions.proto)
|
||||
- [AllowedParamsChange](#kava.committee.v1beta1.AllowedParamsChange)
|
||||
- [CommunityCDPRepayDebtPermission](#kava.committee.v1beta1.CommunityCDPRepayDebtPermission)
|
||||
- [CommunityCDPWithdrawCollateralPermission](#kava.committee.v1beta1.CommunityCDPWithdrawCollateralPermission)
|
||||
- [CommunityPoolLendWithdrawPermission](#kava.committee.v1beta1.CommunityPoolLendWithdrawPermission)
|
||||
- [GodPermission](#kava.committee.v1beta1.GodPermission)
|
||||
- [ParamsChangePermission](#kava.committee.v1beta1.ParamsChangePermission)
|
||||
@ -2337,6 +2338,16 @@ CommunityCDPRepayDebtPermission allows submission of CommunityCDPRepayDebtPropos
|
||||
|
||||
|
||||
|
||||
<a name="kava.committee.v1beta1.CommunityCDPWithdrawCollateralPermission"></a>
|
||||
|
||||
### CommunityCDPWithdrawCollateralPermission
|
||||
CommunityCDPWithdrawCollateralPermission allows submission of CommunityCDPWithdrawCollateralProposal
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="kava.committee.v1beta1.CommunityPoolLendWithdrawPermission"></a>
|
||||
|
||||
### CommunityPoolLendWithdrawPermission
|
||||
|
@ -26,6 +26,11 @@ message CommunityCDPRepayDebtPermission {
|
||||
option (cosmos_proto.implements_interface) = "Permission";
|
||||
}
|
||||
|
||||
// CommunityCDPWithdrawCollateralPermission allows submission of CommunityCDPWithdrawCollateralProposal
|
||||
message CommunityCDPWithdrawCollateralPermission {
|
||||
option (cosmos_proto.implements_interface) = "Permission";
|
||||
}
|
||||
|
||||
// CommunityPoolLendWithdrawPermission allows submission of CommunityPoolLendWithdrawProposal
|
||||
message CommunityPoolLendWithdrawPermission {
|
||||
option (cosmos_proto.implements_interface) = "Permission";
|
||||
|
@ -74,6 +74,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
|
||||
cdc.RegisterConcrete(SoftwareUpgradePermission{}, "kava/SoftwareUpgradePermission", nil)
|
||||
cdc.RegisterConcrete(ParamsChangePermission{}, "kava/ParamsChangePermission", nil)
|
||||
cdc.RegisterConcrete(CommunityCDPRepayDebtPermission{}, "kava/CommunityCDPRepayDebtPermission", nil)
|
||||
cdc.RegisterConcrete(CommunityCDPWithdrawCollateralPermission{}, "kava/CommunityCDPWithdrawCollateralPermission", nil)
|
||||
cdc.RegisterConcrete(CommunityPoolLendWithdrawPermission{}, "kava/CommunityPoolLendWithdrawPermission", nil)
|
||||
|
||||
// Msgs
|
||||
@ -111,6 +112,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
|
||||
&SoftwareUpgradePermission{},
|
||||
&ParamsChangePermission{},
|
||||
&CommunityCDPRepayDebtPermission{},
|
||||
&CommunityCDPWithdrawCollateralPermission{},
|
||||
&CommunityPoolLendWithdrawPermission{},
|
||||
)
|
||||
|
||||
|
@ -56,6 +56,7 @@ var (
|
||||
_ Permission = ParamsChangePermission{}
|
||||
_ Permission = CommunityCDPRepayDebtPermission{}
|
||||
_ Permission = CommunityPoolLendWithdrawPermission{}
|
||||
_ Permission = CommunityCDPWithdrawCollateralPermission{}
|
||||
)
|
||||
|
||||
// Allows implement permission interface for GodPermission.
|
||||
@ -79,6 +80,12 @@ func (CommunityCDPRepayDebtPermission) Allows(_ sdk.Context, _ ParamKeeper, p Pu
|
||||
return ok
|
||||
}
|
||||
|
||||
// Allows implement permission interface for CommunityCDPWithdrawCollateralPermission.
|
||||
func (CommunityCDPWithdrawCollateralPermission) Allows(_ sdk.Context, _ ParamKeeper, p PubProposal) bool {
|
||||
_, ok := p.(*communitytypes.CommunityCDPWithdrawCollateralProposal)
|
||||
return ok
|
||||
}
|
||||
|
||||
// Allows implement permission interface for CommunityPoolLendWithdrawPermission.
|
||||
func (CommunityPoolLendWithdrawPermission) Allows(_ sdk.Context, _ ParamKeeper, p PubProposal) bool {
|
||||
_, ok := p.(*communitytypes.CommunityPoolLendWithdrawProposal)
|
||||
|
@ -172,6 +172,45 @@ func (m *CommunityCDPRepayDebtPermission) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_CommunityCDPRepayDebtPermission proto.InternalMessageInfo
|
||||
|
||||
// CommunityCDPWithdrawCollateralPermission allows submission of CommunityCDPWithdrawCollateralProposal
|
||||
type CommunityCDPWithdrawCollateralPermission struct {
|
||||
}
|
||||
|
||||
func (m *CommunityCDPWithdrawCollateralPermission) Reset() {
|
||||
*m = CommunityCDPWithdrawCollateralPermission{}
|
||||
}
|
||||
func (m *CommunityCDPWithdrawCollateralPermission) String() string { return proto.CompactTextString(m) }
|
||||
func (*CommunityCDPWithdrawCollateralPermission) ProtoMessage() {}
|
||||
func (*CommunityCDPWithdrawCollateralPermission) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_bdfaf7be16465ae4, []int{4}
|
||||
}
|
||||
func (m *CommunityCDPWithdrawCollateralPermission) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *CommunityCDPWithdrawCollateralPermission) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_CommunityCDPWithdrawCollateralPermission.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *CommunityCDPWithdrawCollateralPermission) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_CommunityCDPWithdrawCollateralPermission.Merge(m, src)
|
||||
}
|
||||
func (m *CommunityCDPWithdrawCollateralPermission) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *CommunityCDPWithdrawCollateralPermission) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_CommunityCDPWithdrawCollateralPermission.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_CommunityCDPWithdrawCollateralPermission proto.InternalMessageInfo
|
||||
|
||||
// CommunityPoolLendWithdrawPermission allows submission of CommunityPoolLendWithdrawProposal
|
||||
type CommunityPoolLendWithdrawPermission struct {
|
||||
}
|
||||
@ -180,7 +219,7 @@ func (m *CommunityPoolLendWithdrawPermission) Reset() { *m = CommunityPo
|
||||
func (m *CommunityPoolLendWithdrawPermission) String() string { return proto.CompactTextString(m) }
|
||||
func (*CommunityPoolLendWithdrawPermission) ProtoMessage() {}
|
||||
func (*CommunityPoolLendWithdrawPermission) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_bdfaf7be16465ae4, []int{4}
|
||||
return fileDescriptor_bdfaf7be16465ae4, []int{5}
|
||||
}
|
||||
func (m *CommunityPoolLendWithdrawPermission) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@ -218,7 +257,7 @@ func (m *ParamsChangePermission) Reset() { *m = ParamsChangePermission{}
|
||||
func (m *ParamsChangePermission) String() string { return proto.CompactTextString(m) }
|
||||
func (*ParamsChangePermission) ProtoMessage() {}
|
||||
func (*ParamsChangePermission) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_bdfaf7be16465ae4, []int{5}
|
||||
return fileDescriptor_bdfaf7be16465ae4, []int{6}
|
||||
}
|
||||
func (m *ParamsChangePermission) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@ -270,7 +309,7 @@ func (m *AllowedParamsChange) Reset() { *m = AllowedParamsChange{} }
|
||||
func (m *AllowedParamsChange) String() string { return proto.CompactTextString(m) }
|
||||
func (*AllowedParamsChange) ProtoMessage() {}
|
||||
func (*AllowedParamsChange) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_bdfaf7be16465ae4, []int{6}
|
||||
return fileDescriptor_bdfaf7be16465ae4, []int{7}
|
||||
}
|
||||
func (m *AllowedParamsChange) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@ -341,7 +380,7 @@ func (m *SubparamRequirement) Reset() { *m = SubparamRequirement{} }
|
||||
func (m *SubparamRequirement) String() string { return proto.CompactTextString(m) }
|
||||
func (*SubparamRequirement) ProtoMessage() {}
|
||||
func (*SubparamRequirement) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_bdfaf7be16465ae4, []int{7}
|
||||
return fileDescriptor_bdfaf7be16465ae4, []int{8}
|
||||
}
|
||||
func (m *SubparamRequirement) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@ -396,6 +435,7 @@ func init() {
|
||||
proto.RegisterType((*SoftwareUpgradePermission)(nil), "kava.committee.v1beta1.SoftwareUpgradePermission")
|
||||
proto.RegisterType((*TextPermission)(nil), "kava.committee.v1beta1.TextPermission")
|
||||
proto.RegisterType((*CommunityCDPRepayDebtPermission)(nil), "kava.committee.v1beta1.CommunityCDPRepayDebtPermission")
|
||||
proto.RegisterType((*CommunityCDPWithdrawCollateralPermission)(nil), "kava.committee.v1beta1.CommunityCDPWithdrawCollateralPermission")
|
||||
proto.RegisterType((*CommunityPoolLendWithdrawPermission)(nil), "kava.committee.v1beta1.CommunityPoolLendWithdrawPermission")
|
||||
proto.RegisterType((*ParamsChangePermission)(nil), "kava.committee.v1beta1.ParamsChangePermission")
|
||||
proto.RegisterType((*AllowedParamsChange)(nil), "kava.committee.v1beta1.AllowedParamsChange")
|
||||
@ -407,38 +447,39 @@ func init() {
|
||||
}
|
||||
|
||||
var fileDescriptor_bdfaf7be16465ae4 = []byte{
|
||||
// 493 bytes of a gzipped FileDescriptorProto
|
||||
// 507 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x93, 0x4f, 0x8b, 0xd3, 0x40,
|
||||
0x18, 0x87, 0x1b, 0xb3, 0x88, 0x3b, 0xe2, 0xb2, 0x64, 0x4b, 0xc9, 0x86, 0x35, 0x2d, 0xf5, 0x52,
|
||||
0x28, 0x9b, 0x50, 0xc5, 0x8b, 0xb7, 0xb6, 0x2b, 0x5e, 0x3c, 0x94, 0xac, 0x22, 0x78, 0x09, 0x93,
|
||||
0x66, 0x4c, 0xc3, 0x26, 0x99, 0x38, 0xef, 0x9b, 0x76, 0x0b, 0x82, 0x5f, 0xc1, 0xaf, 0xa1, 0x67,
|
||||
0x3f, 0xc4, 0xe2, 0xa9, 0x47, 0x4f, 0x2a, 0xed, 0xc7, 0xf0, 0x22, 0xf9, 0xdb, 0x82, 0x21, 0xb7,
|
||||
0x99, 0x77, 0x9e, 0xdf, 0x3b, 0xf3, 0xcc, 0x30, 0x64, 0x70, 0x43, 0x97, 0xd4, 0x9c, 0xf3, 0x30,
|
||||
0xf4, 0x11, 0x19, 0x33, 0x97, 0x23, 0x87, 0x21, 0x1d, 0x99, 0x31, 0x13, 0xa1, 0x0f, 0xe0, 0xf3,
|
||||
0x08, 0x8c, 0x58, 0x70, 0xe4, 0x4a, 0x27, 0x25, 0x8d, 0x8a, 0x34, 0x0a, 0x52, 0x3b, 0x9f, 0x73,
|
||||
0x08, 0x39, 0xd8, 0x19, 0x65, 0xe6, 0x93, 0x3c, 0xa2, 0xb5, 0x3d, 0xee, 0xf1, 0xbc, 0x9e, 0x8e,
|
||||
0xf2, 0x6a, 0xbf, 0x4b, 0x1e, 0xbd, 0xe2, 0xee, 0xac, 0xda, 0xe0, 0xc5, 0xc9, 0x8f, 0xef, 0x97,
|
||||
0x64, 0x3f, 0xef, 0x0f, 0xc9, 0xf9, 0x35, 0xff, 0x80, 0x2b, 0x2a, 0xd8, 0xdb, 0xd8, 0x13, 0xd4,
|
||||
0x65, 0x0d, 0x70, 0x8f, 0x9c, 0xbc, 0x61, 0xb7, 0xd8, 0x40, 0x8c, 0x48, 0x77, 0xca, 0xc3, 0x30,
|
||||
0x89, 0x7c, 0x5c, 0x4f, 0xaf, 0x66, 0x16, 0x8b, 0xe9, 0xfa, 0x8a, 0x39, 0x4d, 0x91, 0xe7, 0xe4,
|
||||
0x49, 0x15, 0x99, 0x71, 0x1e, 0xbc, 0x66, 0x91, 0xfb, 0xce, 0xc7, 0x85, 0x2b, 0xe8, 0xaa, 0x21,
|
||||
0xf6, 0x55, 0x22, 0x9d, 0x19, 0x15, 0x34, 0x84, 0xe9, 0x82, 0x46, 0xde, 0xc1, 0xb1, 0x95, 0xcf,
|
||||
0xa4, 0x43, 0x83, 0x80, 0xaf, 0x98, 0x6b, 0xc7, 0x19, 0x61, 0xcf, 0x33, 0x04, 0x54, 0xa9, 0x27,
|
||||
0x0f, 0x1e, 0x3e, 0x1d, 0x1a, 0xf5, 0xd7, 0x6b, 0x8c, 0xf3, 0xd4, 0x61, 0xdb, 0xc9, 0xc5, 0xdd,
|
||||
0xaf, 0x6e, 0xeb, 0xdb, 0xef, 0x6e, 0xbb, 0x66, 0x11, 0xac, 0x36, 0xad, 0xa9, 0xfe, 0x77, 0xd6,
|
||||
0xbf, 0x12, 0x39, 0xab, 0x89, 0x2b, 0x1a, 0x79, 0x00, 0x89, 0x03, 0x31, 0x9d, 0x33, 0x55, 0xea,
|
||||
0x49, 0x83, 0x63, 0xab, 0x9a, 0x2b, 0xa7, 0x44, 0xbe, 0x61, 0x6b, 0xf5, 0x5e, 0x56, 0x4e, 0x87,
|
||||
0xca, 0x98, 0x3c, 0x06, 0x3f, 0xf2, 0x02, 0x66, 0x43, 0xe2, 0x64, 0x62, 0x76, 0xa9, 0x49, 0x11,
|
||||
0x05, 0xa8, 0x72, 0x4f, 0x1e, 0x1c, 0x5b, 0x5a, 0x0e, 0x5d, 0x17, 0x4c, 0xb1, 0xef, 0x38, 0x25,
|
||||
0x14, 0x20, 0x17, 0x61, 0x12, 0xa0, 0x5f, 0x75, 0x00, 0x5b, 0xb0, 0x8f, 0x89, 0x2f, 0x58, 0xc8,
|
||||
0x22, 0x04, 0xf5, 0xa8, 0xf9, 0x7e, 0xca, 0x9e, 0xd6, 0x3e, 0x33, 0x39, 0x4a, 0xef, 0xc7, 0xd2,
|
||||
0xb2, 0xb6, 0xe5, 0x3a, 0x1c, 0x00, 0xd0, 0xff, 0x44, 0xce, 0x6a, 0x82, 0xa5, 0xa0, 0xb4, 0x17,
|
||||
0x3c, 0x25, 0xf2, 0x92, 0x06, 0xa5, 0xf2, 0x92, 0x06, 0xa9, 0x72, 0xa9, 0xb8, 0x77, 0x46, 0x14,
|
||||
0xd5, 0x83, 0x16, 0xca, 0x05, 0x54, 0x39, 0x23, 0x8a, 0xe2, 0x2d, 0x26, 0x2f, 0xef, 0xb6, 0xba,
|
||||
0xb4, 0xd9, 0xea, 0xd2, 0x9f, 0xad, 0x2e, 0x7d, 0xd9, 0xe9, 0xad, 0xcd, 0x4e, 0x6f, 0xfd, 0xdc,
|
||||
0xe9, 0xad, 0xf7, 0x43, 0xcf, 0xc7, 0x45, 0xe2, 0xa4, 0x9e, 0x66, 0x2a, 0x7c, 0x19, 0x50, 0x07,
|
||||
0xb2, 0x91, 0x79, 0x7b, 0xf0, 0x4b, 0x71, 0x1d, 0x33, 0x70, 0xee, 0x67, 0xff, 0xe9, 0xd9, 0xbf,
|
||||
0x00, 0x00, 0x00, 0xff, 0xff, 0x85, 0x2f, 0x94, 0x6f, 0xc4, 0x03, 0x00, 0x00,
|
||||
0x18, 0x87, 0x1b, 0xb3, 0x88, 0x3b, 0xe2, 0xb2, 0x64, 0x4b, 0xc9, 0x86, 0x35, 0x2d, 0xf5, 0x12,
|
||||
0x28, 0x9b, 0x50, 0xc5, 0xcb, 0xde, 0xda, 0xae, 0x78, 0xf1, 0x50, 0xb2, 0x8a, 0xe0, 0x25, 0x4c,
|
||||
0x9a, 0x31, 0x0d, 0x3b, 0xc9, 0xc4, 0x79, 0x27, 0xed, 0x16, 0x04, 0xbf, 0x82, 0x5f, 0x43, 0xcf,
|
||||
0x7e, 0x88, 0xc5, 0xd3, 0x1e, 0x3d, 0xa9, 0xb4, 0x1f, 0xc3, 0x8b, 0xe4, 0x6f, 0x03, 0x1b, 0x72,
|
||||
0x9b, 0x79, 0xf3, 0xfc, 0xde, 0xc9, 0x33, 0x2f, 0x83, 0x8c, 0x6b, 0xbc, 0xc2, 0xd6, 0x82, 0x85,
|
||||
0x61, 0x20, 0x04, 0x21, 0xd6, 0x6a, 0xec, 0x12, 0x81, 0xc7, 0x56, 0x4c, 0x78, 0x18, 0x00, 0x04,
|
||||
0x2c, 0x02, 0x33, 0xe6, 0x4c, 0x30, 0xa5, 0x97, 0x92, 0x66, 0x45, 0x9a, 0x05, 0xa9, 0x9d, 0x2e,
|
||||
0x18, 0x84, 0x0c, 0x9c, 0x8c, 0xb2, 0xf2, 0x4d, 0x1e, 0xd1, 0xba, 0x3e, 0xf3, 0x59, 0x5e, 0x4f,
|
||||
0x57, 0x79, 0x75, 0xd8, 0x47, 0x4f, 0x5e, 0x33, 0x6f, 0x5e, 0x1d, 0x70, 0x71, 0xf4, 0xf3, 0xc7,
|
||||
0x39, 0xda, 0xef, 0x87, 0x23, 0x74, 0x7a, 0xc5, 0x3e, 0x8a, 0x35, 0xe6, 0xe4, 0x5d, 0xec, 0x73,
|
||||
0xec, 0x91, 0x16, 0x78, 0x80, 0x8e, 0xde, 0x92, 0x1b, 0xd1, 0x42, 0x8c, 0x51, 0x7f, 0xc6, 0xc2,
|
||||
0x30, 0x89, 0x02, 0xb1, 0x99, 0x5d, 0xce, 0x6d, 0x12, 0xe3, 0xcd, 0x25, 0x71, 0xdb, 0x22, 0x17,
|
||||
0xc8, 0xa8, 0x47, 0xde, 0x07, 0x62, 0xe9, 0x71, 0xbc, 0x9e, 0x31, 0x4a, 0xb1, 0x20, 0x1c, 0xd3,
|
||||
0x96, 0xec, 0x4b, 0xf4, 0xac, 0xca, 0xce, 0x19, 0xa3, 0x6f, 0x48, 0xe4, 0x95, 0x0d, 0x5a, 0x62,
|
||||
0xdf, 0x24, 0xd4, 0x9b, 0x63, 0x8e, 0x43, 0x98, 0x2d, 0x71, 0xe4, 0xd7, 0x94, 0x95, 0x2f, 0xa8,
|
||||
0x87, 0x29, 0x65, 0x6b, 0xe2, 0x39, 0x71, 0x46, 0x38, 0x8b, 0x0c, 0x01, 0x55, 0x1a, 0xc8, 0xc6,
|
||||
0xe3, 0xe7, 0x23, 0xb3, 0x79, 0x34, 0xe6, 0x24, 0x4f, 0xd5, 0xdb, 0x4e, 0xcf, 0x6e, 0x7f, 0xf7,
|
||||
0x3b, 0xdf, 0xff, 0xf4, 0xbb, 0x0d, 0x1f, 0xc1, 0xee, 0xe2, 0x86, 0xea, 0xbd, 0x7f, 0xfd, 0x27,
|
||||
0xa1, 0x93, 0x86, 0xb8, 0xa2, 0xa1, 0x47, 0x90, 0xb8, 0x10, 0xe3, 0x05, 0x51, 0xa5, 0x81, 0x64,
|
||||
0x1c, 0xda, 0xd5, 0x5e, 0x39, 0x46, 0xf2, 0x35, 0xd9, 0xa8, 0x0f, 0xb2, 0x72, 0xba, 0x54, 0x26,
|
||||
0xe8, 0x29, 0x04, 0x91, 0x4f, 0x89, 0x03, 0x89, 0x9b, 0x89, 0x39, 0xa5, 0x26, 0x16, 0x82, 0x83,
|
||||
0x2a, 0x0f, 0x64, 0xe3, 0xd0, 0xd6, 0x72, 0xe8, 0xaa, 0x60, 0x8a, 0x73, 0x27, 0x29, 0xa1, 0x00,
|
||||
0x3a, 0x0b, 0x13, 0x2a, 0x82, 0xaa, 0x03, 0x38, 0x9c, 0x7c, 0x4a, 0x02, 0x4e, 0x42, 0x12, 0x09,
|
||||
0x50, 0x0f, 0xda, 0xef, 0xa7, 0xec, 0x69, 0xef, 0x33, 0xd3, 0x83, 0xf4, 0x7e, 0x6c, 0x2d, 0x6b,
|
||||
0x5b, 0x7e, 0x87, 0x1a, 0x00, 0xc3, 0xcf, 0xe8, 0xa4, 0x21, 0x58, 0x0a, 0x4a, 0x7b, 0xc1, 0x63,
|
||||
0x24, 0xaf, 0x30, 0x2d, 0x95, 0x57, 0x98, 0xa6, 0xca, 0xa5, 0xe2, 0xde, 0x59, 0x08, 0x5e, 0x0d,
|
||||
0xb4, 0x50, 0x2e, 0xa0, 0xca, 0x59, 0x08, 0x5e, 0xcc, 0x62, 0xfa, 0xea, 0x76, 0xab, 0x4b, 0x77,
|
||||
0x5b, 0x5d, 0xfa, 0xbb, 0xd5, 0xa5, 0xaf, 0x3b, 0xbd, 0x73, 0xb7, 0xd3, 0x3b, 0xbf, 0x76, 0x7a,
|
||||
0xe7, 0xc3, 0xc8, 0x0f, 0xc4, 0x32, 0x71, 0x53, 0x4f, 0x2b, 0x15, 0x3e, 0xa7, 0xd8, 0x85, 0x6c,
|
||||
0x65, 0xdd, 0xd4, 0x5e, 0xb8, 0xd8, 0xc4, 0x04, 0xdc, 0x87, 0xd9, 0x5b, 0x7c, 0xf1, 0x3f, 0x00,
|
||||
0x00, 0xff, 0xff, 0x64, 0xe8, 0xa8, 0x0a, 0x00, 0x04, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *GodPermission) Marshal() (dAtA []byte, err error) {
|
||||
@ -533,6 +574,29 @@ func (m *CommunityCDPRepayDebtPermission) MarshalToSizedBuffer(dAtA []byte) (int
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *CommunityCDPWithdrawCollateralPermission) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *CommunityCDPWithdrawCollateralPermission) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *CommunityCDPWithdrawCollateralPermission) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *CommunityPoolLendWithdrawPermission) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
@ -746,6 +810,15 @@ func (m *CommunityCDPRepayDebtPermission) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *CommunityCDPWithdrawCollateralPermission) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *CommunityPoolLendWithdrawPermission) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
@ -1028,6 +1101,56 @@ func (m *CommunityCDPRepayDebtPermission) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *CommunityCDPWithdrawCollateralPermission) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowPermissions
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: CommunityCDPWithdrawCollateralPermission: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: CommunityCDPWithdrawCollateralPermission: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipPermissions(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthPermissions
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *CommunityPoolLendWithdrawPermission) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
@ -116,6 +116,44 @@ func TestCommunityPoolLendWithdrawPermission_Allows(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCommunityCDPWithdrawCollateralPermission_Allows(t *testing.T) {
|
||||
permission := types.CommunityCDPWithdrawCollateralPermission{}
|
||||
testcases := []struct {
|
||||
name string
|
||||
proposal types.PubProposal
|
||||
allowed bool
|
||||
}{
|
||||
{
|
||||
name: "allowed for correct proposal",
|
||||
proposal: communitytypes.NewCommunityCDPWithdrawCollateralProposal(
|
||||
"withdraw x/community cdp collateral",
|
||||
"yes",
|
||||
"collateral-type",
|
||||
sdk.NewInt64Coin("ukava", 1e10),
|
||||
),
|
||||
allowed: true,
|
||||
},
|
||||
{
|
||||
name: "fails for nil proposal",
|
||||
proposal: nil,
|
||||
allowed: false,
|
||||
},
|
||||
{
|
||||
name: "fails for wrong proposal",
|
||||
proposal: newTestParamsChangeProposalWithChanges([]paramsproposal.ParamChange{
|
||||
{Subspace: "cdp", Key: "DebtThreshold", Value: `test`},
|
||||
}),
|
||||
allowed: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testcases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
require.Equal(t, tc.allowed, permission.Allows(sdk.Context{}, nil, tc.proposal))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestParamsChangePermission_SimpleParamsChange_Allows(t *testing.T) {
|
||||
testPermission := types.ParamsChangePermission{
|
||||
AllowedParamsChanges: types.AllowedParamsChanges{
|
||||
|
Loading…
Reference in New Issue
Block a user