feat(x/protocolpool): Add Implementation for CreateContinuousFund and CancelContinuousFund features (#18471)
This commit is contained in:
parent
e2d76b3078
commit
6ffc209043
808
api/cosmos/protocolpool/v1/genesis.pulsar.go
Normal file
808
api/cosmos/protocolpool/v1/genesis.pulsar.go
Normal file
@ -0,0 +1,808 @@
|
||||
// Code generated by protoc-gen-go-pulsar. DO NOT EDIT.
|
||||
package protocolpoolv1
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
runtime "github.com/cosmos/cosmos-proto/runtime"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoiface "google.golang.org/protobuf/runtime/protoiface"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
io "io"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
var _ protoreflect.List = (*_GenesisState_1_list)(nil)
|
||||
|
||||
type _GenesisState_1_list struct {
|
||||
list *[]*ContinuousFund
|
||||
}
|
||||
|
||||
func (x *_GenesisState_1_list) Len() int {
|
||||
if x.list == nil {
|
||||
return 0
|
||||
}
|
||||
return len(*x.list)
|
||||
}
|
||||
|
||||
func (x *_GenesisState_1_list) Get(i int) protoreflect.Value {
|
||||
return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect())
|
||||
}
|
||||
|
||||
func (x *_GenesisState_1_list) Set(i int, value protoreflect.Value) {
|
||||
valueUnwrapped := value.Message()
|
||||
concreteValue := valueUnwrapped.Interface().(*ContinuousFund)
|
||||
(*x.list)[i] = concreteValue
|
||||
}
|
||||
|
||||
func (x *_GenesisState_1_list) Append(value protoreflect.Value) {
|
||||
valueUnwrapped := value.Message()
|
||||
concreteValue := valueUnwrapped.Interface().(*ContinuousFund)
|
||||
*x.list = append(*x.list, concreteValue)
|
||||
}
|
||||
|
||||
func (x *_GenesisState_1_list) AppendMutable() protoreflect.Value {
|
||||
v := new(ContinuousFund)
|
||||
*x.list = append(*x.list, v)
|
||||
return protoreflect.ValueOfMessage(v.ProtoReflect())
|
||||
}
|
||||
|
||||
func (x *_GenesisState_1_list) Truncate(n int) {
|
||||
for i := n; i < len(*x.list); i++ {
|
||||
(*x.list)[i] = nil
|
||||
}
|
||||
*x.list = (*x.list)[:n]
|
||||
}
|
||||
|
||||
func (x *_GenesisState_1_list) NewElement() protoreflect.Value {
|
||||
v := new(ContinuousFund)
|
||||
return protoreflect.ValueOfMessage(v.ProtoReflect())
|
||||
}
|
||||
|
||||
func (x *_GenesisState_1_list) IsValid() bool {
|
||||
return x.list != nil
|
||||
}
|
||||
|
||||
var _ protoreflect.List = (*_GenesisState_2_list)(nil)
|
||||
|
||||
type _GenesisState_2_list struct {
|
||||
list *[]*Budget
|
||||
}
|
||||
|
||||
func (x *_GenesisState_2_list) Len() int {
|
||||
if x.list == nil {
|
||||
return 0
|
||||
}
|
||||
return len(*x.list)
|
||||
}
|
||||
|
||||
func (x *_GenesisState_2_list) Get(i int) protoreflect.Value {
|
||||
return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect())
|
||||
}
|
||||
|
||||
func (x *_GenesisState_2_list) Set(i int, value protoreflect.Value) {
|
||||
valueUnwrapped := value.Message()
|
||||
concreteValue := valueUnwrapped.Interface().(*Budget)
|
||||
(*x.list)[i] = concreteValue
|
||||
}
|
||||
|
||||
func (x *_GenesisState_2_list) Append(value protoreflect.Value) {
|
||||
valueUnwrapped := value.Message()
|
||||
concreteValue := valueUnwrapped.Interface().(*Budget)
|
||||
*x.list = append(*x.list, concreteValue)
|
||||
}
|
||||
|
||||
func (x *_GenesisState_2_list) AppendMutable() protoreflect.Value {
|
||||
v := new(Budget)
|
||||
*x.list = append(*x.list, v)
|
||||
return protoreflect.ValueOfMessage(v.ProtoReflect())
|
||||
}
|
||||
|
||||
func (x *_GenesisState_2_list) Truncate(n int) {
|
||||
for i := n; i < len(*x.list); i++ {
|
||||
(*x.list)[i] = nil
|
||||
}
|
||||
*x.list = (*x.list)[:n]
|
||||
}
|
||||
|
||||
func (x *_GenesisState_2_list) NewElement() protoreflect.Value {
|
||||
v := new(Budget)
|
||||
return protoreflect.ValueOfMessage(v.ProtoReflect())
|
||||
}
|
||||
|
||||
func (x *_GenesisState_2_list) IsValid() bool {
|
||||
return x.list != nil
|
||||
}
|
||||
|
||||
var (
|
||||
md_GenesisState protoreflect.MessageDescriptor
|
||||
fd_GenesisState_continuous_fund protoreflect.FieldDescriptor
|
||||
fd_GenesisState_budget protoreflect.FieldDescriptor
|
||||
)
|
||||
|
||||
func init() {
|
||||
file_cosmos_protocolpool_v1_genesis_proto_init()
|
||||
md_GenesisState = File_cosmos_protocolpool_v1_genesis_proto.Messages().ByName("GenesisState")
|
||||
fd_GenesisState_continuous_fund = md_GenesisState.Fields().ByName("continuous_fund")
|
||||
fd_GenesisState_budget = md_GenesisState.Fields().ByName("budget")
|
||||
}
|
||||
|
||||
var _ protoreflect.Message = (*fastReflection_GenesisState)(nil)
|
||||
|
||||
type fastReflection_GenesisState GenesisState
|
||||
|
||||
func (x *GenesisState) ProtoReflect() protoreflect.Message {
|
||||
return (*fastReflection_GenesisState)(x)
|
||||
}
|
||||
|
||||
func (x *GenesisState) slowProtoReflect() protoreflect.Message {
|
||||
mi := &file_cosmos_protocolpool_v1_genesis_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
var _fastReflection_GenesisState_messageType fastReflection_GenesisState_messageType
|
||||
var _ protoreflect.MessageType = fastReflection_GenesisState_messageType{}
|
||||
|
||||
type fastReflection_GenesisState_messageType struct{}
|
||||
|
||||
func (x fastReflection_GenesisState_messageType) Zero() protoreflect.Message {
|
||||
return (*fastReflection_GenesisState)(nil)
|
||||
}
|
||||
func (x fastReflection_GenesisState_messageType) New() protoreflect.Message {
|
||||
return new(fastReflection_GenesisState)
|
||||
}
|
||||
func (x fastReflection_GenesisState_messageType) Descriptor() protoreflect.MessageDescriptor {
|
||||
return md_GenesisState
|
||||
}
|
||||
|
||||
// Descriptor returns message descriptor, which contains only the protobuf
|
||||
// type information for the message.
|
||||
func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor {
|
||||
return md_GenesisState
|
||||
}
|
||||
|
||||
// Type returns the message type, which encapsulates both Go and protobuf
|
||||
// type information. If the Go type information is not needed,
|
||||
// it is recommended that the message descriptor be used instead.
|
||||
func (x *fastReflection_GenesisState) Type() protoreflect.MessageType {
|
||||
return _fastReflection_GenesisState_messageType
|
||||
}
|
||||
|
||||
// New returns a newly allocated and mutable empty message.
|
||||
func (x *fastReflection_GenesisState) New() protoreflect.Message {
|
||||
return new(fastReflection_GenesisState)
|
||||
}
|
||||
|
||||
// Interface unwraps the message reflection interface and
|
||||
// returns the underlying ProtoMessage interface.
|
||||
func (x *fastReflection_GenesisState) Interface() protoreflect.ProtoMessage {
|
||||
return (*GenesisState)(x)
|
||||
}
|
||||
|
||||
// Range iterates over every populated field in an undefined order,
|
||||
// calling f for each field descriptor and value encountered.
|
||||
// Range returns immediately if f returns false.
|
||||
// While iterating, mutating operations may only be performed
|
||||
// on the current field descriptor.
|
||||
func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||
if len(x.ContinuousFund) != 0 {
|
||||
value := protoreflect.ValueOfList(&_GenesisState_1_list{list: &x.ContinuousFund})
|
||||
if !f(fd_GenesisState_continuous_fund, value) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(x.Budget) != 0 {
|
||||
value := protoreflect.ValueOfList(&_GenesisState_2_list{list: &x.Budget})
|
||||
if !f(fd_GenesisState_budget, value) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Has reports whether a field is populated.
|
||||
//
|
||||
// Some fields have the property of nullability where it is possible to
|
||||
// distinguish between the default value of a field and whether the field
|
||||
// was explicitly populated with the default value. Singular message fields,
|
||||
// member fields of a oneof, and proto2 scalar fields are nullable. Such
|
||||
// fields are populated only if explicitly set.
|
||||
//
|
||||
// In other cases (aside from the nullable cases above),
|
||||
// a proto3 scalar field is populated if it contains a non-zero value, and
|
||||
// a repeated field is populated if it is non-empty.
|
||||
func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.protocolpool.v1.GenesisState.continuous_fund":
|
||||
return len(x.ContinuousFund) != 0
|
||||
case "cosmos.protocolpool.v1.GenesisState.budget":
|
||||
return len(x.Budget) != 0
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.protocolpool.v1.GenesisState"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.protocolpool.v1.GenesisState does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// Clear clears the field such that a subsequent Has call reports false.
|
||||
//
|
||||
// Clearing an extension field clears both the extension type and value
|
||||
// associated with the given field number.
|
||||
//
|
||||
// Clear is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.protocolpool.v1.GenesisState.continuous_fund":
|
||||
x.ContinuousFund = nil
|
||||
case "cosmos.protocolpool.v1.GenesisState.budget":
|
||||
x.Budget = nil
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.protocolpool.v1.GenesisState"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.protocolpool.v1.GenesisState does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// Get retrieves the value for a field.
|
||||
//
|
||||
// For unpopulated scalars, it returns the default value, where
|
||||
// the default value of a bytes scalar is guaranteed to be a copy.
|
||||
// For unpopulated composite types, it returns an empty, read-only view
|
||||
// of the value; to obtain a mutable reference, use Mutable.
|
||||
func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch descriptor.FullName() {
|
||||
case "cosmos.protocolpool.v1.GenesisState.continuous_fund":
|
||||
if len(x.ContinuousFund) == 0 {
|
||||
return protoreflect.ValueOfList(&_GenesisState_1_list{})
|
||||
}
|
||||
listValue := &_GenesisState_1_list{list: &x.ContinuousFund}
|
||||
return protoreflect.ValueOfList(listValue)
|
||||
case "cosmos.protocolpool.v1.GenesisState.budget":
|
||||
if len(x.Budget) == 0 {
|
||||
return protoreflect.ValueOfList(&_GenesisState_2_list{})
|
||||
}
|
||||
listValue := &_GenesisState_2_list{list: &x.Budget}
|
||||
return protoreflect.ValueOfList(listValue)
|
||||
default:
|
||||
if descriptor.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.protocolpool.v1.GenesisState"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.protocolpool.v1.GenesisState does not contain field %s", descriptor.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// Set stores the value for a field.
|
||||
//
|
||||
// For a field belonging to a oneof, it implicitly clears any other field
|
||||
// that may be currently set within the same oneof.
|
||||
// For extension fields, it implicitly stores the provided ExtensionType.
|
||||
// When setting a composite type, it is unspecified whether the stored value
|
||||
// aliases the source's memory in any way. If the composite value is an
|
||||
// empty, read-only value, then it panics.
|
||||
//
|
||||
// Set is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.protocolpool.v1.GenesisState.continuous_fund":
|
||||
lv := value.List()
|
||||
clv := lv.(*_GenesisState_1_list)
|
||||
x.ContinuousFund = *clv.list
|
||||
case "cosmos.protocolpool.v1.GenesisState.budget":
|
||||
lv := value.List()
|
||||
clv := lv.(*_GenesisState_2_list)
|
||||
x.Budget = *clv.list
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.protocolpool.v1.GenesisState"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.protocolpool.v1.GenesisState does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// Mutable returns a mutable reference to a composite type.
|
||||
//
|
||||
// If the field is unpopulated, it may allocate a composite value.
|
||||
// For a field belonging to a oneof, it implicitly clears any other field
|
||||
// that may be currently set within the same oneof.
|
||||
// For extension fields, it implicitly stores the provided ExtensionType
|
||||
// if not already stored.
|
||||
// It panics if the field does not contain a composite type.
|
||||
//
|
||||
// Mutable is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.protocolpool.v1.GenesisState.continuous_fund":
|
||||
if x.ContinuousFund == nil {
|
||||
x.ContinuousFund = []*ContinuousFund{}
|
||||
}
|
||||
value := &_GenesisState_1_list{list: &x.ContinuousFund}
|
||||
return protoreflect.ValueOfList(value)
|
||||
case "cosmos.protocolpool.v1.GenesisState.budget":
|
||||
if x.Budget == nil {
|
||||
x.Budget = []*Budget{}
|
||||
}
|
||||
value := &_GenesisState_2_list{list: &x.Budget}
|
||||
return protoreflect.ValueOfList(value)
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.protocolpool.v1.GenesisState"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.protocolpool.v1.GenesisState does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// NewField returns a new value that is assignable to the field
|
||||
// for the given descriptor. For scalars, this returns the default value.
|
||||
// For lists, maps, and messages, this returns a new, empty, mutable value.
|
||||
func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.protocolpool.v1.GenesisState.continuous_fund":
|
||||
list := []*ContinuousFund{}
|
||||
return protoreflect.ValueOfList(&_GenesisState_1_list{list: &list})
|
||||
case "cosmos.protocolpool.v1.GenesisState.budget":
|
||||
list := []*Budget{}
|
||||
return protoreflect.ValueOfList(&_GenesisState_2_list{list: &list})
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.protocolpool.v1.GenesisState"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.protocolpool.v1.GenesisState does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// WhichOneof reports which field within the oneof is populated,
|
||||
// returning nil if none are populated.
|
||||
// It panics if the oneof descriptor does not belong to this message.
|
||||
func (x *fastReflection_GenesisState) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
|
||||
switch d.FullName() {
|
||||
default:
|
||||
panic(fmt.Errorf("%s is not a oneof field in cosmos.protocolpool.v1.GenesisState", d.FullName()))
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
// GetUnknown retrieves the entire list of unknown fields.
|
||||
// The caller may only mutate the contents of the RawFields
|
||||
// if the mutated bytes are stored back into the message with SetUnknown.
|
||||
func (x *fastReflection_GenesisState) GetUnknown() protoreflect.RawFields {
|
||||
return x.unknownFields
|
||||
}
|
||||
|
||||
// SetUnknown stores an entire list of unknown fields.
|
||||
// The raw fields must be syntactically valid according to the wire format.
|
||||
// An implementation may panic if this is not the case.
|
||||
// Once stored, the caller must not mutate the content of the RawFields.
|
||||
// An empty RawFields may be passed to clear the fields.
|
||||
//
|
||||
// SetUnknown is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_GenesisState) SetUnknown(fields protoreflect.RawFields) {
|
||||
x.unknownFields = fields
|
||||
}
|
||||
|
||||
// IsValid reports whether the message is valid.
|
||||
//
|
||||
// An invalid message is an empty, read-only value.
|
||||
//
|
||||
// An invalid message often corresponds to a nil pointer of the concrete
|
||||
// message type, but the details are implementation dependent.
|
||||
// Validity is not part of the protobuf data model, and may not
|
||||
// be preserved in marshaling or other operations.
|
||||
func (x *fastReflection_GenesisState) IsValid() bool {
|
||||
return x != nil
|
||||
}
|
||||
|
||||
// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations.
|
||||
// This method may return nil.
|
||||
//
|
||||
// The returned methods type is identical to
|
||||
// "google.golang.org/protobuf/runtime/protoiface".Methods.
|
||||
// Consult the protoiface package documentation for details.
|
||||
func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods {
|
||||
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
|
||||
x := input.Message.Interface().(*GenesisState)
|
||||
if x == nil {
|
||||
return protoiface.SizeOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Size: 0,
|
||||
}
|
||||
}
|
||||
options := runtime.SizeInputToOptions(input)
|
||||
_ = options
|
||||
var n int
|
||||
var l int
|
||||
_ = l
|
||||
if len(x.ContinuousFund) > 0 {
|
||||
for _, e := range x.ContinuousFund {
|
||||
l = options.Size(e)
|
||||
n += 1 + l + runtime.Sov(uint64(l))
|
||||
}
|
||||
}
|
||||
if len(x.Budget) > 0 {
|
||||
for _, e := range x.Budget {
|
||||
l = options.Size(e)
|
||||
n += 1 + l + runtime.Sov(uint64(l))
|
||||
}
|
||||
}
|
||||
if x.unknownFields != nil {
|
||||
n += len(x.unknownFields)
|
||||
}
|
||||
return protoiface.SizeOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Size: n,
|
||||
}
|
||||
}
|
||||
|
||||
marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
|
||||
x := input.Message.Interface().(*GenesisState)
|
||||
if x == nil {
|
||||
return protoiface.MarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Buf: input.Buf,
|
||||
}, nil
|
||||
}
|
||||
options := runtime.MarshalInputToOptions(input)
|
||||
_ = options
|
||||
size := options.Size(x)
|
||||
dAtA := make([]byte, size)
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if x.unknownFields != nil {
|
||||
i -= len(x.unknownFields)
|
||||
copy(dAtA[i:], x.unknownFields)
|
||||
}
|
||||
if len(x.Budget) > 0 {
|
||||
for iNdEx := len(x.Budget) - 1; iNdEx >= 0; iNdEx-- {
|
||||
encoded, err := options.Marshal(x.Budget[iNdEx])
|
||||
if err != nil {
|
||||
return protoiface.MarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Buf: input.Buf,
|
||||
}, err
|
||||
}
|
||||
i -= len(encoded)
|
||||
copy(dAtA[i:], encoded)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
}
|
||||
if len(x.ContinuousFund) > 0 {
|
||||
for iNdEx := len(x.ContinuousFund) - 1; iNdEx >= 0; iNdEx-- {
|
||||
encoded, err := options.Marshal(x.ContinuousFund[iNdEx])
|
||||
if err != nil {
|
||||
return protoiface.MarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Buf: input.Buf,
|
||||
}, err
|
||||
}
|
||||
i -= len(encoded)
|
||||
copy(dAtA[i:], encoded)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
}
|
||||
if input.Buf != nil {
|
||||
input.Buf = append(input.Buf, dAtA...)
|
||||
} else {
|
||||
input.Buf = dAtA
|
||||
}
|
||||
return protoiface.MarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Buf: input.Buf,
|
||||
}, nil
|
||||
}
|
||||
unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
|
||||
x := input.Message.Interface().(*GenesisState)
|
||||
if x == nil {
|
||||
return protoiface.UnmarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Flags: input.Flags,
|
||||
}, nil
|
||||
}
|
||||
options := runtime.UnmarshalInputToOptions(input)
|
||||
_ = options
|
||||
dAtA := input.Buf
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ContinuousFund", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
if postIndex > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
x.ContinuousFund = append(x.ContinuousFund, &ContinuousFund{})
|
||||
if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ContinuousFund[len(x.ContinuousFund)-1]); err != nil {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Budget", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
if postIndex > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
x.Budget = append(x.Budget, &Budget{})
|
||||
if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Budget[len(x.Budget)-1]); err != nil {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := runtime.Skip(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
if !options.DiscardUnknown {
|
||||
x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil
|
||||
}
|
||||
return &protoiface.Methods{
|
||||
NoUnkeyedLiterals: struct{}{},
|
||||
Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,
|
||||
Size: size,
|
||||
Marshal: marshal,
|
||||
Unmarshal: unmarshal,
|
||||
Merge: nil,
|
||||
CheckInitialized: nil,
|
||||
}
|
||||
}
|
||||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.0
|
||||
// protoc (unknown)
|
||||
// source: cosmos/protocolpool/v1/genesis.proto
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// GenesisState defines the protocolpool module's genesis state.
|
||||
type GenesisState struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// ContinuousFund defines the continuous funds at genesis.
|
||||
ContinuousFund []*ContinuousFund `protobuf:"bytes,1,rep,name=continuous_fund,json=continuousFund,proto3" json:"continuous_fund,omitempty"`
|
||||
// Budget defines the budget proposals at genesis.
|
||||
Budget []*Budget `protobuf:"bytes,2,rep,name=budget,proto3" json:"budget,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GenesisState) Reset() {
|
||||
*x = GenesisState{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_cosmos_protocolpool_v1_genesis_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GenesisState) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GenesisState) ProtoMessage() {}
|
||||
|
||||
// Deprecated: Use GenesisState.ProtoReflect.Descriptor instead.
|
||||
func (*GenesisState) Descriptor() ([]byte, []int) {
|
||||
return file_cosmos_protocolpool_v1_genesis_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *GenesisState) GetContinuousFund() []*ContinuousFund {
|
||||
if x != nil {
|
||||
return x.ContinuousFund
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *GenesisState) GetBudget() []*Budget {
|
||||
if x != nil {
|
||||
return x.Budget
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_cosmos_protocolpool_v1_genesis_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_cosmos_protocolpool_v1_genesis_proto_rawDesc = []byte{
|
||||
0x0a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f,
|
||||
0x6c, 0x70, 0x6f, 0x6f, 0x6c, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x70, 0x6f, 0x6f, 0x6c, 0x2e, 0x76, 0x31, 0x1a, 0x22,
|
||||
0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x70,
|
||||
0x6f, 0x6f, 0x6c, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x22, 0x97, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74,
|
||||
0x61, 0x74, 0x65, 0x12, 0x4f, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x6f, 0x75,
|
||||
0x73, 0x5f, 0x66, 0x75, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63,
|
||||
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x70, 0x6f,
|
||||
0x6f, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x6f, 0x75, 0x73,
|
||||
0x46, 0x75, 0x6e, 0x64, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x6f, 0x75, 0x73,
|
||||
0x46, 0x75, 0x6e, 0x64, 0x12, 0x36, 0x0a, 0x06, 0x62, 0x75, 0x64, 0x67, 0x65, 0x74, 0x18, 0x02,
|
||||
0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x70, 0x6f, 0x6f, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x75,
|
||||
0x64, 0x67, 0x65, 0x74, 0x52, 0x06, 0x62, 0x75, 0x64, 0x67, 0x65, 0x74, 0x42, 0xdc, 0x01, 0x0a,
|
||||
0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x63, 0x6f, 0x6c, 0x70, 0x6f, 0x6f, 0x6c, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x47, 0x65, 0x6e,
|
||||
0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x36, 0x63, 0x6f, 0x73,
|
||||
0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f,
|
||||
0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x70, 0x6f, 0x6f,
|
||||
0x6c, 0x2f, 0x76, 0x31, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x70, 0x6f, 0x6f,
|
||||
0x6c, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x50, 0x58, 0xaa, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d,
|
||||
0x6f, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x70, 0x6f, 0x6f, 0x6c, 0x2e,
|
||||
0x56, 0x31, 0xca, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x50, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x63, 0x6f, 0x6c, 0x70, 0x6f, 0x6f, 0x6c, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x22, 0x43, 0x6f,
|
||||
0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x70, 0x6f, 0x6f,
|
||||
0x6c, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,
|
||||
0xea, 0x02, 0x18, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x63, 0x6f, 0x6c, 0x70, 0x6f, 0x6f, 0x6c, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_cosmos_protocolpool_v1_genesis_proto_rawDescOnce sync.Once
|
||||
file_cosmos_protocolpool_v1_genesis_proto_rawDescData = file_cosmos_protocolpool_v1_genesis_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_cosmos_protocolpool_v1_genesis_proto_rawDescGZIP() []byte {
|
||||
file_cosmos_protocolpool_v1_genesis_proto_rawDescOnce.Do(func() {
|
||||
file_cosmos_protocolpool_v1_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_protocolpool_v1_genesis_proto_rawDescData)
|
||||
})
|
||||
return file_cosmos_protocolpool_v1_genesis_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_cosmos_protocolpool_v1_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_cosmos_protocolpool_v1_genesis_proto_goTypes = []interface{}{
|
||||
(*GenesisState)(nil), // 0: cosmos.protocolpool.v1.GenesisState
|
||||
(*ContinuousFund)(nil), // 1: cosmos.protocolpool.v1.ContinuousFund
|
||||
(*Budget)(nil), // 2: cosmos.protocolpool.v1.Budget
|
||||
}
|
||||
var file_cosmos_protocolpool_v1_genesis_proto_depIdxs = []int32{
|
||||
1, // 0: cosmos.protocolpool.v1.GenesisState.continuous_fund:type_name -> cosmos.protocolpool.v1.ContinuousFund
|
||||
2, // 1: cosmos.protocolpool.v1.GenesisState.budget:type_name -> cosmos.protocolpool.v1.Budget
|
||||
2, // [2:2] is the sub-list for method output_type
|
||||
2, // [2:2] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_cosmos_protocolpool_v1_genesis_proto_init() }
|
||||
func file_cosmos_protocolpool_v1_genesis_proto_init() {
|
||||
if File_cosmos_protocolpool_v1_genesis_proto != nil {
|
||||
return
|
||||
}
|
||||
file_cosmos_protocolpool_v1_types_proto_init()
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_cosmos_protocolpool_v1_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GenesisState); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_cosmos_protocolpool_v1_genesis_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_cosmos_protocolpool_v1_genesis_proto_goTypes,
|
||||
DependencyIndexes: file_cosmos_protocolpool_v1_genesis_proto_depIdxs,
|
||||
MessageInfos: file_cosmos_protocolpool_v1_genesis_proto_msgTypes,
|
||||
}.Build()
|
||||
File_cosmos_protocolpool_v1_genesis_proto = out.File
|
||||
file_cosmos_protocolpool_v1_genesis_proto_rawDesc = nil
|
||||
file_cosmos_protocolpool_v1_genesis_proto_goTypes = nil
|
||||
file_cosmos_protocolpool_v1_genesis_proto_depIdxs = nil
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -19,12 +19,13 @@ import (
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
const (
|
||||
Msg_FundCommunityPool_FullMethodName = "/cosmos.protocolpool.v1.Msg/FundCommunityPool"
|
||||
Msg_CommunityPoolSpend_FullMethodName = "/cosmos.protocolpool.v1.Msg/CommunityPoolSpend"
|
||||
Msg_SubmitBudgetProposal_FullMethodName = "/cosmos.protocolpool.v1.Msg/SubmitBudgetProposal"
|
||||
Msg_ClaimBudget_FullMethodName = "/cosmos.protocolpool.v1.Msg/ClaimBudget"
|
||||
Msg_CreateContinuousFund_FullMethodName = "/cosmos.protocolpool.v1.Msg/CreateContinuousFund"
|
||||
Msg_CancelContinuousFund_FullMethodName = "/cosmos.protocolpool.v1.Msg/CancelContinuousFund"
|
||||
Msg_FundCommunityPool_FullMethodName = "/cosmos.protocolpool.v1.Msg/FundCommunityPool"
|
||||
Msg_CommunityPoolSpend_FullMethodName = "/cosmos.protocolpool.v1.Msg/CommunityPoolSpend"
|
||||
Msg_SubmitBudgetProposal_FullMethodName = "/cosmos.protocolpool.v1.Msg/SubmitBudgetProposal"
|
||||
Msg_ClaimBudget_FullMethodName = "/cosmos.protocolpool.v1.Msg/ClaimBudget"
|
||||
Msg_CreateContinuousFund_FullMethodName = "/cosmos.protocolpool.v1.Msg/CreateContinuousFund"
|
||||
Msg_WithdrawContinuousFund_FullMethodName = "/cosmos.protocolpool.v1.Msg/WithdrawContinuousFund"
|
||||
Msg_CancelContinuousFund_FullMethodName = "/cosmos.protocolpool.v1.Msg/CancelContinuousFund"
|
||||
)
|
||||
|
||||
// MsgClient is the client API for Msg service.
|
||||
@ -45,6 +46,8 @@ type MsgClient interface {
|
||||
ClaimBudget(ctx context.Context, in *MsgClaimBudget, opts ...grpc.CallOption) (*MsgClaimBudgetResponse, error)
|
||||
// CreateContinuousFund defines a method to add funds continuously.
|
||||
CreateContinuousFund(ctx context.Context, in *MsgCreateContinuousFund, opts ...grpc.CallOption) (*MsgCreateContinuousFundResponse, error)
|
||||
// WithdrawContinuousFund defines a method to withdraw continuous fund allocated.
|
||||
WithdrawContinuousFund(ctx context.Context, in *MsgWithdrawContinuousFund, opts ...grpc.CallOption) (*MsgWithdrawContinuousFundResponse, error)
|
||||
// CancelContinuousFund defines a method for cancelling continuous fund.
|
||||
CancelContinuousFund(ctx context.Context, in *MsgCancelContinuousFund, opts ...grpc.CallOption) (*MsgCancelContinuousFundResponse, error)
|
||||
}
|
||||
@ -102,6 +105,15 @@ func (c *msgClient) CreateContinuousFund(ctx context.Context, in *MsgCreateConti
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) WithdrawContinuousFund(ctx context.Context, in *MsgWithdrawContinuousFund, opts ...grpc.CallOption) (*MsgWithdrawContinuousFundResponse, error) {
|
||||
out := new(MsgWithdrawContinuousFundResponse)
|
||||
err := c.cc.Invoke(ctx, Msg_WithdrawContinuousFund_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) CancelContinuousFund(ctx context.Context, in *MsgCancelContinuousFund, opts ...grpc.CallOption) (*MsgCancelContinuousFundResponse, error) {
|
||||
out := new(MsgCancelContinuousFundResponse)
|
||||
err := c.cc.Invoke(ctx, Msg_CancelContinuousFund_FullMethodName, in, out, opts...)
|
||||
@ -129,6 +141,8 @@ type MsgServer interface {
|
||||
ClaimBudget(context.Context, *MsgClaimBudget) (*MsgClaimBudgetResponse, error)
|
||||
// CreateContinuousFund defines a method to add funds continuously.
|
||||
CreateContinuousFund(context.Context, *MsgCreateContinuousFund) (*MsgCreateContinuousFundResponse, error)
|
||||
// WithdrawContinuousFund defines a method to withdraw continuous fund allocated.
|
||||
WithdrawContinuousFund(context.Context, *MsgWithdrawContinuousFund) (*MsgWithdrawContinuousFundResponse, error)
|
||||
// CancelContinuousFund defines a method for cancelling continuous fund.
|
||||
CancelContinuousFund(context.Context, *MsgCancelContinuousFund) (*MsgCancelContinuousFundResponse, error)
|
||||
mustEmbedUnimplementedMsgServer()
|
||||
@ -153,6 +167,9 @@ func (UnimplementedMsgServer) ClaimBudget(context.Context, *MsgClaimBudget) (*Ms
|
||||
func (UnimplementedMsgServer) CreateContinuousFund(context.Context, *MsgCreateContinuousFund) (*MsgCreateContinuousFundResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateContinuousFund not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) WithdrawContinuousFund(context.Context, *MsgWithdrawContinuousFund) (*MsgWithdrawContinuousFundResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method WithdrawContinuousFund not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) CancelContinuousFund(context.Context, *MsgCancelContinuousFund) (*MsgCancelContinuousFundResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CancelContinuousFund not implemented")
|
||||
}
|
||||
@ -259,6 +276,24 @@ func _Msg_CreateContinuousFund_Handler(srv interface{}, ctx context.Context, dec
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_WithdrawContinuousFund_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgWithdrawContinuousFund)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).WithdrawContinuousFund(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_WithdrawContinuousFund_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).WithdrawContinuousFund(ctx, req.(*MsgWithdrawContinuousFund))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_CancelContinuousFund_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgCancelContinuousFund)
|
||||
if err := dec(in); err != nil {
|
||||
@ -304,6 +339,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "CreateContinuousFund",
|
||||
Handler: _Msg_CreateContinuousFund_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "WithdrawContinuousFund",
|
||||
Handler: _Msg_WithdrawContinuousFund_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CancelContinuousFund",
|
||||
Handler: _Msg_CancelContinuousFund_Handler,
|
||||
|
||||
@ -928,6 +928,569 @@ func (x *fastReflection_Budget) ProtoMethods() *protoiface.Methods {
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
md_ContinuousFund protoreflect.MessageDescriptor
|
||||
fd_ContinuousFund_recipient protoreflect.FieldDescriptor
|
||||
fd_ContinuousFund_percentage protoreflect.FieldDescriptor
|
||||
fd_ContinuousFund_expiry protoreflect.FieldDescriptor
|
||||
)
|
||||
|
||||
func init() {
|
||||
file_cosmos_protocolpool_v1_types_proto_init()
|
||||
md_ContinuousFund = File_cosmos_protocolpool_v1_types_proto.Messages().ByName("ContinuousFund")
|
||||
fd_ContinuousFund_recipient = md_ContinuousFund.Fields().ByName("recipient")
|
||||
fd_ContinuousFund_percentage = md_ContinuousFund.Fields().ByName("percentage")
|
||||
fd_ContinuousFund_expiry = md_ContinuousFund.Fields().ByName("expiry")
|
||||
}
|
||||
|
||||
var _ protoreflect.Message = (*fastReflection_ContinuousFund)(nil)
|
||||
|
||||
type fastReflection_ContinuousFund ContinuousFund
|
||||
|
||||
func (x *ContinuousFund) ProtoReflect() protoreflect.Message {
|
||||
return (*fastReflection_ContinuousFund)(x)
|
||||
}
|
||||
|
||||
func (x *ContinuousFund) slowProtoReflect() protoreflect.Message {
|
||||
mi := &file_cosmos_protocolpool_v1_types_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
var _fastReflection_ContinuousFund_messageType fastReflection_ContinuousFund_messageType
|
||||
var _ protoreflect.MessageType = fastReflection_ContinuousFund_messageType{}
|
||||
|
||||
type fastReflection_ContinuousFund_messageType struct{}
|
||||
|
||||
func (x fastReflection_ContinuousFund_messageType) Zero() protoreflect.Message {
|
||||
return (*fastReflection_ContinuousFund)(nil)
|
||||
}
|
||||
func (x fastReflection_ContinuousFund_messageType) New() protoreflect.Message {
|
||||
return new(fastReflection_ContinuousFund)
|
||||
}
|
||||
func (x fastReflection_ContinuousFund_messageType) Descriptor() protoreflect.MessageDescriptor {
|
||||
return md_ContinuousFund
|
||||
}
|
||||
|
||||
// Descriptor returns message descriptor, which contains only the protobuf
|
||||
// type information for the message.
|
||||
func (x *fastReflection_ContinuousFund) Descriptor() protoreflect.MessageDescriptor {
|
||||
return md_ContinuousFund
|
||||
}
|
||||
|
||||
// Type returns the message type, which encapsulates both Go and protobuf
|
||||
// type information. If the Go type information is not needed,
|
||||
// it is recommended that the message descriptor be used instead.
|
||||
func (x *fastReflection_ContinuousFund) Type() protoreflect.MessageType {
|
||||
return _fastReflection_ContinuousFund_messageType
|
||||
}
|
||||
|
||||
// New returns a newly allocated and mutable empty message.
|
||||
func (x *fastReflection_ContinuousFund) New() protoreflect.Message {
|
||||
return new(fastReflection_ContinuousFund)
|
||||
}
|
||||
|
||||
// Interface unwraps the message reflection interface and
|
||||
// returns the underlying ProtoMessage interface.
|
||||
func (x *fastReflection_ContinuousFund) Interface() protoreflect.ProtoMessage {
|
||||
return (*ContinuousFund)(x)
|
||||
}
|
||||
|
||||
// Range iterates over every populated field in an undefined order,
|
||||
// calling f for each field descriptor and value encountered.
|
||||
// Range returns immediately if f returns false.
|
||||
// While iterating, mutating operations may only be performed
|
||||
// on the current field descriptor.
|
||||
func (x *fastReflection_ContinuousFund) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||
if x.Recipient != "" {
|
||||
value := protoreflect.ValueOfString(x.Recipient)
|
||||
if !f(fd_ContinuousFund_recipient, value) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if x.Percentage != "" {
|
||||
value := protoreflect.ValueOfString(x.Percentage)
|
||||
if !f(fd_ContinuousFund_percentage, value) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if x.Expiry != nil {
|
||||
value := protoreflect.ValueOfMessage(x.Expiry.ProtoReflect())
|
||||
if !f(fd_ContinuousFund_expiry, value) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Has reports whether a field is populated.
|
||||
//
|
||||
// Some fields have the property of nullability where it is possible to
|
||||
// distinguish between the default value of a field and whether the field
|
||||
// was explicitly populated with the default value. Singular message fields,
|
||||
// member fields of a oneof, and proto2 scalar fields are nullable. Such
|
||||
// fields are populated only if explicitly set.
|
||||
//
|
||||
// In other cases (aside from the nullable cases above),
|
||||
// a proto3 scalar field is populated if it contains a non-zero value, and
|
||||
// a repeated field is populated if it is non-empty.
|
||||
func (x *fastReflection_ContinuousFund) Has(fd protoreflect.FieldDescriptor) bool {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.protocolpool.v1.ContinuousFund.recipient":
|
||||
return x.Recipient != ""
|
||||
case "cosmos.protocolpool.v1.ContinuousFund.percentage":
|
||||
return x.Percentage != ""
|
||||
case "cosmos.protocolpool.v1.ContinuousFund.expiry":
|
||||
return x.Expiry != nil
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.protocolpool.v1.ContinuousFund"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.protocolpool.v1.ContinuousFund does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// Clear clears the field such that a subsequent Has call reports false.
|
||||
//
|
||||
// Clearing an extension field clears both the extension type and value
|
||||
// associated with the given field number.
|
||||
//
|
||||
// Clear is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_ContinuousFund) Clear(fd protoreflect.FieldDescriptor) {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.protocolpool.v1.ContinuousFund.recipient":
|
||||
x.Recipient = ""
|
||||
case "cosmos.protocolpool.v1.ContinuousFund.percentage":
|
||||
x.Percentage = ""
|
||||
case "cosmos.protocolpool.v1.ContinuousFund.expiry":
|
||||
x.Expiry = nil
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.protocolpool.v1.ContinuousFund"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.protocolpool.v1.ContinuousFund does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// Get retrieves the value for a field.
|
||||
//
|
||||
// For unpopulated scalars, it returns the default value, where
|
||||
// the default value of a bytes scalar is guaranteed to be a copy.
|
||||
// For unpopulated composite types, it returns an empty, read-only view
|
||||
// of the value; to obtain a mutable reference, use Mutable.
|
||||
func (x *fastReflection_ContinuousFund) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch descriptor.FullName() {
|
||||
case "cosmos.protocolpool.v1.ContinuousFund.recipient":
|
||||
value := x.Recipient
|
||||
return protoreflect.ValueOfString(value)
|
||||
case "cosmos.protocolpool.v1.ContinuousFund.percentage":
|
||||
value := x.Percentage
|
||||
return protoreflect.ValueOfString(value)
|
||||
case "cosmos.protocolpool.v1.ContinuousFund.expiry":
|
||||
value := x.Expiry
|
||||
return protoreflect.ValueOfMessage(value.ProtoReflect())
|
||||
default:
|
||||
if descriptor.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.protocolpool.v1.ContinuousFund"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.protocolpool.v1.ContinuousFund does not contain field %s", descriptor.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// Set stores the value for a field.
|
||||
//
|
||||
// For a field belonging to a oneof, it implicitly clears any other field
|
||||
// that may be currently set within the same oneof.
|
||||
// For extension fields, it implicitly stores the provided ExtensionType.
|
||||
// When setting a composite type, it is unspecified whether the stored value
|
||||
// aliases the source's memory in any way. If the composite value is an
|
||||
// empty, read-only value, then it panics.
|
||||
//
|
||||
// Set is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_ContinuousFund) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.protocolpool.v1.ContinuousFund.recipient":
|
||||
x.Recipient = value.Interface().(string)
|
||||
case "cosmos.protocolpool.v1.ContinuousFund.percentage":
|
||||
x.Percentage = value.Interface().(string)
|
||||
case "cosmos.protocolpool.v1.ContinuousFund.expiry":
|
||||
x.Expiry = value.Message().Interface().(*timestamppb.Timestamp)
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.protocolpool.v1.ContinuousFund"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.protocolpool.v1.ContinuousFund does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// Mutable returns a mutable reference to a composite type.
|
||||
//
|
||||
// If the field is unpopulated, it may allocate a composite value.
|
||||
// For a field belonging to a oneof, it implicitly clears any other field
|
||||
// that may be currently set within the same oneof.
|
||||
// For extension fields, it implicitly stores the provided ExtensionType
|
||||
// if not already stored.
|
||||
// It panics if the field does not contain a composite type.
|
||||
//
|
||||
// Mutable is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_ContinuousFund) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.protocolpool.v1.ContinuousFund.expiry":
|
||||
if x.Expiry == nil {
|
||||
x.Expiry = new(timestamppb.Timestamp)
|
||||
}
|
||||
return protoreflect.ValueOfMessage(x.Expiry.ProtoReflect())
|
||||
case "cosmos.protocolpool.v1.ContinuousFund.recipient":
|
||||
panic(fmt.Errorf("field recipient of message cosmos.protocolpool.v1.ContinuousFund is not mutable"))
|
||||
case "cosmos.protocolpool.v1.ContinuousFund.percentage":
|
||||
panic(fmt.Errorf("field percentage of message cosmos.protocolpool.v1.ContinuousFund is not mutable"))
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.protocolpool.v1.ContinuousFund"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.protocolpool.v1.ContinuousFund does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// NewField returns a new value that is assignable to the field
|
||||
// for the given descriptor. For scalars, this returns the default value.
|
||||
// For lists, maps, and messages, this returns a new, empty, mutable value.
|
||||
func (x *fastReflection_ContinuousFund) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.protocolpool.v1.ContinuousFund.recipient":
|
||||
return protoreflect.ValueOfString("")
|
||||
case "cosmos.protocolpool.v1.ContinuousFund.percentage":
|
||||
return protoreflect.ValueOfString("")
|
||||
case "cosmos.protocolpool.v1.ContinuousFund.expiry":
|
||||
m := new(timestamppb.Timestamp)
|
||||
return protoreflect.ValueOfMessage(m.ProtoReflect())
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.protocolpool.v1.ContinuousFund"))
|
||||
}
|
||||
panic(fmt.Errorf("message cosmos.protocolpool.v1.ContinuousFund does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// WhichOneof reports which field within the oneof is populated,
|
||||
// returning nil if none are populated.
|
||||
// It panics if the oneof descriptor does not belong to this message.
|
||||
func (x *fastReflection_ContinuousFund) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
|
||||
switch d.FullName() {
|
||||
default:
|
||||
panic(fmt.Errorf("%s is not a oneof field in cosmos.protocolpool.v1.ContinuousFund", d.FullName()))
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
// GetUnknown retrieves the entire list of unknown fields.
|
||||
// The caller may only mutate the contents of the RawFields
|
||||
// if the mutated bytes are stored back into the message with SetUnknown.
|
||||
func (x *fastReflection_ContinuousFund) GetUnknown() protoreflect.RawFields {
|
||||
return x.unknownFields
|
||||
}
|
||||
|
||||
// SetUnknown stores an entire list of unknown fields.
|
||||
// The raw fields must be syntactically valid according to the wire format.
|
||||
// An implementation may panic if this is not the case.
|
||||
// Once stored, the caller must not mutate the content of the RawFields.
|
||||
// An empty RawFields may be passed to clear the fields.
|
||||
//
|
||||
// SetUnknown is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_ContinuousFund) SetUnknown(fields protoreflect.RawFields) {
|
||||
x.unknownFields = fields
|
||||
}
|
||||
|
||||
// IsValid reports whether the message is valid.
|
||||
//
|
||||
// An invalid message is an empty, read-only value.
|
||||
//
|
||||
// An invalid message often corresponds to a nil pointer of the concrete
|
||||
// message type, but the details are implementation dependent.
|
||||
// Validity is not part of the protobuf data model, and may not
|
||||
// be preserved in marshaling or other operations.
|
||||
func (x *fastReflection_ContinuousFund) IsValid() bool {
|
||||
return x != nil
|
||||
}
|
||||
|
||||
// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations.
|
||||
// This method may return nil.
|
||||
//
|
||||
// The returned methods type is identical to
|
||||
// "google.golang.org/protobuf/runtime/protoiface".Methods.
|
||||
// Consult the protoiface package documentation for details.
|
||||
func (x *fastReflection_ContinuousFund) ProtoMethods() *protoiface.Methods {
|
||||
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
|
||||
x := input.Message.Interface().(*ContinuousFund)
|
||||
if x == nil {
|
||||
return protoiface.SizeOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Size: 0,
|
||||
}
|
||||
}
|
||||
options := runtime.SizeInputToOptions(input)
|
||||
_ = options
|
||||
var n int
|
||||
var l int
|
||||
_ = l
|
||||
l = len(x.Recipient)
|
||||
if l > 0 {
|
||||
n += 1 + l + runtime.Sov(uint64(l))
|
||||
}
|
||||
l = len(x.Percentage)
|
||||
if l > 0 {
|
||||
n += 1 + l + runtime.Sov(uint64(l))
|
||||
}
|
||||
if x.Expiry != nil {
|
||||
l = options.Size(x.Expiry)
|
||||
n += 1 + l + runtime.Sov(uint64(l))
|
||||
}
|
||||
if x.unknownFields != nil {
|
||||
n += len(x.unknownFields)
|
||||
}
|
||||
return protoiface.SizeOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Size: n,
|
||||
}
|
||||
}
|
||||
|
||||
marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
|
||||
x := input.Message.Interface().(*ContinuousFund)
|
||||
if x == nil {
|
||||
return protoiface.MarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Buf: input.Buf,
|
||||
}, nil
|
||||
}
|
||||
options := runtime.MarshalInputToOptions(input)
|
||||
_ = options
|
||||
size := options.Size(x)
|
||||
dAtA := make([]byte, size)
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if x.unknownFields != nil {
|
||||
i -= len(x.unknownFields)
|
||||
copy(dAtA[i:], x.unknownFields)
|
||||
}
|
||||
if x.Expiry != nil {
|
||||
encoded, err := options.Marshal(x.Expiry)
|
||||
if err != nil {
|
||||
return protoiface.MarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Buf: input.Buf,
|
||||
}, err
|
||||
}
|
||||
i -= len(encoded)
|
||||
copy(dAtA[i:], encoded)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
if len(x.Percentage) > 0 {
|
||||
i -= len(x.Percentage)
|
||||
copy(dAtA[i:], x.Percentage)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Percentage)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if len(x.Recipient) > 0 {
|
||||
i -= len(x.Recipient)
|
||||
copy(dAtA[i:], x.Recipient)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Recipient)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
if input.Buf != nil {
|
||||
input.Buf = append(input.Buf, dAtA...)
|
||||
} else {
|
||||
input.Buf = dAtA
|
||||
}
|
||||
return protoiface.MarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Buf: input.Buf,
|
||||
}, nil
|
||||
}
|
||||
unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
|
||||
x := input.Message.Interface().(*ContinuousFund)
|
||||
if x == nil {
|
||||
return protoiface.UnmarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Flags: input.Flags,
|
||||
}, nil
|
||||
}
|
||||
options := runtime.UnmarshalInputToOptions(input)
|
||||
_ = options
|
||||
dAtA := input.Buf
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ContinuousFund: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ContinuousFund: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
if postIndex > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
x.Recipient = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Percentage", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
if postIndex > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
x.Percentage = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Expiry", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
if postIndex > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
if x.Expiry == nil {
|
||||
x.Expiry = ×tamppb.Timestamp{}
|
||||
}
|
||||
if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Expiry); err != nil {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := runtime.Skip(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
if !options.DiscardUnknown {
|
||||
x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil
|
||||
}
|
||||
return &protoiface.Methods{
|
||||
NoUnkeyedLiterals: struct{}{},
|
||||
Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,
|
||||
Size: size,
|
||||
Marshal: marshal,
|
||||
Unmarshal: unmarshal,
|
||||
Merge: nil,
|
||||
CheckInitialized: nil,
|
||||
}
|
||||
}
|
||||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.0
|
||||
@ -1044,6 +1607,61 @@ func (x *Budget) GetPeriod() *durationpb.Duration {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContinuousFund defines the fields of continuous fund proposal.
|
||||
type ContinuousFund struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Recipient address of the account receiving funds.
|
||||
Recipient string `protobuf:"bytes,1,opt,name=recipient,proto3" json:"recipient,omitempty"`
|
||||
// Percentage is the percentage of funds to be allocated from Community pool.
|
||||
Percentage string `protobuf:"bytes,2,opt,name=percentage,proto3" json:"percentage,omitempty"`
|
||||
// Optional, if expiry is set, removes the state object when expired.
|
||||
Expiry *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=expiry,proto3" json:"expiry,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ContinuousFund) Reset() {
|
||||
*x = ContinuousFund{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_cosmos_protocolpool_v1_types_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ContinuousFund) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ContinuousFund) ProtoMessage() {}
|
||||
|
||||
// Deprecated: Use ContinuousFund.ProtoReflect.Descriptor instead.
|
||||
func (*ContinuousFund) Descriptor() ([]byte, []int) {
|
||||
return file_cosmos_protocolpool_v1_types_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *ContinuousFund) GetRecipient() string {
|
||||
if x != nil {
|
||||
return x.Recipient
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ContinuousFund) GetPercentage() string {
|
||||
if x != nil {
|
||||
return x.Percentage
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ContinuousFund) GetExpiry() *timestamppb.Timestamp {
|
||||
if x != nil {
|
||||
return x.Expiry
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_cosmos_protocolpool_v1_types_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_cosmos_protocolpool_v1_types_proto_rawDesc = []byte{
|
||||
@ -1089,21 +1707,35 @@ var file_cosmos_protocolpool_v1_types_proto_rawDesc = []byte{
|
||||
0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67,
|
||||
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44,
|
||||
0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x04, 0x98, 0xdf, 0x1f, 0x01, 0x52, 0x06, 0x70,
|
||||
0x65, 0x72, 0x69, 0x6f, 0x64, 0x42, 0xda, 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f,
|
||||
0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x70, 0x6f, 0x6f,
|
||||
0x6c, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x54, 0x79, 0x70, 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x50, 0x01, 0x5a, 0x36, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f,
|
||||
0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x63, 0x6f, 0x6c, 0x70, 0x6f, 0x6f, 0x6c, 0x2f, 0x76, 0x31, 0x3b, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x63, 0x6f, 0x6c, 0x70, 0x6f, 0x6f, 0x6c, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x50, 0x58,
|
||||
0xaa, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63,
|
||||
0x6f, 0x6c, 0x70, 0x6f, 0x6f, 0x6c, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d,
|
||||
0x6f, 0x73, 0x5c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x70, 0x6f, 0x6f, 0x6c, 0x5c,
|
||||
0x56, 0x31, 0xe2, 0x02, 0x22, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x50, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x63, 0x6f, 0x6c, 0x70, 0x6f, 0x6f, 0x6c, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d,
|
||||
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x18, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73,
|
||||
0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x70, 0x6f, 0x6f, 0x6c, 0x3a, 0x3a,
|
||||
0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x65, 0x72, 0x69, 0x6f, 0x64, 0x22, 0xd5, 0x01, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6e,
|
||||
0x75, 0x6f, 0x75, 0x73, 0x46, 0x75, 0x6e, 0x64, 0x12, 0x36, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69,
|
||||
0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d,
|
||||
0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53,
|
||||
0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74,
|
||||
0x12, 0x51, 0x0a, 0x0a, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f,
|
||||
0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e,
|
||||
0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73,
|
||||
0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x0a, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74,
|
||||
0x61, 0x67, 0x65, 0x12, 0x38, 0x0a, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42,
|
||||
0x04, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x42, 0xda, 0x01,
|
||||
0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x70, 0x6f, 0x6f, 0x6c, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x54, 0x79,
|
||||
0x70, 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x36, 0x63, 0x6f, 0x73, 0x6d,
|
||||
0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73,
|
||||
0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x70, 0x6f, 0x6f, 0x6c,
|
||||
0x2f, 0x76, 0x31, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x70, 0x6f, 0x6f, 0x6c,
|
||||
0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x50, 0x58, 0xaa, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f,
|
||||
0x73, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x70, 0x6f, 0x6f, 0x6c, 0x2e, 0x56,
|
||||
0x31, 0xca, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x50, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x63, 0x6f, 0x6c, 0x70, 0x6f, 0x6f, 0x6c, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x22, 0x43, 0x6f, 0x73,
|
||||
0x6d, 0x6f, 0x73, 0x5c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x70, 0x6f, 0x6f, 0x6c,
|
||||
0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea,
|
||||
0x02, 0x18, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63,
|
||||
0x6f, 0x6c, 0x70, 0x6f, 0x6f, 0x6c, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -1118,24 +1750,26 @@ func file_cosmos_protocolpool_v1_types_proto_rawDescGZIP() []byte {
|
||||
return file_cosmos_protocolpool_v1_types_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_cosmos_protocolpool_v1_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_cosmos_protocolpool_v1_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_cosmos_protocolpool_v1_types_proto_goTypes = []interface{}{
|
||||
(*Budget)(nil), // 0: cosmos.protocolpool.v1.Budget
|
||||
(*v1beta1.Coin)(nil), // 1: cosmos.base.v1beta1.Coin
|
||||
(*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp
|
||||
(*durationpb.Duration)(nil), // 3: google.protobuf.Duration
|
||||
(*ContinuousFund)(nil), // 1: cosmos.protocolpool.v1.ContinuousFund
|
||||
(*v1beta1.Coin)(nil), // 2: cosmos.base.v1beta1.Coin
|
||||
(*timestamppb.Timestamp)(nil), // 3: google.protobuf.Timestamp
|
||||
(*durationpb.Duration)(nil), // 4: google.protobuf.Duration
|
||||
}
|
||||
var file_cosmos_protocolpool_v1_types_proto_depIdxs = []int32{
|
||||
1, // 0: cosmos.protocolpool.v1.Budget.total_budget:type_name -> cosmos.base.v1beta1.Coin
|
||||
1, // 1: cosmos.protocolpool.v1.Budget.claimed_amount:type_name -> cosmos.base.v1beta1.Coin
|
||||
2, // 2: cosmos.protocolpool.v1.Budget.start_time:type_name -> google.protobuf.Timestamp
|
||||
2, // 3: cosmos.protocolpool.v1.Budget.next_claim_from:type_name -> google.protobuf.Timestamp
|
||||
3, // 4: cosmos.protocolpool.v1.Budget.period:type_name -> google.protobuf.Duration
|
||||
5, // [5:5] is the sub-list for method output_type
|
||||
5, // [5:5] is the sub-list for method input_type
|
||||
5, // [5:5] is the sub-list for extension type_name
|
||||
5, // [5:5] is the sub-list for extension extendee
|
||||
0, // [0:5] is the sub-list for field type_name
|
||||
2, // 0: cosmos.protocolpool.v1.Budget.total_budget:type_name -> cosmos.base.v1beta1.Coin
|
||||
2, // 1: cosmos.protocolpool.v1.Budget.claimed_amount:type_name -> cosmos.base.v1beta1.Coin
|
||||
3, // 2: cosmos.protocolpool.v1.Budget.start_time:type_name -> google.protobuf.Timestamp
|
||||
3, // 3: cosmos.protocolpool.v1.Budget.next_claim_from:type_name -> google.protobuf.Timestamp
|
||||
4, // 4: cosmos.protocolpool.v1.Budget.period:type_name -> google.protobuf.Duration
|
||||
3, // 5: cosmos.protocolpool.v1.ContinuousFund.expiry:type_name -> google.protobuf.Timestamp
|
||||
6, // [6:6] is the sub-list for method output_type
|
||||
6, // [6:6] is the sub-list for method input_type
|
||||
6, // [6:6] is the sub-list for extension type_name
|
||||
6, // [6:6] is the sub-list for extension extendee
|
||||
0, // [0:6] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_cosmos_protocolpool_v1_types_proto_init() }
|
||||
@ -1156,6 +1790,18 @@ func file_cosmos_protocolpool_v1_types_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_cosmos_protocolpool_v1_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ContinuousFund); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
@ -1163,7 +1809,7 @@ func file_cosmos_protocolpool_v1_types_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_cosmos_protocolpool_v1_types_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumMessages: 2,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
||||
14
proto/cosmos/protocolpool/v1/genesis.proto
Normal file
14
proto/cosmos/protocolpool/v1/genesis.proto
Normal file
@ -0,0 +1,14 @@
|
||||
syntax = "proto3";
|
||||
package cosmos.protocolpool.v1;
|
||||
|
||||
option go_package = "cosmossdk.io/x/protocolpool/types";
|
||||
|
||||
import "cosmos/protocolpool/v1/types.proto";
|
||||
|
||||
// GenesisState defines the protocolpool module's genesis state.
|
||||
message GenesisState {
|
||||
// ContinuousFund defines the continuous funds at genesis.
|
||||
repeated ContinuousFund continuous_fund = 1;
|
||||
// Budget defines the budget proposals at genesis.
|
||||
repeated Budget budget = 2;
|
||||
}
|
||||
@ -33,6 +33,9 @@ service Msg {
|
||||
// CreateContinuousFund defines a method to add funds continuously.
|
||||
rpc CreateContinuousFund(MsgCreateContinuousFund) returns (MsgCreateContinuousFundResponse);
|
||||
|
||||
// WithdrawContinuousFund defines a method to withdraw continuous fund allocated.
|
||||
rpc WithdrawContinuousFund(MsgWithdrawContinuousFund) returns (MsgWithdrawContinuousFundResponse);
|
||||
|
||||
// CancelContinuousFund defines a method for cancelling continuous fund.
|
||||
rpc CancelContinuousFund(MsgCancelContinuousFund) returns (MsgCancelContinuousFundResponse);
|
||||
}
|
||||
@ -112,28 +115,18 @@ message MsgClaimBudgetResponse {
|
||||
message MsgCreateContinuousFund {
|
||||
option (cosmos.msg.v1.signer) = "authority";
|
||||
|
||||
// Title is the title of the funds.
|
||||
string title = 1;
|
||||
// Description of the funds.
|
||||
string description = 2;
|
||||
// Authority is the address that controls the module (defaults to x/gov unless overwritten).
|
||||
string authority = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
// Recipient address of the account receiving funds.
|
||||
string recipient = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
// Metadata is any arbitrary metadata attached.
|
||||
string metadata = 5;
|
||||
// Percentage is the percentage of funds to be allocated from Community pool share on block by block,
|
||||
// till the `cap` is reached or expired.
|
||||
string percentage = 6 [
|
||||
string recipient = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
// Percentage is the percentage of funds to be allocated from Community pool.
|
||||
string percentage = 3 [
|
||||
(cosmos_proto.scalar) = "cosmos.Dec",
|
||||
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
|
||||
(gogoproto.nullable) = false
|
||||
];
|
||||
// Cap is the capital amount, which when its met funds are no longer distributed.
|
||||
repeated cosmos.base.v1beta1.Coin cap = 7
|
||||
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
|
||||
// Optional, if expiry is set, removes the state object when expired.
|
||||
google.protobuf.Timestamp expiry = 8 [(gogoproto.stdtime) = true];
|
||||
google.protobuf.Timestamp expiry = 4 [(gogoproto.stdtime) = true];
|
||||
}
|
||||
|
||||
// MsgCreateContinuousFundResponse defines the response to executing a
|
||||
@ -159,4 +152,25 @@ message MsgCancelContinuousFundResponse {
|
||||
uint64 canceled_height = 2;
|
||||
// RecipientAddress is the account address of recipient whose funds are cancelled.
|
||||
string recipient_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
// withdrawnAllocatedFund represents the fund allocated to this recipient (if any) that have not been withdrawn yet,
|
||||
// before a cancellation request has been initiated.
|
||||
// It involves first withdrawing the funds and then canceling the request.
|
||||
cosmos.base.v1beta1.Coin withdrawn_allocated_fund = 4
|
||||
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
|
||||
;
|
||||
}
|
||||
|
||||
// MsgWithdrawContinuousFund defines a message for withdrawing the continuous fund allocated to it.
|
||||
message MsgWithdrawContinuousFund {
|
||||
option (cosmos.msg.v1.signer) = "recipient_address";
|
||||
string recipient_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
}
|
||||
|
||||
// MsgWithdrawContinuousFundResponse defines the response to executing a
|
||||
// MsgWithdrawContinuousFund message.
|
||||
message MsgWithdrawContinuousFundResponse {
|
||||
cosmos.base.v1beta1.Coin amount = 1
|
||||
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
@ -30,4 +30,18 @@ message Budget {
|
||||
// For example, if a period is set to 3600, it represents an action that
|
||||
// should occur every hour (3600 seconds).
|
||||
google.protobuf.Duration period = 8 [(gogoproto.stdduration) = true];
|
||||
}
|
||||
}
|
||||
|
||||
// ContinuousFund defines the fields of continuous fund proposal.
|
||||
message ContinuousFund {
|
||||
// Recipient address of the account receiving funds.
|
||||
string recipient = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
// Percentage is the percentage of funds to be allocated from Community pool.
|
||||
string percentage = 2 [
|
||||
(cosmos_proto.scalar) = "cosmos.Dec",
|
||||
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
|
||||
(gogoproto.nullable) = false
|
||||
];
|
||||
// Optional, if expiry is set, removes the state object when expired.
|
||||
google.protobuf.Timestamp expiry = 3 [(gogoproto.stdtime) = true];
|
||||
}
|
||||
|
||||
@ -333,7 +333,7 @@ func NewSimApp(
|
||||
)
|
||||
app.MintKeeper = mintkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[minttypes.StoreKey]), app.StakingKeeper, app.AuthKeeper, app.BankKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String())
|
||||
|
||||
app.PoolKeeper = poolkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[pooltypes.StoreKey]), app.AuthKeeper, app.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String())
|
||||
app.PoolKeeper = poolkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[pooltypes.StoreKey]), app.AuthKeeper, app.BankKeeper, app.StakingKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String())
|
||||
|
||||
app.DistrKeeper = distrkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[distrtypes.StoreKey]), app.AuthKeeper, app.BankKeeper, app.StakingKeeper, app.PoolKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String())
|
||||
|
||||
|
||||
@ -152,6 +152,7 @@ var (
|
||||
upgradetypes.ModuleName,
|
||||
vestingtypes.ModuleName,
|
||||
circuittypes.ModuleName,
|
||||
pooltypes.ModuleName,
|
||||
},
|
||||
// When ExportGenesis is not specified, the export genesis module order
|
||||
// is equal to the init genesis order
|
||||
|
||||
@ -108,7 +108,7 @@ func initFixture(t *testing.T) *fixture {
|
||||
require.NoError(t, stakingKeeper.Params.Set(newCtx, stakingtypes.DefaultParams()))
|
||||
|
||||
poolKeeper := poolkeeper.NewKeeper(
|
||||
cdc, runtime.NewKVStoreService(keys[pooltypes.StoreKey]), accountKeeper, bankKeeper, authority.String(),
|
||||
cdc, runtime.NewKVStoreService(keys[pooltypes.StoreKey]), accountKeeper, bankKeeper, stakingKeeper, authority.String(),
|
||||
)
|
||||
|
||||
distrKeeper := distrkeeper.NewKeeper(
|
||||
|
||||
@ -92,7 +92,7 @@ func initFixture(tb testing.TB) *fixture {
|
||||
|
||||
stakingKeeper := stakingkeeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), accountKeeper, bankKeeper, authority.String(), addresscodec.NewBech32Codec(sdk.Bech32PrefixValAddr), addresscodec.NewBech32Codec(sdk.Bech32PrefixConsAddr))
|
||||
|
||||
poolKeeper := poolkeeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[pooltypes.StoreKey]), accountKeeper, bankKeeper, authority.String())
|
||||
poolKeeper := poolkeeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[pooltypes.StoreKey]), accountKeeper, bankKeeper, stakingKeeper, authority.String())
|
||||
|
||||
// set default staking params
|
||||
err := stakingKeeper.Params.Set(newCtx, stakingtypes.DefaultParams())
|
||||
|
||||
@ -105,6 +105,7 @@ func defaultConfig() *Config {
|
||||
testutil.UpgradeModuleName,
|
||||
"vesting",
|
||||
testutil.CircuitModuleName,
|
||||
testutil.ProtocolPoolModuleName,
|
||||
},
|
||||
setInitGenesis: true,
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ require (
|
||||
cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a
|
||||
cosmossdk.io/collections v0.4.0
|
||||
cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7
|
||||
github.com/cosmos/cosmos-proto v1.0.0-beta.3
|
||||
github.com/cosmos/cosmos-sdk v0.51.0
|
||||
github.com/cosmos/gogoproto v1.4.11
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0
|
||||
@ -44,7 +45,6 @@ require (
|
||||
github.com/cometbft/cometbft-db v0.8.0 // indirect
|
||||
github.com/cosmos/btcutil v1.0.5 // indirect
|
||||
github.com/cosmos/cosmos-db v1.0.0 // indirect
|
||||
github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect
|
||||
github.com/cosmos/go-bip39 v1.0.0 // indirect
|
||||
github.com/cosmos/gogogateway v1.2.0 // indirect
|
||||
github.com/cosmos/iavl v1.0.0 // indirect
|
||||
|
||||
@ -78,6 +78,11 @@ func (k Keeper) AllocateTokens(ctx context.Context, totalPreviousPower int64, bo
|
||||
return err
|
||||
}
|
||||
|
||||
// set ToDistribute in protocolpool to keep track of continuous funds distribution
|
||||
if err := k.poolKeeper.SetToDistribute(ctx, amt, k.GetAuthority()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := k.FeePool.Set(ctx, types.FeePool{DecimalPool: feePool.DecimalPool.Add(re...)}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -169,6 +169,7 @@ func TestAllocateTokensToManyValidators(t *testing.T) {
|
||||
bankKeeper.EXPECT().GetAllBalances(gomock.Any(), feeCollectorAcc.GetAddress()).Return(fees)
|
||||
bankKeeper.EXPECT().SendCoinsFromModuleToModule(gomock.Any(), "fee_collector", disttypes.ModuleName, fees)
|
||||
bankKeeper.EXPECT().SendCoinsFromModuleToModule(gomock.Any(), disttypes.ModuleName, disttypes.ProtocolPoolModuleName, sdk.Coins{{Denom: sdk.DefaultBondDenom, Amount: math.NewInt(2)}}) // 2 community pool coins
|
||||
poolKeeper.EXPECT().SetToDistribute(ctx, gomock.Any(), gomock.Any())
|
||||
|
||||
votes := []comet.VoteInfo{
|
||||
{
|
||||
@ -310,6 +311,7 @@ func TestAllocateTokensTruncation(t *testing.T) {
|
||||
bankKeeper.EXPECT().GetAllBalances(gomock.Any(), feeCollectorAcc.GetAddress()).Return(fees)
|
||||
bankKeeper.EXPECT().SendCoinsFromModuleToModule(gomock.Any(), "fee_collector", disttypes.ModuleName, fees)
|
||||
bankKeeper.EXPECT().SendCoinsFromModuleToModule(gomock.Any(), disttypes.ModuleName, disttypes.ProtocolPoolModuleName, gomock.Any()) // something is sent to community pool
|
||||
poolKeeper.EXPECT().SetToDistribute(ctx, gomock.Any(), gomock.Any())
|
||||
|
||||
votes := []comet.VoteInfo{
|
||||
{
|
||||
|
||||
@ -292,6 +292,20 @@ func (mr *MockPoolKeeperMockRecorder) GetCommunityPool(ctx interface{}) *gomock.
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCommunityPool", reflect.TypeOf((*MockPoolKeeper)(nil).GetCommunityPool), ctx)
|
||||
}
|
||||
|
||||
// SetToDistribute mocks base method.
|
||||
func (m *MockPoolKeeper) SetToDistribute(ctx context.Context, amount types0.Coins, addr string) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SetToDistribute", ctx, amount, addr)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SetToDistribute indicates an expected call of SetToDistribute.
|
||||
func (mr *MockPoolKeeperMockRecorder) SetToDistribute(ctx, amount, addr interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetToDistribute", reflect.TypeOf((*MockPoolKeeper)(nil).SetToDistribute), ctx, amount, addr)
|
||||
}
|
||||
|
||||
// MockStakingKeeper is a mock of StakingKeeper interface.
|
||||
type MockStakingKeeper struct {
|
||||
ctrl *gomock.Controller
|
||||
|
||||
@ -38,6 +38,7 @@ type PoolKeeper interface {
|
||||
FundCommunityPool(ctx context.Context, amount sdk.Coins, sender sdk.AccAddress) error
|
||||
DistributeFromCommunityPool(ctx context.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error
|
||||
GetCommunityPool(ctx context.Context) (sdk.Coins, error)
|
||||
SetToDistribute(ctx context.Context, amount sdk.Coins, addr string) error
|
||||
}
|
||||
|
||||
// StakingKeeper expected staking keeper (noalias)
|
||||
|
||||
@ -49,6 +49,10 @@ var suggestedProposalTypes = []proposalType{
|
||||
Name: "submit-budget-proposal",
|
||||
MsgType: "/cosmos.protocolpool.v1.MsgSubmitBudgetProposal",
|
||||
},
|
||||
{
|
||||
Name: "create-continuous-fund",
|
||||
MsgType: "/cosmos.protocolpool.v1.MsgCreateContinuousFund",
|
||||
},
|
||||
{
|
||||
Name: proposalOther,
|
||||
MsgType: "", // user will input the message type
|
||||
|
||||
@ -55,6 +55,25 @@ ClaimBudget is a message used to claim funds from a previously submitted budget
|
||||
|
||||
```
|
||||
|
||||
### CreateContinuousFund
|
||||
|
||||
CreateContinuousFund is a message used to initiate a continuous fund for a specific recipient. The proposed percentage of funds will be distributed only on withdraw request for the recipient. The fund distribution continues until expiry time is reached or continuous fund request is canceled.
|
||||
NOTE: This feature is designed to work with the SDK's default bond denom.
|
||||
|
||||
```protobuf
|
||||
// CreateContinuousFund defines a method to add funds continuously.
|
||||
rpc CreateContinuousFund(MsgCreateContinuousFund) returns (MsgCreateContinuousFundResponse);
|
||||
```
|
||||
|
||||
### CancelContinuousFund
|
||||
|
||||
CancelContinuousFund is a message used to cancel an existing continuous fund proposal for a specific recipient. Cancelling a continuous fund stops further distribution of funds, and the state object is removed from storage.
|
||||
|
||||
```protobuf
|
||||
// CancelContinuousFund defines a method for cancelling continuous fund.
|
||||
rpc CancelContinuousFund(MsgCancelContinuousFund) returns (MsgCancelContinuousFundResponse);
|
||||
```
|
||||
|
||||
## Messages
|
||||
|
||||
### MsgFundCommunityPool
|
||||
@ -79,7 +98,7 @@ func (k Keeper) FundCommunityPool(ctx context.Context, amount sdk.Coins, sender
|
||||
|
||||
### MsgCommunityPoolSpend
|
||||
|
||||
This message distributes funds from the protocolpool module account to the recipient using `DistributeFromFeePool` keeper method.
|
||||
This message distributes funds from the protocolpool module account to the recipient using `DistributeFromCommunityPool` keeper method.
|
||||
|
||||
```protobuf reference
|
||||
https://github.com/cosmos/cosmos-sdk/blob/97724493d792517ba2be8969078b5f92ad04d79c/proto/cosmos/protocolpool/v1/tx.proto#L47-L58
|
||||
@ -91,7 +110,7 @@ The message will fail under the following conditions:
|
||||
* The `recipient` address is restricted
|
||||
|
||||
```go
|
||||
func (k Keeper) DistributeFromFeePool(ctx context.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error {
|
||||
func (k Keeper) DistributeFromCommunityPool(ctx context.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error {
|
||||
return k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, receiveAddr, amount)
|
||||
}
|
||||
```
|
||||
@ -139,6 +158,44 @@ The message will fail under the following conditions:
|
||||
https://github.com/cosmos/cosmos-sdk/blob/97724493d792517ba2be8969078b5f92ad04d79c/x/protocolpool/keeper/msg_server.go#L25-L37
|
||||
```
|
||||
|
||||
### MsgCreateContinuousFund
|
||||
|
||||
This message is used to create a continuous fund for a specific recipient. The proposed percentage of funds will be distributed only on withdraw request for the recipient. This fund distribution continues until expiry time is reached or continuous fund request is canceled.
|
||||
|
||||
```protobuf reference
|
||||
https://github.com/cosmos/cosmos-sdk/blob/44985ec56557e2d5b763c8676fabbed971f157ba/proto/cosmos/protocolpool/v1/tx.proto#L111-L130
|
||||
```
|
||||
|
||||
The message will fail under the following conditions:
|
||||
|
||||
- The recipient address is empty or restricted.
|
||||
- The percentage is zero/negative/greater than one.
|
||||
- The Expiry time is less than the current block time.
|
||||
|
||||
:::warning
|
||||
If two continuous fund proposals to the same address are created, the previous ContinuousFund would be updated with the new ContinuousFund.
|
||||
:::
|
||||
|
||||
```go reference
|
||||
https://github.com/cosmos/cosmos-sdk/blob/44985ec56557e2d5b763c8676fabbed971f157ba/x/protocolpool/keeper/msg_server.go#L109-L140
|
||||
```
|
||||
|
||||
### MsgCancelContinuousFund
|
||||
|
||||
This message is used to cancel an existing continuous fund proposal for a specific recipient. Once canceled, the continuous fund will no longer distribute funds at each end block, and the state object will be removed. Users should be cautious when canceling continuous funds, as it may affect the planned distribution for the recipient.
|
||||
|
||||
```protobuf reference
|
||||
https://github.com/cosmos/cosmos-sdk/blob/44985ec56557e2d5b763c8676fabbed971f157ba/proto/cosmos/protocolpool/v1/tx.proto#L136-L144
|
||||
```
|
||||
|
||||
The message will fail under the following conditions:
|
||||
|
||||
- The recipient address is empty or restricted.
|
||||
- The ContinuousFund for the recipient does not exist.
|
||||
|
||||
```go reference
|
||||
https://github.com/cosmos/cosmos-sdk/blob/44985ec56557e2d5b763c8676fabbed971f157ba/x/protocolpool/keeper/msg_server.go#L142-L174
|
||||
```
|
||||
|
||||
## Client
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
|
||||
RpcMethod: "SubmitBudgetProposal",
|
||||
Use: "submit-budget-proposal [recipient] [total-budget] [start-time] [tranches] [period]",
|
||||
Short: "Submit a budget proposal",
|
||||
Example: fmt.Sprintf(`$ %s tx protocolpool submit-budget-proposal cosmos1... 1000000uatom 1600000000 10 1000 --from mykey`, version.AppName),
|
||||
Example: fmt.Sprintf(`$ %s tx protocolpool submit-budget-proposal cosmos1... 1000000uatom 2023-10-31T12:34:56.789Z 10 1000 --from mykey`, version.AppName),
|
||||
PositionalArgs: []*autocliv1.PositionalArgDescriptor{
|
||||
{ProtoField: "recipient_address"},
|
||||
{ProtoField: "total_budget"},
|
||||
@ -60,6 +60,35 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
|
||||
Example: fmt.Sprintf(`$ %s tx protocolpool claim-budget cosmos1... --from mykey`, version.AppName),
|
||||
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "recipient_address"}},
|
||||
},
|
||||
{
|
||||
RpcMethod: "CreateContinuousFund",
|
||||
Use: "create-continuous-fund [recipient] [percentage] <expiry>",
|
||||
Short: "Create continuous fund for a recipient with optional expiry",
|
||||
Example: fmt.Sprintf(`$ %s tx protocolpool create-continuous-fund cosmos1... 0.2 2023-11-31T12:34:56.789Z --from mykey`, version.AppName),
|
||||
PositionalArgs: []*autocliv1.PositionalArgDescriptor{
|
||||
{ProtoField: "recipient"},
|
||||
{ProtoField: "percentage"},
|
||||
{ProtoField: "expiry", Optional: true},
|
||||
},
|
||||
GovProposal: true,
|
||||
},
|
||||
{
|
||||
RpcMethod: "WithdrawContinuousFund",
|
||||
Use: "withdraw-continuous-fund [recipient]",
|
||||
Short: "Withdraw continuous fund allocated to the recipient",
|
||||
Example: fmt.Sprintf(`$ %s tx protocolpool withdraw-continuous-fund cosmos1... --from mykey`, version.AppName),
|
||||
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "recipient_address"}},
|
||||
},
|
||||
{
|
||||
RpcMethod: "CancelContinuousFund",
|
||||
Use: "cancel-continuous-fund [recipient_address]",
|
||||
Short: "Cancel continuous fund for a specific recipient",
|
||||
Example: fmt.Sprintf(`$ %s tx protocolpool cancel-continuous-fund cosmos1... --from mykey`, version.AppName),
|
||||
PositionalArgs: []*autocliv1.PositionalArgDescriptor{
|
||||
{ProtoField: "recipient_address"},
|
||||
},
|
||||
GovProposal: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
83
x/protocolpool/keeper/genesis.go
Normal file
83
x/protocolpool/keeper/genesis.go
Normal file
@ -0,0 +1,83 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"cosmossdk.io/x/protocolpool/types"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
func (k Keeper) InitGenesis(ctx context.Context, data *types.GenesisState) error {
|
||||
sdkCtx := sdk.UnwrapSDKContext(ctx)
|
||||
currentTime := sdkCtx.BlockTime()
|
||||
for _, cf := range data.ContinuousFund {
|
||||
// ignore expired ContinuousFunds
|
||||
if cf.Expiry != nil && cf.Expiry.Before(currentTime) {
|
||||
continue
|
||||
}
|
||||
|
||||
recipientAddress, err := k.authKeeper.AddressCodec().StringToBytes(cf.Recipient)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to decode recipient address: %w", err)
|
||||
}
|
||||
if err := k.ContinuousFund.Set(ctx, recipientAddress, *cf); err != nil {
|
||||
return fmt.Errorf("failed to set continuous fund for recipient %s: %w", recipientAddress, err)
|
||||
}
|
||||
}
|
||||
for _, budget := range data.Budget {
|
||||
// Validate StartTime
|
||||
if budget.StartTime.IsZero() || budget.StartTime == nil {
|
||||
budget.StartTime = ¤tTime
|
||||
}
|
||||
// ignore budget with start time < currentTime
|
||||
if budget.StartTime != nil && budget.StartTime.Before(currentTime) {
|
||||
continue
|
||||
}
|
||||
|
||||
recipientAddress, err := k.authKeeper.AddressCodec().StringToBytes(budget.RecipientAddress)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to decode recipient address: %w", err)
|
||||
}
|
||||
if err = k.BudgetProposal.Set(ctx, recipientAddress, *budget); err != nil {
|
||||
return fmt.Errorf("failed to set budget for recipient %s: %w", recipientAddress, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (k Keeper) ExportGenesis(ctx context.Context) (*types.GenesisState, error) {
|
||||
var cf []*types.ContinuousFund
|
||||
err := k.ContinuousFund.Walk(ctx, nil, func(key sdk.AccAddress, value types.ContinuousFund) (stop bool, err error) {
|
||||
cf = append(cf, &types.ContinuousFund{
|
||||
Recipient: key.String(),
|
||||
Percentage: value.Percentage,
|
||||
Expiry: value.Expiry,
|
||||
})
|
||||
return false, nil
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var budget []*types.Budget
|
||||
err = k.BudgetProposal.Walk(ctx, nil, func(key sdk.AccAddress, value types.Budget) (stop bool, err error) {
|
||||
budget = append(budget, &types.Budget{
|
||||
RecipientAddress: key.String(),
|
||||
TotalBudget: value.TotalBudget,
|
||||
ClaimedAmount: value.ClaimedAmount,
|
||||
StartTime: value.StartTime,
|
||||
NextClaimFrom: value.NextClaimFrom,
|
||||
Tranches: value.Tranches,
|
||||
TranchesLeft: value.TranchesLeft,
|
||||
Period: value.Period,
|
||||
})
|
||||
return false, nil
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return types.NewGenesisState(cf, budget), nil
|
||||
}
|
||||
@ -4,14 +4,12 @@ import (
|
||||
"time"
|
||||
|
||||
"cosmossdk.io/math"
|
||||
"cosmossdk.io/x/protocolpool/keeper"
|
||||
"cosmossdk.io/x/protocolpool/types"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
func (suite *KeeperTestSuite) TestUnclaimedBudget() {
|
||||
queryServer := keeper.NewQuerier(suite.poolKeeper)
|
||||
startTime := suite.ctx.BlockTime().Add(-70 * time.Second)
|
||||
period := time.Duration(60) * time.Second
|
||||
zeroCoin := sdk.NewCoin("foo", math.ZeroInt())
|
||||
@ -112,7 +110,7 @@ func (suite *KeeperTestSuite) TestUnclaimedBudget() {
|
||||
if tc.preRun != nil {
|
||||
tc.preRun()
|
||||
}
|
||||
resp, err := queryServer.UnclaimedBudget(suite.ctx, tc.req)
|
||||
resp, err := suite.queryServer.UnclaimedBudget(suite.ctx, tc.req)
|
||||
if tc.expErr {
|
||||
suite.Require().Error(err)
|
||||
suite.Require().Contains(err.Error(), tc.expErrMsg)
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
@ -19,9 +20,10 @@ import (
|
||||
)
|
||||
|
||||
type Keeper struct {
|
||||
storeService storetypes.KVStoreService
|
||||
authKeeper types.AccountKeeper
|
||||
bankKeeper types.BankKeeper
|
||||
storeService storetypes.KVStoreService
|
||||
authKeeper types.AccountKeeper
|
||||
bankKeeper types.BankKeeper
|
||||
stakingKeeper types.StakingKeeper
|
||||
|
||||
cdc codec.BinaryCodec
|
||||
|
||||
@ -30,10 +32,17 @@ type Keeper struct {
|
||||
// State
|
||||
Schema collections.Schema
|
||||
BudgetProposal collections.Map[sdk.AccAddress, types.Budget]
|
||||
ContinuousFund collections.Map[sdk.AccAddress, types.ContinuousFund]
|
||||
// RecipientFundPercentage key: RecipientAddr | value: Percentage in math.Int
|
||||
RecipientFundPercentage collections.Map[sdk.AccAddress, math.Int]
|
||||
// RecipientFundDistribution key: RecipientAddr | value: Claimable amount
|
||||
RecipientFundDistribution collections.Map[sdk.AccAddress, math.Int]
|
||||
// ToDistribute is to keep track of funds distributed
|
||||
ToDistribute collections.Item[math.Int]
|
||||
}
|
||||
|
||||
func NewKeeper(cdc codec.BinaryCodec, storeService storetypes.KVStoreService,
|
||||
ak types.AccountKeeper, bk types.BankKeeper, authority string,
|
||||
ak types.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper, authority string,
|
||||
) Keeper {
|
||||
// ensure pool module account is set
|
||||
if addr := ak.GetModuleAddress(types.ModuleName); addr == nil {
|
||||
@ -42,12 +51,17 @@ func NewKeeper(cdc codec.BinaryCodec, storeService storetypes.KVStoreService,
|
||||
sb := collections.NewSchemaBuilder(storeService)
|
||||
|
||||
keeper := Keeper{
|
||||
storeService: storeService,
|
||||
authKeeper: ak,
|
||||
bankKeeper: bk,
|
||||
cdc: cdc,
|
||||
authority: authority,
|
||||
BudgetProposal: collections.NewMap(sb, types.BudgetKey, "budget", sdk.AccAddressKey, codec.CollValue[types.Budget](cdc)),
|
||||
storeService: storeService,
|
||||
authKeeper: ak,
|
||||
bankKeeper: bk,
|
||||
stakingKeeper: sk,
|
||||
cdc: cdc,
|
||||
authority: authority,
|
||||
BudgetProposal: collections.NewMap(sb, types.BudgetKey, "budget", sdk.AccAddressKey, codec.CollValue[types.Budget](cdc)),
|
||||
ContinuousFund: collections.NewMap(sb, types.ContinuousFundKey, "continuous_fund", sdk.AccAddressKey, codec.CollValue[types.ContinuousFund](cdc)),
|
||||
RecipientFundPercentage: collections.NewMap(sb, types.RecipientFundPercentageKey, "recipient_fund_percentage", sdk.AccAddressKey, sdk.IntValue),
|
||||
RecipientFundDistribution: collections.NewMap(sb, types.RecipientFundDistributionKey, "recipient_fund_distribution", sdk.AccAddressKey, sdk.IntValue),
|
||||
ToDistribute: collections.NewItem(sb, types.ToDistributeKey, "to_distribute", sdk.IntValue),
|
||||
}
|
||||
|
||||
schema, err := sb.Build()
|
||||
@ -90,6 +104,163 @@ func (k Keeper) GetCommunityPool(ctx context.Context) (sdk.Coins, error) {
|
||||
return k.bankKeeper.GetAllBalances(ctx, moduleAccount.GetAddress()), nil
|
||||
}
|
||||
|
||||
func (k Keeper) withdrawContinuousFund(ctx context.Context, recipient sdk.AccAddress) (sdk.Coin, error) {
|
||||
sdkCtx := sdk.UnwrapSDKContext(ctx)
|
||||
cf, err := k.ContinuousFund.Get(ctx, recipient)
|
||||
if err != nil {
|
||||
if errors.Is(err, collections.ErrNotFound) {
|
||||
return sdk.Coin{}, fmt.Errorf("no continuous fund found for recipient: %s", recipient.String())
|
||||
}
|
||||
}
|
||||
if cf.Expiry != nil && cf.Expiry.Before(sdkCtx.HeaderInfo().Time) {
|
||||
return sdk.Coin{}, fmt.Errorf("cannot withdraw continuous funds: continuous fund expired for recipient: %s", recipient.String())
|
||||
}
|
||||
|
||||
toDistributeAmount, err := k.ToDistribute.Get(ctx)
|
||||
if err != nil {
|
||||
return sdk.Coin{}, err
|
||||
}
|
||||
|
||||
if !toDistributeAmount.Equal(math.ZeroInt()) {
|
||||
err = k.iterateAndUpdateFundsDistribution(ctx, toDistributeAmount)
|
||||
if err != nil {
|
||||
return sdk.Coin{}, fmt.Errorf("error while iterating all the continuous funds: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
// withdraw continuous fund
|
||||
withdrawnAmount, err := k.withdrawRecipientFunds(ctx, recipient)
|
||||
if err != nil {
|
||||
return sdk.Coin{}, fmt.Errorf("error while withdrawing recipient funds for recipient: %s", recipient.String())
|
||||
}
|
||||
|
||||
return withdrawnAmount, nil
|
||||
}
|
||||
|
||||
func (k Keeper) withdrawRecipientFunds(ctx context.Context, recipient sdk.AccAddress) (sdk.Coin, error) {
|
||||
// get allocated continuous fund
|
||||
fundsAllocated, err := k.RecipientFundDistribution.Get(ctx, recipient)
|
||||
if err != nil {
|
||||
if errors.Is(err, collections.ErrNotFound) {
|
||||
return sdk.Coin{}, types.ErrNoRecipientFund
|
||||
}
|
||||
return sdk.Coin{}, err
|
||||
}
|
||||
|
||||
denom, err := k.stakingKeeper.BondDenom(ctx)
|
||||
if err != nil {
|
||||
return sdk.Coin{}, err
|
||||
}
|
||||
|
||||
// Distribute funds to the recipient from pool module account
|
||||
withdrawnAmount := sdk.NewCoin(denom, fundsAllocated)
|
||||
err = k.DistributeFromCommunityPool(ctx, sdk.NewCoins(withdrawnAmount), recipient)
|
||||
if err != nil {
|
||||
return sdk.Coin{}, fmt.Errorf("error while distributing funds to the recipient %s: %v", recipient.String(), err)
|
||||
}
|
||||
|
||||
// reset fund distribution
|
||||
err = k.RecipientFundDistribution.Set(ctx, recipient, math.ZeroInt())
|
||||
if err != nil {
|
||||
return sdk.Coin{}, err
|
||||
}
|
||||
return withdrawnAmount, nil
|
||||
}
|
||||
|
||||
// SetToDistribute sets the amount to be distributed among recipients.
|
||||
// This could be only set by the authority address.
|
||||
func (k Keeper) SetToDistribute(ctx context.Context, amount sdk.Coins, addr string) error {
|
||||
authAddr, err := k.authKeeper.AddressCodec().StringToBytes(addr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
hasPermission, err := k.hasPermission(ctx, authAddr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !hasPermission {
|
||||
return sdkerrors.ErrUnauthorized
|
||||
}
|
||||
|
||||
denom, err := k.stakingKeeper.BondDenom(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = k.ToDistribute.Set(ctx, amount.AmountOf(denom))
|
||||
if err != nil {
|
||||
return fmt.Errorf("error while setting ToDistribute: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (k Keeper) hasPermission(ctx context.Context, addr []byte) (bool, error) {
|
||||
authority := k.GetAuthority()
|
||||
authAcc, err := k.authKeeper.AddressCodec().StringToBytes(authority)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return bytes.Equal(authAcc, addr), nil
|
||||
}
|
||||
|
||||
func (k Keeper) iterateAndUpdateFundsDistribution(ctx context.Context, toDistributeAmount math.Int) error {
|
||||
totalPercentageToBeDistributed := math.ZeroInt()
|
||||
|
||||
// Create a map to store keys & values from RecipientFundPercentage during the first iteration
|
||||
recipientFundMap := make(map[string]math.Int)
|
||||
|
||||
// Calculate totalPercentageToBeDistributed and store values
|
||||
err := k.RecipientFundPercentage.Walk(ctx, nil, func(key sdk.AccAddress, value math.Int) (stop bool, err error) {
|
||||
totalPercentageToBeDistributed = totalPercentageToBeDistributed.Add(value)
|
||||
recipientFundMap[key.String()] = value
|
||||
return false, nil
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if totalPercentageToBeDistributed.GT(math.NewInt(100)) {
|
||||
return fmt.Errorf("total funds percentage cannot exceed 100")
|
||||
}
|
||||
|
||||
denom, err := k.stakingKeeper.BondDenom(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
toDistributeDec := sdk.NewDecCoins(sdk.NewDecCoin(denom, toDistributeAmount))
|
||||
|
||||
// Calculate the funds to be distributed based on the total percentage to be distributed
|
||||
totalAmountToBeDistributed := toDistributeDec.MulDec(math.LegacyNewDecFromIntWithPrec(totalPercentageToBeDistributed, 2))
|
||||
totalDistrAmount := totalAmountToBeDistributed.AmountOf(denom)
|
||||
|
||||
for keyStr, value := range recipientFundMap {
|
||||
// Calculate the funds to be distributed based on the percentage
|
||||
decValue := math.LegacyNewDecFromIntWithPrec(value, 2)
|
||||
percentage := math.LegacyNewDecFromIntWithPrec(totalPercentageToBeDistributed, 2)
|
||||
recipientAmount := totalDistrAmount.Mul(decValue).Quo(percentage)
|
||||
recipientCoins := recipientAmount.TruncateInt()
|
||||
|
||||
key, err := k.authKeeper.AddressCodec().StringToBytes(keyStr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Set funds to be claimed
|
||||
toClaim, err := k.RecipientFundDistribution.Get(ctx, key)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
amount := toClaim.Add(recipientCoins)
|
||||
err = k.RecipientFundDistribution.Set(ctx, key, amount)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Set the coins to be distributed from toDistribute to 0
|
||||
return k.ToDistribute.Set(ctx, math.ZeroInt())
|
||||
}
|
||||
|
||||
func (k Keeper) claimFunds(ctx context.Context, recipient sdk.AccAddress) (amount sdk.Coin, err error) {
|
||||
// get claimable funds from distribution info
|
||||
amount, err = k.getClaimableFunds(ctx, recipient)
|
||||
@ -202,7 +373,6 @@ func (k Keeper) validateAndUpdateBudgetProposal(ctx context.Context, bp types.Ms
|
||||
bp.StartTime = ¤tTime
|
||||
}
|
||||
|
||||
// if bp.StartTime < uint64(currentTime) {
|
||||
if currentTime.After(*bp.StartTime) {
|
||||
return nil, fmt.Errorf("invalid budget proposal: start time cannot be less than the current block time")
|
||||
}
|
||||
@ -226,3 +396,27 @@ func (k Keeper) validateAndUpdateBudgetProposal(ctx context.Context, bp types.Ms
|
||||
|
||||
return &updatedBudget, nil
|
||||
}
|
||||
|
||||
// validateContinuousFund validates the fields of the CreateContinuousFund message.
|
||||
func (k Keeper) validateContinuousFund(ctx context.Context, msg types.MsgCreateContinuousFund) error {
|
||||
// Validate percentage
|
||||
if msg.Percentage.IsZero() || msg.Percentage.IsNil() {
|
||||
return fmt.Errorf("percentage cannot be zero or empty")
|
||||
}
|
||||
if msg.Percentage.IsNegative() {
|
||||
return fmt.Errorf("percentage cannot be negative")
|
||||
}
|
||||
if msg.Percentage.GTE(math.LegacyOneDec()) {
|
||||
return fmt.Errorf("percentage cannot be greater than or equal to one")
|
||||
}
|
||||
|
||||
// Validate expiry
|
||||
currentTime := sdk.UnwrapSDKContext(ctx).BlockTime()
|
||||
if msg.Expiry != nil {
|
||||
if msg.Expiry.Compare(currentTime) == -1 {
|
||||
return fmt.Errorf("expiry time cannot be less than the current block time")
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -8,12 +8,14 @@ import (
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"cosmossdk.io/core/header"
|
||||
"cosmossdk.io/math"
|
||||
storetypes "cosmossdk.io/store/types"
|
||||
authtypes "cosmossdk.io/x/auth/types"
|
||||
poolkeeper "cosmossdk.io/x/protocolpool/keeper"
|
||||
pooltestutil "cosmossdk.io/x/protocolpool/testutil"
|
||||
pooltypes "cosmossdk.io/x/protocolpool/types"
|
||||
"cosmossdk.io/x/protocolpool/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/baseapp"
|
||||
"github.com/cosmos/cosmos-sdk/codec/address"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
"github.com/cosmos/cosmos-sdk/testutil"
|
||||
@ -21,19 +23,23 @@ import (
|
||||
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
|
||||
)
|
||||
|
||||
var poolAcc = authtypes.NewEmptyModuleAccount(pooltypes.ModuleName)
|
||||
var poolAcc = authtypes.NewEmptyModuleAccount(types.ModuleName)
|
||||
|
||||
type KeeperTestSuite struct {
|
||||
suite.Suite
|
||||
|
||||
ctx sdk.Context
|
||||
poolKeeper poolkeeper.Keeper
|
||||
bankKeeper *pooltestutil.MockBankKeeper
|
||||
msgServer pooltypes.MsgServer
|
||||
ctx sdk.Context
|
||||
poolKeeper poolkeeper.Keeper
|
||||
authKeeper *pooltestutil.MockAccountKeeper
|
||||
bankKeeper *pooltestutil.MockBankKeeper
|
||||
stakingKeeper *pooltestutil.MockStakingKeeper
|
||||
|
||||
msgServer types.MsgServer
|
||||
queryServer types.QueryServer
|
||||
}
|
||||
|
||||
func (s *KeeperTestSuite) SetupTest() {
|
||||
key := storetypes.NewKVStoreKey(pooltypes.StoreKey)
|
||||
key := storetypes.NewKVStoreKey(types.StoreKey)
|
||||
storeService := runtime.NewKVStoreService(key)
|
||||
testCtx := testutil.DefaultContextWithDB(s.T(), key, storetypes.NewTransientStoreKey("transient_test"))
|
||||
ctx := testCtx.Ctx.WithHeaderInfo(header.Info{Time: time.Now()})
|
||||
@ -42,28 +48,45 @@ func (s *KeeperTestSuite) SetupTest() {
|
||||
// gomock initializations
|
||||
ctrl := gomock.NewController(s.T())
|
||||
accountKeeper := pooltestutil.NewMockAccountKeeper(ctrl)
|
||||
accountKeeper.EXPECT().GetModuleAddress(pooltypes.ModuleName).Return(poolAcc.GetAddress())
|
||||
accountKeeper.EXPECT().GetModuleAddress(types.ModuleName).Return(poolAcc.GetAddress())
|
||||
accountKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec("cosmos")).AnyTimes()
|
||||
s.authKeeper = accountKeeper
|
||||
|
||||
bankKeeper := pooltestutil.NewMockBankKeeper(ctrl)
|
||||
s.bankKeeper = bankKeeper
|
||||
|
||||
stakingKeeper := pooltestutil.NewMockStakingKeeper(ctrl)
|
||||
stakingKeeper.EXPECT().BondDenom(ctx).Return("stake", nil).AnyTimes()
|
||||
s.stakingKeeper = stakingKeeper
|
||||
|
||||
poolKeeper := poolkeeper.NewKeeper(
|
||||
encCfg.Codec,
|
||||
storeService,
|
||||
accountKeeper,
|
||||
bankKeeper,
|
||||
authtypes.NewModuleAddress(pooltypes.GovModuleName).String(),
|
||||
stakingKeeper,
|
||||
authtypes.NewModuleAddress(types.GovModuleName).String(),
|
||||
)
|
||||
s.ctx = ctx
|
||||
s.poolKeeper = poolKeeper
|
||||
|
||||
pooltypes.RegisterInterfaces(encCfg.InterfaceRegistry)
|
||||
types.RegisterInterfaces(encCfg.InterfaceRegistry)
|
||||
queryHelper := baseapp.NewQueryServerTestHelper(ctx, encCfg.InterfaceRegistry)
|
||||
types.RegisterQueryServer(queryHelper, poolkeeper.Querier{Keeper: poolKeeper})
|
||||
s.msgServer = poolkeeper.NewMsgServerImpl(poolKeeper)
|
||||
s.queryServer = poolkeeper.NewQuerier(poolKeeper)
|
||||
}
|
||||
|
||||
func (s *KeeperTestSuite) mockSendCoinsFromModuleToAccount(accAddr sdk.AccAddress) {
|
||||
s.bankKeeper.EXPECT().SendCoinsFromModuleToAccount(s.ctx, pooltypes.ModuleName, accAddr, gomock.Any()).AnyTimes()
|
||||
s.bankKeeper.EXPECT().SendCoinsFromModuleToAccount(s.ctx, types.ModuleName, accAddr, gomock.Any()).AnyTimes()
|
||||
}
|
||||
|
||||
func (s *KeeperTestSuite) mockWithdrawContinuousFund() {
|
||||
s.authKeeper.EXPECT().GetModuleAccount(s.ctx, types.ModuleName).Return(poolAcc).AnyTimes()
|
||||
distrBal := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(100000)))
|
||||
s.bankKeeper.EXPECT().GetAllBalances(s.ctx, gomock.Any()).Return(distrBal).AnyTimes()
|
||||
s.bankKeeper.EXPECT().SendCoinsFromModuleToAccount(s.ctx, gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes()
|
||||
s.stakingKeeper.EXPECT().BondDenom(s.ctx).AnyTimes()
|
||||
}
|
||||
|
||||
func TestKeeperTestSuite(t *testing.T) {
|
||||
|
||||
@ -2,8 +2,11 @@ package keeper
|
||||
|
||||
import (
|
||||
"context"
|
||||
errorspkg "errors"
|
||||
"fmt"
|
||||
|
||||
"cosmossdk.io/errors"
|
||||
"cosmossdk.io/math"
|
||||
"cosmossdk.io/x/protocolpool/types"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
@ -103,11 +106,106 @@ func (k MsgServer) CommunityPoolSpend(ctx context.Context, msg *types.MsgCommuni
|
||||
}
|
||||
|
||||
func (k MsgServer) CreateContinuousFund(ctx context.Context, msg *types.MsgCreateContinuousFund) (*types.MsgCreateContinuousFundResponse, error) {
|
||||
if err := k.validateAuthority(msg.Authority); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
recipient, err := k.Keeper.authKeeper.AddressCodec().StringToBytes(msg.Recipient)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Validate the message fields
|
||||
err = k.validateContinuousFund(ctx, *msg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Create continuous fund proposal
|
||||
cf := types.ContinuousFund{
|
||||
Recipient: msg.Recipient,
|
||||
Percentage: msg.Percentage,
|
||||
Expiry: msg.Expiry,
|
||||
}
|
||||
|
||||
// Set continuous fund to the state
|
||||
err = k.ContinuousFund.Set(ctx, recipient, cf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Set recipient fund percentage & distribution
|
||||
percentage := cf.Percentage.MulInt64(100)
|
||||
err = k.RecipientFundPercentage.Set(ctx, recipient, percentage.TruncateInt())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = k.RecipientFundDistribution.Set(ctx, recipient, math.ZeroInt())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &types.MsgCreateContinuousFundResponse{}, nil
|
||||
}
|
||||
|
||||
func (k MsgServer) WithdrawContinuousFund(ctx context.Context, msg *types.MsgWithdrawContinuousFund) (*types.MsgWithdrawContinuousFundResponse, error) {
|
||||
recipient, err := k.Keeper.authKeeper.AddressCodec().StringToBytes(msg.RecipientAddress)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid recipient address: %s", err)
|
||||
}
|
||||
|
||||
amount, err := k.withdrawContinuousFund(ctx, recipient)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if amount.IsNil() {
|
||||
k.Logger(ctx).Info(fmt.Sprintf("no distribution amount found for recipient %s", msg.RecipientAddress))
|
||||
}
|
||||
|
||||
return &types.MsgWithdrawContinuousFundResponse{Amount: amount}, nil
|
||||
}
|
||||
|
||||
func (k MsgServer) CancelContinuousFund(ctx context.Context, msg *types.MsgCancelContinuousFund) (*types.MsgCancelContinuousFundResponse, error) {
|
||||
return &types.MsgCancelContinuousFundResponse{}, nil
|
||||
sdkCtx := sdk.UnwrapSDKContext(ctx)
|
||||
|
||||
if err := k.validateAuthority(msg.Authority); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
recipient, err := k.Keeper.authKeeper.AddressCodec().StringToBytes(msg.RecipientAddress)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
canceledHeight := sdkCtx.BlockHeight()
|
||||
canceledTime := sdkCtx.BlockTime()
|
||||
|
||||
found, err := k.ContinuousFund.Has(ctx, recipient)
|
||||
if !found {
|
||||
return nil, fmt.Errorf("no recipient found to cancel continuous fund: %s", msg.RecipientAddress)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// withdraw funds if any are allocated
|
||||
withdrawnFunds, err := k.withdrawRecipientFunds(ctx, recipient)
|
||||
if err != nil {
|
||||
if !errorspkg.Is(err, types.ErrNoRecipientFund) {
|
||||
return nil, fmt.Errorf("error while withdrawing already allocated funds for recipient %s: %v", msg.RecipientAddress, err)
|
||||
}
|
||||
}
|
||||
|
||||
if err := k.ContinuousFund.Remove(ctx, recipient); err != nil {
|
||||
return nil, fmt.Errorf("failed to remove continuous fund for recipient %s: %w", msg.RecipientAddress, err)
|
||||
}
|
||||
|
||||
return &types.MsgCancelContinuousFundResponse{
|
||||
CanceledTime: canceledTime,
|
||||
CanceledHeight: uint64(canceledHeight),
|
||||
RecipientAddress: msg.RecipientAddress,
|
||||
WithdrawnAllocatedFund: withdrawnFunds,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (k *Keeper) validateAuthority(authority string) error {
|
||||
|
||||
@ -3,7 +3,9 @@ package keeper_test
|
||||
import (
|
||||
"time"
|
||||
|
||||
"cosmossdk.io/collections"
|
||||
"cosmossdk.io/core/header"
|
||||
"cosmossdk.io/math"
|
||||
"cosmossdk.io/x/protocolpool/types"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
@ -23,7 +25,6 @@ func (suite *KeeperTestSuite) TestMsgSubmitBudgetProposal() {
|
||||
period := time.Duration(60) * time.Second
|
||||
zeroPeriod := time.Duration(0) * time.Second
|
||||
testCases := map[string]struct {
|
||||
preRun func()
|
||||
input *types.MsgSubmitBudgetProposal
|
||||
expErr bool
|
||||
expErrMsg string
|
||||
@ -128,9 +129,7 @@ func (suite *KeeperTestSuite) TestMsgSubmitBudgetProposal() {
|
||||
for name, tc := range testCases {
|
||||
suite.Run(name, func() {
|
||||
suite.SetupTest()
|
||||
if tc.preRun != nil {
|
||||
tc.preRun()
|
||||
}
|
||||
|
||||
_, err := suite.msgServer.SubmitBudgetProposal(suite.ctx, tc.input)
|
||||
if tc.expErr {
|
||||
suite.Require().Error(err)
|
||||
@ -337,3 +336,525 @@ func (suite *KeeperTestSuite) TestMsgClaimBudget() {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestWithdrawContinuousFund() {
|
||||
recipient := sdk.AccAddress([]byte("recipientAddr1__________________"))
|
||||
recipient2 := sdk.AccAddress([]byte("recipientAddr2___________________"))
|
||||
recipient3 := sdk.AccAddress([]byte("recipientAddr3___________________"))
|
||||
testCases := map[string]struct {
|
||||
preRun func()
|
||||
recipientAddress []sdk.AccAddress
|
||||
expErr bool
|
||||
expErrMsg string
|
||||
withdrawnAmount sdk.Coin
|
||||
}{
|
||||
"empty recipient": {
|
||||
recipientAddress: []sdk.AccAddress{sdk.AccAddress([]byte(""))},
|
||||
expErr: true,
|
||||
expErrMsg: "invalid recipient address",
|
||||
},
|
||||
"recipient with no continuous fund": {
|
||||
recipientAddress: []sdk.AccAddress{recipient},
|
||||
expErr: true,
|
||||
expErrMsg: "no continuous fund found for recipient",
|
||||
},
|
||||
"funds percentage > 100": {
|
||||
preRun: func() {
|
||||
// Set fund 1
|
||||
percentage, err := math.LegacyNewDecFromStr("0.2")
|
||||
suite.Require().NoError(err)
|
||||
oneMonthInSeconds := int64(30 * 24 * 60 * 60) // Approximate number of seconds in 1 month
|
||||
expiry := suite.ctx.BlockTime().Add(time.Duration(oneMonthInSeconds) * time.Second)
|
||||
cf := types.ContinuousFund{
|
||||
Recipient: recipient.String(),
|
||||
Percentage: percentage,
|
||||
Expiry: &expiry,
|
||||
}
|
||||
// Set continuous fund
|
||||
err = suite.poolKeeper.ContinuousFund.Set(suite.ctx, recipient, cf)
|
||||
suite.Require().NoError(err)
|
||||
// Set recipient fund percentage and recipient fund distribution
|
||||
intPercentage := percentage.MulInt64(100)
|
||||
err = suite.poolKeeper.RecipientFundPercentage.Set(suite.ctx, recipient, intPercentage.TruncateInt())
|
||||
suite.Require().NoError(err)
|
||||
err = suite.poolKeeper.RecipientFundDistribution.Set(suite.ctx, recipient, math.ZeroInt())
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// Set fund 2
|
||||
percentage, err = math.LegacyNewDecFromStr("0.9")
|
||||
suite.Require().NoError(err)
|
||||
cf = types.ContinuousFund{
|
||||
Recipient: recipient2.String(),
|
||||
Percentage: percentage,
|
||||
Expiry: &expiry,
|
||||
}
|
||||
// Set continuous fund
|
||||
err = suite.poolKeeper.ContinuousFund.Set(suite.ctx, recipient2, cf)
|
||||
suite.Require().NoError(err)
|
||||
// Set recipient fund percentage and recipient fund distribution
|
||||
intPercentage = percentage.MulInt64(100)
|
||||
err = suite.poolKeeper.RecipientFundPercentage.Set(suite.ctx, recipient2, intPercentage.TruncateInt())
|
||||
suite.Require().NoError(err)
|
||||
err = suite.poolKeeper.RecipientFundDistribution.Set(suite.ctx, recipient2, math.ZeroInt())
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// Set ToDistribute
|
||||
toDistribute := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(100000)))
|
||||
suite.stakingKeeper.EXPECT().BondDenom(suite.ctx).Return("stake", nil).AnyTimes()
|
||||
err = suite.poolKeeper.SetToDistribute(suite.ctx, toDistribute, suite.poolKeeper.GetAuthority())
|
||||
suite.Require().NoError(err)
|
||||
},
|
||||
recipientAddress: []sdk.AccAddress{recipient},
|
||||
expErr: true,
|
||||
expErrMsg: "error while iterating all the continuous funds: total funds percentage cannot exceed 100",
|
||||
},
|
||||
"expired case": {
|
||||
preRun: func() {
|
||||
percentage, err := math.LegacyNewDecFromStr("0.2")
|
||||
suite.Require().NoError(err)
|
||||
expiry := suite.ctx.BlockTime().Add(time.Duration(-1) * time.Second)
|
||||
cf := types.ContinuousFund{
|
||||
Recipient: recipient.String(),
|
||||
Percentage: percentage,
|
||||
Expiry: &expiry,
|
||||
}
|
||||
// Set continuous fund
|
||||
err = suite.poolKeeper.ContinuousFund.Set(suite.ctx, recipient, cf)
|
||||
suite.Require().NoError(err)
|
||||
},
|
||||
recipientAddress: []sdk.AccAddress{recipient},
|
||||
expErr: true,
|
||||
expErrMsg: "cannot withdraw continuous funds: continuous fund expired for recipient",
|
||||
},
|
||||
"valid case with ToDistribute amount zero": {
|
||||
preRun: func() {
|
||||
percentage, err := math.LegacyNewDecFromStr("0.2")
|
||||
suite.Require().NoError(err)
|
||||
oneMonthInSeconds := int64(30 * 24 * 60 * 60) // Approximate number of seconds in 1 month
|
||||
expiry := suite.ctx.BlockTime().Add(time.Duration(oneMonthInSeconds) * time.Second)
|
||||
cf := types.ContinuousFund{
|
||||
Recipient: recipient.String(),
|
||||
Percentage: percentage,
|
||||
Expiry: &expiry,
|
||||
}
|
||||
// Set continuous fund
|
||||
err = suite.poolKeeper.ContinuousFund.Set(suite.ctx, recipient, cf)
|
||||
suite.Require().NoError(err)
|
||||
// Set recipient fund percentage and recipient fund distribution
|
||||
intPercentage := percentage.MulInt64(100)
|
||||
err = suite.poolKeeper.RecipientFundPercentage.Set(suite.ctx, recipient, intPercentage.TruncateInt())
|
||||
suite.Require().NoError(err)
|
||||
err = suite.poolKeeper.RecipientFundDistribution.Set(suite.ctx, recipient, math.ZeroInt())
|
||||
suite.Require().NoError(err)
|
||||
err = suite.poolKeeper.ToDistribute.Set(suite.ctx, math.ZeroInt())
|
||||
suite.Require().NoError(err)
|
||||
},
|
||||
recipientAddress: []sdk.AccAddress{recipient},
|
||||
expErr: false,
|
||||
withdrawnAmount: sdk.NewCoin(sdk.DefaultBondDenom, math.ZeroInt()),
|
||||
},
|
||||
"valid case with empty expiry": {
|
||||
preRun: func() {
|
||||
percentage, err := math.LegacyNewDecFromStr("0.2")
|
||||
suite.Require().NoError(err)
|
||||
cf := types.ContinuousFund{
|
||||
Recipient: recipient.String(),
|
||||
Percentage: percentage,
|
||||
}
|
||||
// Set continuous fund
|
||||
err = suite.poolKeeper.ContinuousFund.Set(suite.ctx, recipient, cf)
|
||||
suite.Require().NoError(err)
|
||||
// Set recipient fund percentage and recipient fund distribution
|
||||
intPercentage := percentage.MulInt64(100)
|
||||
err = suite.poolKeeper.RecipientFundPercentage.Set(suite.ctx, recipient, intPercentage.TruncateInt())
|
||||
suite.Require().NoError(err)
|
||||
err = suite.poolKeeper.RecipientFundDistribution.Set(suite.ctx, recipient, math.ZeroInt())
|
||||
suite.Require().NoError(err)
|
||||
toDistribute := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(100000)))
|
||||
err = suite.poolKeeper.SetToDistribute(suite.ctx, toDistribute, suite.poolKeeper.GetAuthority())
|
||||
suite.Require().NoError(err)
|
||||
},
|
||||
recipientAddress: []sdk.AccAddress{recipient},
|
||||
expErr: false,
|
||||
withdrawnAmount: sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(20000)),
|
||||
},
|
||||
"valid case": {
|
||||
preRun: func() {
|
||||
percentage, err := math.LegacyNewDecFromStr("0.2")
|
||||
suite.Require().NoError(err)
|
||||
oneMonthInSeconds := int64(30 * 24 * 60 * 60) // Approximate number of seconds in 1 month
|
||||
expiry := suite.ctx.BlockTime().Add(time.Duration(oneMonthInSeconds) * time.Second)
|
||||
cf := types.ContinuousFund{
|
||||
Recipient: recipient.String(),
|
||||
Percentage: percentage,
|
||||
Expiry: &expiry,
|
||||
}
|
||||
// Set continuous fund
|
||||
err = suite.poolKeeper.ContinuousFund.Set(suite.ctx, recipient, cf)
|
||||
suite.Require().NoError(err)
|
||||
// Set recipient fund percentage and recipient fund distribution
|
||||
intPercentage := percentage.MulInt64(100)
|
||||
err = suite.poolKeeper.RecipientFundPercentage.Set(suite.ctx, recipient, intPercentage.TruncateInt())
|
||||
suite.Require().NoError(err)
|
||||
err = suite.poolKeeper.RecipientFundDistribution.Set(suite.ctx, recipient, math.ZeroInt())
|
||||
suite.Require().NoError(err)
|
||||
toDistribute := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(100000)))
|
||||
err = suite.poolKeeper.SetToDistribute(suite.ctx, toDistribute, suite.poolKeeper.GetAuthority())
|
||||
suite.Require().NoError(err)
|
||||
},
|
||||
recipientAddress: []sdk.AccAddress{recipient},
|
||||
expErr: false,
|
||||
withdrawnAmount: sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(20000)),
|
||||
},
|
||||
"valid case with multiple funds": {
|
||||
preRun: func() {
|
||||
// Set continuous fund 1
|
||||
percentage, err := math.LegacyNewDecFromStr("0.3")
|
||||
suite.Require().NoError(err)
|
||||
oneMonthInSeconds := int64(30 * 24 * 60 * 60) // Approximate number of seconds in 1 month
|
||||
expiry := suite.ctx.BlockTime().Add(time.Duration(oneMonthInSeconds) * time.Second)
|
||||
cf := types.ContinuousFund{
|
||||
Recipient: recipient.String(),
|
||||
Percentage: percentage,
|
||||
Expiry: &expiry,
|
||||
}
|
||||
// Set continuous fund
|
||||
err = suite.poolKeeper.ContinuousFund.Set(suite.ctx, recipient, cf)
|
||||
suite.Require().NoError(err)
|
||||
// Set recipient fund percentage and recipient fund distribution
|
||||
intPercentage := percentage.MulInt64(100)
|
||||
err = suite.poolKeeper.RecipientFundPercentage.Set(suite.ctx, recipient, intPercentage.TruncateInt())
|
||||
suite.Require().NoError(err)
|
||||
err = suite.poolKeeper.RecipientFundDistribution.Set(suite.ctx, recipient, math.ZeroInt())
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// Set continuous fund 2
|
||||
percentage2, err := math.LegacyNewDecFromStr("0.2")
|
||||
suite.Require().NoError(err)
|
||||
cf = types.ContinuousFund{
|
||||
Recipient: recipient2.String(),
|
||||
Percentage: percentage,
|
||||
Expiry: &expiry,
|
||||
}
|
||||
// Set continuous fund
|
||||
err = suite.poolKeeper.ContinuousFund.Set(suite.ctx, recipient2, cf)
|
||||
suite.Require().NoError(err)
|
||||
// Set recipient fund percentage and recipient fund distribution
|
||||
intPercentage = percentage2.MulInt64(100)
|
||||
err = suite.poolKeeper.RecipientFundPercentage.Set(suite.ctx, recipient2, intPercentage.TruncateInt())
|
||||
suite.Require().NoError(err)
|
||||
err = suite.poolKeeper.RecipientFundDistribution.Set(suite.ctx, recipient2, math.ZeroInt())
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// Set continuous fund 3
|
||||
percentage3, err := math.LegacyNewDecFromStr("0.3")
|
||||
suite.Require().NoError(err)
|
||||
cf = types.ContinuousFund{
|
||||
Recipient: recipient3.String(),
|
||||
Percentage: percentage2,
|
||||
Expiry: &expiry,
|
||||
}
|
||||
// Set continuous fund
|
||||
err = suite.poolKeeper.ContinuousFund.Set(suite.ctx, recipient3, cf)
|
||||
suite.Require().NoError(err)
|
||||
// Set recipient fund percentage and recipient fund distribution
|
||||
intPercentage = percentage3.MulInt64(100)
|
||||
err = suite.poolKeeper.RecipientFundPercentage.Set(suite.ctx, recipient3, intPercentage.TruncateInt())
|
||||
suite.Require().NoError(err)
|
||||
err = suite.poolKeeper.RecipientFundDistribution.Set(suite.ctx, recipient3, math.ZeroInt())
|
||||
suite.Require().NoError(err)
|
||||
|
||||
toDistribute := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(100000)))
|
||||
err = suite.poolKeeper.SetToDistribute(suite.ctx, toDistribute, suite.poolKeeper.GetAuthority())
|
||||
suite.Require().NoError(err)
|
||||
},
|
||||
recipientAddress: []sdk.AccAddress{recipient, recipient2, recipient3},
|
||||
expErr: false,
|
||||
withdrawnAmount: sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(30000)),
|
||||
},
|
||||
}
|
||||
|
||||
for name, tc := range testCases {
|
||||
suite.Run(name, func() {
|
||||
suite.SetupTest()
|
||||
if tc.preRun != nil {
|
||||
tc.preRun()
|
||||
}
|
||||
msg := &types.MsgWithdrawContinuousFund{
|
||||
RecipientAddress: tc.recipientAddress[0].String(),
|
||||
}
|
||||
|
||||
suite.mockWithdrawContinuousFund()
|
||||
|
||||
resp, err := suite.msgServer.WithdrawContinuousFund(suite.ctx, msg)
|
||||
if tc.expErr {
|
||||
suite.Require().Error(err)
|
||||
suite.Require().Contains(err.Error(), tc.expErrMsg)
|
||||
} else {
|
||||
suite.Require().NoError(err)
|
||||
suite.Require().Equal(tc.withdrawnAmount, resp.Amount)
|
||||
|
||||
// this condition is valid only for request with multiple continuous funds
|
||||
if len(tc.recipientAddress) > 1 {
|
||||
toClaim, err := suite.poolKeeper.RecipientFundDistribution.Get(suite.ctx, tc.recipientAddress[1])
|
||||
suite.Require().NoError(err)
|
||||
suite.Require().Equal(toClaim, math.NewInt(20000))
|
||||
toClaim, err = suite.poolKeeper.RecipientFundDistribution.Get(suite.ctx, tc.recipientAddress[2])
|
||||
suite.Require().NoError(err)
|
||||
suite.Require().Equal(toClaim, math.NewInt(30000))
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestCreateContinuousFund() {
|
||||
percentage, err := math.LegacyNewDecFromStr("0.2")
|
||||
suite.Require().NoError(err)
|
||||
negativePercentage, err := math.LegacyNewDecFromStr("-0.2")
|
||||
suite.Require().NoError(err)
|
||||
invalidExpirty := suite.ctx.BlockTime().Add(-15 * time.Second)
|
||||
oneMonthInSeconds := int64(30 * 24 * 60 * 60) // Approximate number of seconds in 1 month
|
||||
expiry := suite.ctx.BlockTime().Add(time.Duration(oneMonthInSeconds) * time.Second)
|
||||
testCases := map[string]struct {
|
||||
input *types.MsgCreateContinuousFund
|
||||
expErr bool
|
||||
expErrMsg string
|
||||
}{
|
||||
"empty recipient address": {
|
||||
input: &types.MsgCreateContinuousFund{
|
||||
Authority: suite.poolKeeper.GetAuthority(),
|
||||
Recipient: "",
|
||||
Percentage: percentage,
|
||||
Expiry: &expiry,
|
||||
},
|
||||
expErr: true,
|
||||
expErrMsg: "empty address string is not allowed",
|
||||
},
|
||||
"empty authority": {
|
||||
input: &types.MsgCreateContinuousFund{
|
||||
Authority: "",
|
||||
Recipient: recipientAddr.String(),
|
||||
Percentage: percentage,
|
||||
Expiry: &expiry,
|
||||
},
|
||||
expErr: true,
|
||||
expErrMsg: "empty address string is not allowed",
|
||||
},
|
||||
"invalid authority": {
|
||||
input: &types.MsgCreateContinuousFund{
|
||||
Authority: "invalid_authority",
|
||||
Recipient: recipientAddr.String(),
|
||||
Percentage: percentage,
|
||||
Expiry: &expiry,
|
||||
},
|
||||
expErr: true,
|
||||
expErrMsg: "invalid authority",
|
||||
},
|
||||
"zero percentage": {
|
||||
input: &types.MsgCreateContinuousFund{
|
||||
Authority: suite.poolKeeper.GetAuthority(),
|
||||
Recipient: recipientAddr.String(),
|
||||
Percentage: math.LegacyNewDec(0),
|
||||
Expiry: &expiry,
|
||||
},
|
||||
expErr: true,
|
||||
expErrMsg: "percentage cannot be zero or empty",
|
||||
},
|
||||
"negative percentage": {
|
||||
input: &types.MsgCreateContinuousFund{
|
||||
Authority: suite.poolKeeper.GetAuthority(),
|
||||
Recipient: recipientAddr.String(),
|
||||
Percentage: negativePercentage,
|
||||
Expiry: &expiry,
|
||||
},
|
||||
expErr: true,
|
||||
expErrMsg: "percentage cannot be negative",
|
||||
},
|
||||
"invalid percentage": {
|
||||
input: &types.MsgCreateContinuousFund{
|
||||
Authority: suite.poolKeeper.GetAuthority(),
|
||||
Recipient: recipientAddr.String(),
|
||||
Percentage: math.LegacyNewDec(1),
|
||||
Expiry: &expiry,
|
||||
},
|
||||
expErr: true,
|
||||
expErrMsg: "percentage cannot be greater than or equal to one",
|
||||
},
|
||||
"invalid expiry": {
|
||||
input: &types.MsgCreateContinuousFund{
|
||||
Authority: suite.poolKeeper.GetAuthority(),
|
||||
Recipient: recipientAddr.String(),
|
||||
Percentage: percentage,
|
||||
Expiry: &invalidExpirty,
|
||||
},
|
||||
expErr: true,
|
||||
expErrMsg: "expiry time cannot be less than the current block time",
|
||||
},
|
||||
"all good": {
|
||||
input: &types.MsgCreateContinuousFund{
|
||||
Authority: suite.poolKeeper.GetAuthority(),
|
||||
Recipient: recipientAddr.String(),
|
||||
Percentage: percentage,
|
||||
Expiry: &expiry,
|
||||
},
|
||||
expErr: false,
|
||||
},
|
||||
}
|
||||
|
||||
for name, tc := range testCases {
|
||||
suite.Run(name, func() {
|
||||
suite.SetupTest()
|
||||
|
||||
_, err := suite.msgServer.CreateContinuousFund(suite.ctx, tc.input)
|
||||
if tc.expErr {
|
||||
suite.Require().Error(err)
|
||||
suite.Require().Contains(err.Error(), tc.expErrMsg)
|
||||
} else {
|
||||
suite.Require().NoError(err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestCancelContinuousFund() {
|
||||
recipient2 := sdk.AccAddress([]byte("recipientAddr2___________________"))
|
||||
|
||||
testCases := map[string]struct {
|
||||
preRun func()
|
||||
recipientAddr sdk.AccAddress
|
||||
expErr bool
|
||||
expErrMsg string
|
||||
postRun func()
|
||||
withdrawnFunds sdk.Coin
|
||||
}{
|
||||
"empty recipient": {
|
||||
preRun: func() {
|
||||
percentage, err := math.LegacyNewDecFromStr("0.2")
|
||||
suite.Require().NoError(err)
|
||||
oneMonthInSeconds := int64(30 * 24 * 60 * 60) // Approximate number of seconds in 1 month
|
||||
expiry := suite.ctx.BlockTime().Add(time.Duration(oneMonthInSeconds) * time.Second)
|
||||
cf := types.ContinuousFund{
|
||||
Recipient: "",
|
||||
Percentage: percentage,
|
||||
Expiry: &expiry,
|
||||
}
|
||||
err = suite.poolKeeper.ContinuousFund.Set(suite.ctx, recipientAddr, cf)
|
||||
suite.Require().NoError(err)
|
||||
},
|
||||
expErr: true,
|
||||
expErrMsg: "empty address string is not allowed",
|
||||
},
|
||||
"no recipient found": {
|
||||
recipientAddr: recipientAddr,
|
||||
expErr: true,
|
||||
expErrMsg: "no recipient found to cancel continuous fund",
|
||||
},
|
||||
"all good with unclaimed funds for recipient": {
|
||||
preRun: func() {
|
||||
// Set fund 1
|
||||
percentage, err := math.LegacyNewDecFromStr("0.2")
|
||||
suite.Require().NoError(err)
|
||||
oneMonthInSeconds := int64(30 * 24 * 60 * 60) // Approximate number of seconds in 1 month
|
||||
expiry := suite.ctx.BlockTime().Add(time.Duration(oneMonthInSeconds) * time.Second)
|
||||
cf := types.ContinuousFund{
|
||||
Recipient: recipientAddr.String(),
|
||||
Percentage: percentage,
|
||||
Expiry: &expiry,
|
||||
}
|
||||
// Set continuous fund
|
||||
err = suite.poolKeeper.ContinuousFund.Set(suite.ctx, recipientAddr, cf)
|
||||
suite.Require().NoError(err)
|
||||
// Set recipient fund percentage and recipient fund distribution
|
||||
intPercentage := percentage.MulInt64(100)
|
||||
err = suite.poolKeeper.RecipientFundPercentage.Set(suite.ctx, recipientAddr, intPercentage.TruncateInt())
|
||||
suite.Require().NoError(err)
|
||||
err = suite.poolKeeper.RecipientFundDistribution.Set(suite.ctx, recipientAddr, math.ZeroInt())
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// Set fund 2
|
||||
percentage, err = math.LegacyNewDecFromStr("0.3")
|
||||
suite.Require().NoError(err)
|
||||
cf = types.ContinuousFund{
|
||||
Recipient: recipient2.String(),
|
||||
Percentage: percentage,
|
||||
Expiry: &expiry,
|
||||
}
|
||||
// Set continuous fund
|
||||
err = suite.poolKeeper.ContinuousFund.Set(suite.ctx, recipient2, cf)
|
||||
suite.Require().NoError(err)
|
||||
// Set recipient fund percentage and recipient fund distribution
|
||||
intPercentage = percentage.MulInt64(100)
|
||||
err = suite.poolKeeper.RecipientFundPercentage.Set(suite.ctx, recipient2, intPercentage.TruncateInt())
|
||||
suite.Require().NoError(err)
|
||||
err = suite.poolKeeper.RecipientFundDistribution.Set(suite.ctx, recipient2, math.ZeroInt())
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// Set ToDistribute
|
||||
toDistribute := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(100000)))
|
||||
err = suite.poolKeeper.SetToDistribute(suite.ctx, toDistribute, suite.poolKeeper.GetAuthority())
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// withdraw funds for fund request 2
|
||||
suite.mockWithdrawContinuousFund()
|
||||
msg := &types.MsgWithdrawContinuousFund{RecipientAddress: recipient2.String()}
|
||||
_, err = suite.msgServer.WithdrawContinuousFund(suite.ctx, msg)
|
||||
suite.Require().NoError(err)
|
||||
},
|
||||
recipientAddr: recipientAddr,
|
||||
expErr: false,
|
||||
postRun: func() {
|
||||
_, err := suite.poolKeeper.ContinuousFund.Get(suite.ctx, recipientAddr)
|
||||
suite.Require().Error(err)
|
||||
suite.Require().ErrorIs(err, collections.ErrNotFound)
|
||||
},
|
||||
withdrawnFunds: sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(20000)),
|
||||
},
|
||||
"all good": {
|
||||
preRun: func() {
|
||||
percentage, err := math.LegacyNewDecFromStr("0.2")
|
||||
suite.Require().NoError(err)
|
||||
oneMonthInSeconds := int64(30 * 24 * 60 * 60) // Approximate number of seconds in 1 month
|
||||
expiry := suite.ctx.BlockTime().Add(time.Duration(oneMonthInSeconds) * time.Second)
|
||||
cf := types.ContinuousFund{
|
||||
Recipient: recipientAddr.String(),
|
||||
Percentage: percentage,
|
||||
Expiry: &expiry,
|
||||
}
|
||||
err = suite.poolKeeper.ContinuousFund.Set(suite.ctx, recipientAddr, cf)
|
||||
suite.Require().NoError(err)
|
||||
},
|
||||
recipientAddr: recipientAddr,
|
||||
expErr: false,
|
||||
postRun: func() {
|
||||
_, err := suite.poolKeeper.ContinuousFund.Get(suite.ctx, recipientAddr)
|
||||
suite.Require().Error(err)
|
||||
suite.Require().ErrorIs(err, collections.ErrNotFound)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for name, tc := range testCases {
|
||||
suite.Run(name, func() {
|
||||
suite.SetupTest()
|
||||
if tc.preRun != nil {
|
||||
tc.preRun()
|
||||
}
|
||||
msg := &types.MsgCancelContinuousFund{
|
||||
Authority: suite.poolKeeper.GetAuthority(),
|
||||
RecipientAddress: tc.recipientAddr.String(),
|
||||
}
|
||||
resp, err := suite.msgServer.CancelContinuousFund(suite.ctx, msg)
|
||||
if tc.expErr {
|
||||
suite.Require().Error(err)
|
||||
suite.Require().Contains(err.Error(), tc.expErrMsg)
|
||||
} else {
|
||||
suite.Require().NoError(err)
|
||||
suite.Require().Equal(resp.WithdrawnAllocatedFund, tc.withdrawnFunds)
|
||||
}
|
||||
if tc.postRun != nil {
|
||||
tc.postRun()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,8 @@ package protocolpool
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
|
||||
@ -30,6 +32,7 @@ var (
|
||||
|
||||
_ module.AppModule = AppModule{}
|
||||
_ module.AppModuleSimulation = AppModule{}
|
||||
_ module.HasGenesis = AppModule{}
|
||||
)
|
||||
|
||||
// AppModuleBasic defines the basic application module used by the pool module.
|
||||
@ -55,6 +58,22 @@ func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry)
|
||||
types.RegisterInterfaces(registry)
|
||||
}
|
||||
|
||||
// DefaultGenesis returns default genesis state as raw bytes for the protocolpool
|
||||
// module.
|
||||
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
|
||||
return cdc.MustMarshalJSON(types.DefaultGenesisState())
|
||||
}
|
||||
|
||||
// ValidateGenesis performs genesis state validation for the protocolpool module.
|
||||
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error {
|
||||
var data types.GenesisState
|
||||
if err := cdc.UnmarshalJSON(bz, &data); err != nil {
|
||||
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
|
||||
}
|
||||
|
||||
return types.ValidateGenesis(&data)
|
||||
}
|
||||
|
||||
// AppModule implements an application module for the pool module
|
||||
type AppModule struct {
|
||||
AppModuleBasic
|
||||
@ -90,6 +109,25 @@ func NewAppModule(cdc codec.Codec, keeper keeper.Keeper,
|
||||
}
|
||||
}
|
||||
|
||||
// InitGenesis performs genesis initialization for the protocolpool module.
|
||||
func (am AppModule) InitGenesis(ctx context.Context, cdc codec.JSONCodec, data json.RawMessage) {
|
||||
var genesisState types.GenesisState
|
||||
cdc.MustUnmarshalJSON(data, &genesisState)
|
||||
if err := am.keeper.InitGenesis(ctx, &genesisState); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// ExportGenesis returns the exported genesis state as raw bytes for the protocolpool
|
||||
// module.
|
||||
func (am AppModule) ExportGenesis(ctx context.Context, cdc codec.JSONCodec) json.RawMessage {
|
||||
gs, err := am.keeper.ExportGenesis(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return cdc.MustMarshalJSON(gs)
|
||||
}
|
||||
|
||||
// ConsensusVersion implements AppModule/ConsensusVersion.
|
||||
func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion }
|
||||
|
||||
@ -113,6 +151,7 @@ type ModuleInputs struct {
|
||||
|
||||
AccountKeeper types.AccountKeeper
|
||||
BankKeeper types.BankKeeper
|
||||
StakingKeeper types.StakingKeeper
|
||||
}
|
||||
|
||||
type ModuleOutputs struct {
|
||||
@ -129,7 +168,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs {
|
||||
authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority)
|
||||
}
|
||||
|
||||
k := keeper.NewKeeper(in.Codec, in.StoreService, in.AccountKeeper, in.BankKeeper, authority.String())
|
||||
k := keeper.NewKeeper(in.Codec, in.StoreService, in.AccountKeeper, in.BankKeeper, in.StakingKeeper, authority.String())
|
||||
m := NewAppModule(in.Codec, k, in.AccountKeeper, in.BankKeeper)
|
||||
|
||||
return ModuleOutputs{
|
||||
|
||||
@ -129,6 +129,20 @@ func (mr *MockBankKeeperMockRecorder) GetAllBalances(ctx, addr interface{}) *gom
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllBalances", reflect.TypeOf((*MockBankKeeper)(nil).GetAllBalances), ctx, addr)
|
||||
}
|
||||
|
||||
// MintCoins mocks base method.
|
||||
func (m *MockBankKeeper) MintCoins(ctx context.Context, moduleName string, amt types.Coins) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "MintCoins", ctx, moduleName, amt)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// MintCoins indicates an expected call of MintCoins.
|
||||
func (mr *MockBankKeeperMockRecorder) MintCoins(ctx, moduleName, amt interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MintCoins", reflect.TypeOf((*MockBankKeeper)(nil).MintCoins), ctx, moduleName, amt)
|
||||
}
|
||||
|
||||
// SendCoinsFromAccountToModule mocks base method.
|
||||
func (m *MockBankKeeper) SendCoinsFromAccountToModule(ctx context.Context, senderAddr types.AccAddress, recipientModule string, amt types.Coins) error {
|
||||
m.ctrl.T.Helper()
|
||||
@ -157,6 +171,20 @@ func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderMo
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToAccount", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToAccount), ctx, senderModule, recipientAddr, amt)
|
||||
}
|
||||
|
||||
// SendCoinsFromModuleToModule mocks base method.
|
||||
func (m *MockBankKeeper) SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt types.Coins) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SendCoinsFromModuleToModule", ctx, senderModule, recipientModule, amt)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SendCoinsFromModuleToModule indicates an expected call of SendCoinsFromModuleToModule.
|
||||
func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToModule(ctx, senderModule, recipientModule, amt interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToModule), ctx, senderModule, recipientModule, amt)
|
||||
}
|
||||
|
||||
// SpendableCoins mocks base method.
|
||||
func (m *MockBankKeeper) SpendableCoins(ctx context.Context, addr types.AccAddress) types.Coins {
|
||||
m.ctrl.T.Helper()
|
||||
@ -170,3 +198,41 @@ func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gom
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpendableCoins", reflect.TypeOf((*MockBankKeeper)(nil).SpendableCoins), ctx, addr)
|
||||
}
|
||||
|
||||
// MockStakingKeeper is a mock of StakingKeeper interface.
|
||||
type MockStakingKeeper struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockStakingKeeperMockRecorder
|
||||
}
|
||||
|
||||
// MockStakingKeeperMockRecorder is the mock recorder for MockStakingKeeper.
|
||||
type MockStakingKeeperMockRecorder struct {
|
||||
mock *MockStakingKeeper
|
||||
}
|
||||
|
||||
// NewMockStakingKeeper creates a new mock instance.
|
||||
func NewMockStakingKeeper(ctrl *gomock.Controller) *MockStakingKeeper {
|
||||
mock := &MockStakingKeeper{ctrl: ctrl}
|
||||
mock.recorder = &MockStakingKeeperMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockStakingKeeper) EXPECT() *MockStakingKeeperMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// BondDenom mocks base method.
|
||||
func (m *MockStakingKeeper) BondDenom(ctx context.Context) (string, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "BondDenom", ctx)
|
||||
ret0, _ := ret[0].(string)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// BondDenom indicates an expected call of BondDenom.
|
||||
func (mr *MockStakingKeeperMockRecorder) BondDenom(ctx interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BondDenom", reflect.TypeOf((*MockStakingKeeper)(nil).BondDenom), ctx)
|
||||
}
|
||||
|
||||
@ -13,6 +13,9 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
|
||||
&MsgCommunityPoolSpend{},
|
||||
&MsgSubmitBudgetProposal{},
|
||||
&MsgClaimBudget{},
|
||||
&MsgCreateContinuousFund{},
|
||||
&MsgCancelContinuousFund{},
|
||||
&MsgWithdrawContinuousFund{},
|
||||
)
|
||||
|
||||
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
|
||||
|
||||
@ -2,4 +2,7 @@ package types
|
||||
|
||||
import "cosmossdk.io/errors"
|
||||
|
||||
var ErrInvalidSigner = errors.Register(ModuleName, 2, "expected authority account as only signer for community pool spend message")
|
||||
var (
|
||||
ErrInvalidSigner = errors.Register(ModuleName, 2, "expected authority account as only signer for community pool spend message")
|
||||
ErrNoRecipientFund = errors.Register(ModuleName, 3, "no recipient fund found for recipient")
|
||||
)
|
||||
|
||||
@ -17,8 +17,14 @@ type AccountKeeper interface {
|
||||
|
||||
// BankKeeper defines the expected interface needed to retrieve account balances.
|
||||
type BankKeeper interface {
|
||||
MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error
|
||||
GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins
|
||||
SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins
|
||||
SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
|
||||
SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
|
||||
SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error
|
||||
}
|
||||
|
||||
type StakingKeeper interface {
|
||||
BondDenom(ctx context.Context) (string, error)
|
||||
}
|
||||
|
||||
82
x/protocolpool/types/genesis.go
Normal file
82
x/protocolpool/types/genesis.go
Normal file
@ -0,0 +1,82 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"cosmossdk.io/errors"
|
||||
"cosmossdk.io/math"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
)
|
||||
|
||||
func NewGenesisState(cf []*ContinuousFund, budget []*Budget) *GenesisState {
|
||||
return &GenesisState{
|
||||
ContinuousFund: cf,
|
||||
Budget: budget,
|
||||
}
|
||||
}
|
||||
|
||||
func DefaultGenesisState() *GenesisState {
|
||||
return &GenesisState{
|
||||
ContinuousFund: []*ContinuousFund{},
|
||||
Budget: []*Budget{},
|
||||
}
|
||||
}
|
||||
|
||||
// ValidateGenesis validates the genesis state of protocolpool genesis input
|
||||
func ValidateGenesis(gs *GenesisState) error {
|
||||
for _, cf := range gs.ContinuousFund {
|
||||
if err := validateContinuousFund(*cf); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
for _, bp := range gs.Budget {
|
||||
if err := validateBudget(*bp); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateBudget(bp Budget) error {
|
||||
if bp.RecipientAddress == "" {
|
||||
return fmt.Errorf("recipient cannot be empty")
|
||||
}
|
||||
|
||||
// Validate TotalBudget
|
||||
amount := sdk.NewCoins(*bp.TotalBudget)
|
||||
if amount.IsZero() {
|
||||
return fmt.Errorf("total budget cannot be zero")
|
||||
}
|
||||
if err := amount.Validate(); err != nil {
|
||||
return errors.Wrap(sdkerrors.ErrInvalidCoins, amount.String())
|
||||
}
|
||||
|
||||
if bp.Tranches == 0 {
|
||||
return fmt.Errorf("invalid budget proposal: tranches must be greater than zero")
|
||||
}
|
||||
|
||||
if bp.Period == nil || *bp.Period == 0 {
|
||||
return fmt.Errorf("invalid budget proposal: period length should be greater than zero")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateContinuousFund(cf ContinuousFund) error {
|
||||
if cf.Recipient == "" {
|
||||
return fmt.Errorf("recipient cannot be empty")
|
||||
}
|
||||
|
||||
// Validate percentage
|
||||
if cf.Percentage.IsZero() || cf.Percentage.IsNil() {
|
||||
return fmt.Errorf("percentage cannot be zero or empty")
|
||||
}
|
||||
if cf.Percentage.IsNegative() {
|
||||
return fmt.Errorf("percentage cannot be negative")
|
||||
}
|
||||
if cf.Percentage.GT(math.LegacyOneDec()) {
|
||||
return fmt.Errorf("percentage cannot be greater than one")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
395
x/protocolpool/types/genesis.pb.go
Normal file
395
x/protocolpool/types/genesis.pb.go
Normal file
@ -0,0 +1,395 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: cosmos/protocolpool/v1/genesis.proto
|
||||
|
||||
package types
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
proto "github.com/cosmos/gogoproto/proto"
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
// GenesisState defines the protocolpool module's genesis state.
|
||||
type GenesisState struct {
|
||||
// ContinuousFund defines the continuous funds at genesis.
|
||||
ContinuousFund []*ContinuousFund `protobuf:"bytes,1,rep,name=continuous_fund,json=continuousFund,proto3" json:"continuous_fund,omitempty"`
|
||||
// Budget defines the budget proposals at genesis.
|
||||
Budget []*Budget `protobuf:"bytes,2,rep,name=budget,proto3" json:"budget,omitempty"`
|
||||
}
|
||||
|
||||
func (m *GenesisState) Reset() { *m = GenesisState{} }
|
||||
func (m *GenesisState) String() string { return proto.CompactTextString(m) }
|
||||
func (*GenesisState) ProtoMessage() {}
|
||||
func (*GenesisState) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_72560a99455b4146, []int{0}
|
||||
}
|
||||
func (m *GenesisState) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GenesisState.Merge(m, src)
|
||||
}
|
||||
func (m *GenesisState) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *GenesisState) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GenesisState.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GenesisState proto.InternalMessageInfo
|
||||
|
||||
func (m *GenesisState) GetContinuousFund() []*ContinuousFund {
|
||||
if m != nil {
|
||||
return m.ContinuousFund
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *GenesisState) GetBudget() []*Budget {
|
||||
if m != nil {
|
||||
return m.Budget
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*GenesisState)(nil), "cosmos.protocolpool.v1.GenesisState")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("cosmos/protocolpool/v1/genesis.proto", fileDescriptor_72560a99455b4146)
|
||||
}
|
||||
|
||||
var fileDescriptor_72560a99455b4146 = []byte{
|
||||
// 208 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x49, 0xce, 0x2f, 0xce,
|
||||
0xcd, 0x2f, 0xd6, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0x29, 0xc8, 0xcf, 0xcf, 0xd1,
|
||||
0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x03, 0x8b, 0x0b, 0x89, 0x41,
|
||||
0x54, 0xe9, 0x21, 0xab, 0xd2, 0x2b, 0x33, 0x94, 0x52, 0xc2, 0xa1, 0xbb, 0xa4, 0xb2, 0x20, 0x15,
|
||||
0xaa, 0x5a, 0x69, 0x3a, 0x23, 0x17, 0x8f, 0x3b, 0xc4, 0xb4, 0xe0, 0x92, 0xc4, 0x92, 0x54, 0x21,
|
||||
0x7f, 0x2e, 0xfe, 0xe4, 0xfc, 0xbc, 0x92, 0xcc, 0xbc, 0xd2, 0xfc, 0xd2, 0xe2, 0xf8, 0xb4, 0xd2,
|
||||
0xbc, 0x14, 0x09, 0x46, 0x05, 0x66, 0x0d, 0x6e, 0x23, 0x35, 0x3d, 0xec, 0xd6, 0xe8, 0x39, 0xc3,
|
||||
0x95, 0xbb, 0x95, 0xe6, 0xa5, 0x04, 0xf1, 0x25, 0xa3, 0xf0, 0x85, 0xcc, 0xb8, 0xd8, 0x92, 0x4a,
|
||||
0x53, 0xd2, 0x53, 0x4b, 0x24, 0x98, 0xc0, 0xe6, 0xc8, 0xe1, 0x32, 0xc7, 0x09, 0xac, 0x2a, 0x08,
|
||||
0xaa, 0xda, 0xc9, 0xfa, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63,
|
||||
0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x14, 0x21,
|
||||
0x06, 0x14, 0xa7, 0x64, 0xeb, 0x65, 0xe6, 0xeb, 0x57, 0xa0, 0xfa, 0x0f, 0xec, 0xb9, 0x24, 0x36,
|
||||
0xb0, 0x98, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x9a, 0x97, 0x3f, 0xc6, 0x41, 0x01, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Budget) > 0 {
|
||||
for iNdEx := len(m.Budget) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
size, err := m.Budget[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintGenesis(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
}
|
||||
if len(m.ContinuousFund) > 0 {
|
||||
for iNdEx := len(m.ContinuousFund) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
size, err := m.ContinuousFund[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintGenesis(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovGenesis(v)
|
||||
base := offset
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return base
|
||||
}
|
||||
func (m *GenesisState) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.ContinuousFund) > 0 {
|
||||
for _, e := range m.ContinuousFund {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovGenesis(uint64(l))
|
||||
}
|
||||
}
|
||||
if len(m.Budget) > 0 {
|
||||
for _, e := range m.Budget {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovGenesis(uint64(l))
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovGenesis(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
func sozGenesis(x uint64) (n int) {
|
||||
return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *GenesisState) 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 ErrIntOverflowGenesis
|
||||
}
|
||||
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: GenesisState: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ContinuousFund", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.ContinuousFund = append(m.ContinuousFund, &ContinuousFund{})
|
||||
if err := m.ContinuousFund[len(m.ContinuousFund)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Budget", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Budget = append(m.Budget, &Budget{})
|
||||
if err := m.Budget[len(m.Budget)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipGenesis(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipGenesis(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
depth := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
wireType := int(wire & 0x7)
|
||||
switch wireType {
|
||||
case 0:
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx++
|
||||
if dAtA[iNdEx-1] < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
length |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthGenesis
|
||||
}
|
||||
iNdEx += length
|
||||
case 3:
|
||||
depth++
|
||||
case 4:
|
||||
if depth == 0 {
|
||||
return 0, ErrUnexpectedEndOfGroupGenesis
|
||||
}
|
||||
depth--
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
if iNdEx < 0 {
|
||||
return 0, ErrInvalidLengthGenesis
|
||||
}
|
||||
if depth == 0 {
|
||||
return iNdEx, nil
|
||||
}
|
||||
}
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow")
|
||||
ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
|
||||
)
|
||||
@ -18,4 +18,10 @@ const (
|
||||
GovModuleName = "gov"
|
||||
)
|
||||
|
||||
var BudgetKey = collections.NewPrefix(2)
|
||||
var (
|
||||
BudgetKey = collections.NewPrefix(2)
|
||||
ContinuousFundKey = collections.NewPrefix(3)
|
||||
RecipientFundPercentageKey = collections.NewPrefix(4)
|
||||
RecipientFundDistributionKey = collections.NewPrefix(5)
|
||||
ToDistributeKey = collections.NewPrefix(6)
|
||||
)
|
||||
|
||||
@ -442,23 +442,14 @@ func (m *MsgClaimBudgetResponse) GetAmount() types.Coin {
|
||||
|
||||
// MsgCreateContinuousFund defines a message for adding continuous funds.
|
||||
type MsgCreateContinuousFund struct {
|
||||
// Title is the title of the funds.
|
||||
Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
|
||||
// Description of the funds.
|
||||
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
|
||||
// Authority is the address that controls the module (defaults to x/gov unless overwritten).
|
||||
Authority string `protobuf:"bytes,3,opt,name=authority,proto3" json:"authority,omitempty"`
|
||||
Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
|
||||
// Recipient address of the account receiving funds.
|
||||
Recipient string `protobuf:"bytes,4,opt,name=recipient,proto3" json:"recipient,omitempty"`
|
||||
// Metadata is any arbitrary metadata attached.
|
||||
Metadata string `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata,omitempty"`
|
||||
// Percentage is the percentage of funds to be allocated from Community pool share on block by block,
|
||||
// till the `cap` is reached or expired.
|
||||
Percentage cosmossdk_io_math.LegacyDec `protobuf:"bytes,6,opt,name=percentage,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"percentage"`
|
||||
// Cap is the capital amount, which when its met funds are no longer distributed.
|
||||
Cap github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,7,rep,name=cap,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"cap"`
|
||||
Recipient string `protobuf:"bytes,2,opt,name=recipient,proto3" json:"recipient,omitempty"`
|
||||
// Percentage is the percentage of funds to be allocated from Community pool.
|
||||
Percentage cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=percentage,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"percentage"`
|
||||
// Optional, if expiry is set, removes the state object when expired.
|
||||
Expiry *time.Time `protobuf:"bytes,8,opt,name=expiry,proto3,stdtime" json:"expiry,omitempty"`
|
||||
Expiry *time.Time `protobuf:"bytes,4,opt,name=expiry,proto3,stdtime" json:"expiry,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgCreateContinuousFund) Reset() { *m = MsgCreateContinuousFund{} }
|
||||
@ -494,20 +485,6 @@ func (m *MsgCreateContinuousFund) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_MsgCreateContinuousFund proto.InternalMessageInfo
|
||||
|
||||
func (m *MsgCreateContinuousFund) GetTitle() string {
|
||||
if m != nil {
|
||||
return m.Title
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MsgCreateContinuousFund) GetDescription() string {
|
||||
if m != nil {
|
||||
return m.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MsgCreateContinuousFund) GetAuthority() string {
|
||||
if m != nil {
|
||||
return m.Authority
|
||||
@ -522,20 +499,6 @@ func (m *MsgCreateContinuousFund) GetRecipient() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MsgCreateContinuousFund) GetMetadata() string {
|
||||
if m != nil {
|
||||
return m.Metadata
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MsgCreateContinuousFund) GetCap() github_com_cosmos_cosmos_sdk_types.Coins {
|
||||
if m != nil {
|
||||
return m.Cap
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *MsgCreateContinuousFund) GetExpiry() *time.Time {
|
||||
if m != nil {
|
||||
return m.Expiry
|
||||
@ -645,6 +608,10 @@ type MsgCancelContinuousFundResponse struct {
|
||||
CanceledHeight uint64 `protobuf:"varint,2,opt,name=canceled_height,json=canceledHeight,proto3" json:"canceled_height,omitempty"`
|
||||
// RecipientAddress is the account address of recipient whose funds are cancelled.
|
||||
RecipientAddress string `protobuf:"bytes,3,opt,name=recipient_address,json=recipientAddress,proto3" json:"recipient_address,omitempty"`
|
||||
// withdrawnAllocatedFund represents the fund allocated to this recipient (if any) that have not been withdrawn yet,
|
||||
// before a cancellation request has been initiated.
|
||||
// It involves first withdrawing the funds and then canceling the request.
|
||||
WithdrawnAllocatedFund types.Coin `protobuf:"bytes,4,opt,name=withdrawn_allocated_fund,json=withdrawnAllocatedFund,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"withdrawn_allocated_fund"`
|
||||
}
|
||||
|
||||
func (m *MsgCancelContinuousFundResponse) Reset() { *m = MsgCancelContinuousFundResponse{} }
|
||||
@ -701,6 +668,104 @@ func (m *MsgCancelContinuousFundResponse) GetRecipientAddress() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MsgCancelContinuousFundResponse) GetWithdrawnAllocatedFund() types.Coin {
|
||||
if m != nil {
|
||||
return m.WithdrawnAllocatedFund
|
||||
}
|
||||
return types.Coin{}
|
||||
}
|
||||
|
||||
// MsgWithdrawContinuousFund defines a message for withdrawing the continuous fund allocated to it.
|
||||
type MsgWithdrawContinuousFund struct {
|
||||
RecipientAddress string `protobuf:"bytes,1,opt,name=recipient_address,json=recipientAddress,proto3" json:"recipient_address,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgWithdrawContinuousFund) Reset() { *m = MsgWithdrawContinuousFund{} }
|
||||
func (m *MsgWithdrawContinuousFund) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgWithdrawContinuousFund) ProtoMessage() {}
|
||||
func (*MsgWithdrawContinuousFund) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_09efe14517e7f6dc, []int{12}
|
||||
}
|
||||
func (m *MsgWithdrawContinuousFund) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgWithdrawContinuousFund) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgWithdrawContinuousFund.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 *MsgWithdrawContinuousFund) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgWithdrawContinuousFund.Merge(m, src)
|
||||
}
|
||||
func (m *MsgWithdrawContinuousFund) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgWithdrawContinuousFund) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgWithdrawContinuousFund.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgWithdrawContinuousFund proto.InternalMessageInfo
|
||||
|
||||
func (m *MsgWithdrawContinuousFund) GetRecipientAddress() string {
|
||||
if m != nil {
|
||||
return m.RecipientAddress
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// MsgWithdrawContinuousFundResponse defines the response to executing a
|
||||
// MsgWithdrawContinuousFund message.
|
||||
type MsgWithdrawContinuousFundResponse struct {
|
||||
Amount types.Coin `protobuf:"bytes,1,opt,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"`
|
||||
}
|
||||
|
||||
func (m *MsgWithdrawContinuousFundResponse) Reset() { *m = MsgWithdrawContinuousFundResponse{} }
|
||||
func (m *MsgWithdrawContinuousFundResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgWithdrawContinuousFundResponse) ProtoMessage() {}
|
||||
func (*MsgWithdrawContinuousFundResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_09efe14517e7f6dc, []int{13}
|
||||
}
|
||||
func (m *MsgWithdrawContinuousFundResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgWithdrawContinuousFundResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgWithdrawContinuousFundResponse.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 *MsgWithdrawContinuousFundResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgWithdrawContinuousFundResponse.Merge(m, src)
|
||||
}
|
||||
func (m *MsgWithdrawContinuousFundResponse) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgWithdrawContinuousFundResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgWithdrawContinuousFundResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgWithdrawContinuousFundResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *MsgWithdrawContinuousFundResponse) GetAmount() types.Coin {
|
||||
if m != nil {
|
||||
return m.Amount
|
||||
}
|
||||
return types.Coin{}
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*MsgFundCommunityPool)(nil), "cosmos.protocolpool.v1.MsgFundCommunityPool")
|
||||
proto.RegisterType((*MsgFundCommunityPoolResponse)(nil), "cosmos.protocolpool.v1.MsgFundCommunityPoolResponse")
|
||||
@ -714,74 +779,77 @@ func init() {
|
||||
proto.RegisterType((*MsgCreateContinuousFundResponse)(nil), "cosmos.protocolpool.v1.MsgCreateContinuousFundResponse")
|
||||
proto.RegisterType((*MsgCancelContinuousFund)(nil), "cosmos.protocolpool.v1.MsgCancelContinuousFund")
|
||||
proto.RegisterType((*MsgCancelContinuousFundResponse)(nil), "cosmos.protocolpool.v1.MsgCancelContinuousFundResponse")
|
||||
proto.RegisterType((*MsgWithdrawContinuousFund)(nil), "cosmos.protocolpool.v1.MsgWithdrawContinuousFund")
|
||||
proto.RegisterType((*MsgWithdrawContinuousFundResponse)(nil), "cosmos.protocolpool.v1.MsgWithdrawContinuousFundResponse")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("cosmos/protocolpool/v1/tx.proto", fileDescriptor_09efe14517e7f6dc) }
|
||||
|
||||
var fileDescriptor_09efe14517e7f6dc = []byte{
|
||||
// 981 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0x41, 0x6f, 0xdc, 0x44,
|
||||
0x14, 0xde, 0xe9, 0x6e, 0x96, 0xec, 0xa4, 0x04, 0x6a, 0x2d, 0xa9, 0x6b, 0x8a, 0xbd, 0xdd, 0x03,
|
||||
0x44, 0x15, 0xb1, 0xd9, 0x02, 0x2d, 0x0a, 0x48, 0x88, 0x4d, 0x40, 0x20, 0x11, 0xa9, 0x38, 0x9c,
|
||||
0x90, 0x50, 0x34, 0x6b, 0x0f, 0xde, 0x51, 0x6d, 0x8f, 0xe5, 0x19, 0x87, 0x2c, 0x12, 0x52, 0xc5,
|
||||
0x89, 0x63, 0x8f, 0x1c, 0x7b, 0x44, 0x9c, 0x7a, 0xe8, 0x8f, 0xa8, 0xc4, 0xa5, 0xea, 0x09, 0x10,
|
||||
0x6a, 0x51, 0x72, 0x28, 0x57, 0xee, 0x1c, 0x90, 0x67, 0x66, 0xbd, 0xbb, 0x59, 0xd7, 0xc9, 0x22,
|
||||
0x22, 0x4e, 0x89, 0xdf, 0xbc, 0xf7, 0xe6, 0xfb, 0xde, 0x7b, 0xdf, 0xb3, 0x17, 0x5a, 0x1e, 0x65,
|
||||
0x11, 0x65, 0x4e, 0x92, 0x52, 0x4e, 0x3d, 0x1a, 0x26, 0x94, 0x86, 0xce, 0x7e, 0xcf, 0xe1, 0x07,
|
||||
0xb6, 0x30, 0x69, 0x6b, 0xd2, 0xc1, 0x9e, 0x76, 0xb0, 0xf7, 0x7b, 0x46, 0x3b, 0xa0, 0x01, 0x15,
|
||||
0x46, 0x27, 0xff, 0x4f, 0x9e, 0x1b, 0xa6, 0x4a, 0x37, 0x40, 0x0c, 0x3b, 0xfb, 0xbd, 0x01, 0xe6,
|
||||
0xa8, 0xe7, 0x78, 0x94, 0xc4, 0xea, 0xfc, 0x92, 0x3c, 0xdf, 0x93, 0x81, 0xd3, 0xa9, 0x8d, 0x8b,
|
||||
0x2a, 0x34, 0x62, 0x41, 0x0e, 0x20, 0x62, 0x81, 0x3a, 0xb0, 0x02, 0x4a, 0x83, 0x10, 0x4b, 0x88,
|
||||
0x83, 0xec, 0x2b, 0x87, 0x93, 0x08, 0x33, 0x8e, 0xa2, 0x64, 0x7c, 0xe9, 0x71, 0x07, 0x3f, 0x4b,
|
||||
0x11, 0x27, 0x54, 0x5d, 0xda, 0xfd, 0x19, 0xc0, 0xf6, 0x0e, 0x0b, 0x3e, 0xca, 0x62, 0x7f, 0x8b,
|
||||
0x46, 0x51, 0x16, 0x13, 0x3e, 0xba, 0x49, 0x69, 0xa8, 0x79, 0xb0, 0x89, 0x22, 0x9a, 0xc5, 0x5c,
|
||||
0x07, 0x9d, 0xfa, 0xfa, 0xca, 0xb5, 0x4b, 0xb6, 0x42, 0x94, 0xc3, 0xb7, 0x15, 0x7c, 0x7b, 0x8b,
|
||||
0x92, 0xb8, 0xff, 0xc6, 0x83, 0xc7, 0x56, 0xed, 0xa7, 0x27, 0xd6, 0x7a, 0x40, 0xf8, 0x30, 0x1b,
|
||||
0xd8, 0x1e, 0x8d, 0x14, 0x7c, 0xf5, 0x67, 0x83, 0xf9, 0xb7, 0x1c, 0x3e, 0x4a, 0x30, 0x13, 0x01,
|
||||
0xcc, 0x55, 0xa9, 0xb5, 0xeb, 0xb0, 0xe5, 0xe3, 0x84, 0x32, 0xc2, 0x69, 0xaa, 0x9f, 0xeb, 0x80,
|
||||
0xf5, 0x56, 0x5f, 0x7f, 0x74, 0x7f, 0xa3, 0xad, 0xae, 0xfa, 0xc0, 0xf7, 0x53, 0xcc, 0xd8, 0x2e,
|
||||
0x4f, 0x49, 0x1c, 0xb8, 0x13, 0xd7, 0xcd, 0xb5, 0xef, 0xef, 0x5a, 0xb5, 0x3f, 0xef, 0x5a, 0xb5,
|
||||
0xef, 0x9e, 0xde, 0xbb, 0x3a, 0xb1, 0x77, 0x4d, 0x78, 0xb9, 0x8c, 0x8c, 0x8b, 0x59, 0x42, 0x63,
|
||||
0x86, 0xbb, 0x87, 0x00, 0xbe, 0xb4, 0xc3, 0x82, 0x99, 0xc3, 0xdd, 0x04, 0xc7, 0x7e, 0x8e, 0x04,
|
||||
0x65, 0x7c, 0x48, 0x53, 0xc2, 0x47, 0x3a, 0x38, 0x09, 0x49, 0xe1, 0xaa, 0x5d, 0x86, 0xad, 0x14,
|
||||
0x7b, 0x24, 0x21, 0x38, 0xe6, 0x92, 0x81, 0x3b, 0x31, 0x4c, 0x15, 0xb1, 0x7e, 0x66, 0x45, 0xdc,
|
||||
0x5c, 0x15, 0x45, 0x28, 0x20, 0x75, 0x2d, 0xf8, 0x4a, 0x29, 0xc7, 0xa2, 0x0a, 0x7f, 0x9f, 0x83,
|
||||
0x17, 0x77, 0x58, 0xb0, 0x9b, 0x0d, 0x22, 0xc2, 0xfb, 0x99, 0x1f, 0x60, 0x7e, 0x33, 0xa5, 0x09,
|
||||
0x65, 0x28, 0xfc, 0xd7, 0x75, 0xf8, 0x10, 0x5e, 0x28, 0x68, 0xef, 0x21, 0xe9, 0x75, 0x62, 0x47,
|
||||
0x5f, 0x2c, 0x42, 0x94, 0x5d, 0x7b, 0x0f, 0x9e, 0xe7, 0x94, 0xa3, 0x70, 0x6f, 0x20, 0x60, 0xe9,
|
||||
0xf5, 0x0e, 0xa8, 0x2c, 0x9b, 0xbb, 0x22, 0xdc, 0x25, 0x09, 0xed, 0x7d, 0x08, 0x19, 0x47, 0x29,
|
||||
0xdf, 0xcb, 0x55, 0xa0, 0x37, 0x44, 0xac, 0x61, 0x4b, 0x05, 0xd8, 0x63, 0x05, 0xd8, 0x9f, 0x8f,
|
||||
0x25, 0xd2, 0x6f, 0xdc, 0x79, 0x62, 0x01, 0xb7, 0x25, 0x62, 0x72, 0xab, 0x66, 0xc0, 0x65, 0x9e,
|
||||
0xa2, 0xd8, 0x1b, 0x62, 0xa6, 0x2f, 0x75, 0xc0, 0x7a, 0xc3, 0x2d, 0x9e, 0xb5, 0x1b, 0xb0, 0x99,
|
||||
0xe0, 0x94, 0x50, 0x5f, 0x6f, 0x2a, 0x50, 0xc7, 0x13, 0x6f, 0x2b, 0x69, 0xf5, 0x1b, 0x3f, 0xe4,
|
||||
0x79, 0x95, 0xfb, 0x5c, 0x7f, 0xae, 0x40, 0xeb, 0x19, 0xd5, 0x2f, 0x3a, 0x44, 0xe1, 0x6a, 0xde,
|
||||
0xc2, 0x10, 0x91, 0x48, 0x51, 0x2b, 0xad, 0x2f, 0x58, 0xb4, 0xbe, 0x9b, 0x6b, 0x39, 0x96, 0xf9,
|
||||
0x4c, 0xdd, 0x6f, 0xe1, 0xda, 0xec, 0x85, 0x63, 0x28, 0x33, 0x7b, 0x00, 0x9c, 0xd1, 0x08, 0x77,
|
||||
0x7f, 0xad, 0x8b, 0x89, 0xdc, 0x4a, 0x31, 0xe2, 0x78, 0x8b, 0xc6, 0x9c, 0xc4, 0x19, 0xcd, 0x58,
|
||||
0x2e, 0x64, 0xad, 0x0d, 0x97, 0x38, 0xe1, 0x21, 0x96, 0x6c, 0x5d, 0xf9, 0xa0, 0x75, 0xe0, 0x8a,
|
||||
0x8f, 0x99, 0x97, 0x92, 0x24, 0xaf, 0xb8, 0x52, 0xde, 0xb4, 0x69, 0x76, 0x92, 0xeb, 0xa7, 0x9f,
|
||||
0xe4, 0xeb, 0xd3, 0x8a, 0x6e, 0x9c, 0x14, 0x37, 0xd1, 0xba, 0x01, 0x97, 0x23, 0xcc, 0x91, 0x8f,
|
||||
0x38, 0x12, 0xb3, 0xd3, 0x72, 0x8b, 0x67, 0xed, 0x33, 0x08, 0x13, 0x9c, 0x7a, 0x38, 0xe6, 0x28,
|
||||
0xc0, 0x62, 0x7e, 0x5a, 0xfd, 0x5e, 0x5e, 0xad, 0xdf, 0x1e, 0x5b, 0x2f, 0xcb, 0xc4, 0xcc, 0xbf,
|
||||
0x65, 0x13, 0xea, 0x44, 0x88, 0x0f, 0xed, 0x4f, 0x71, 0x80, 0xbc, 0xd1, 0x36, 0xf6, 0x1e, 0xdd,
|
||||
0xdf, 0x80, 0xea, 0xde, 0x6d, 0xec, 0xb9, 0x53, 0x49, 0xb4, 0x2f, 0x61, 0xdd, 0x43, 0x89, 0xfe,
|
||||
0xdc, 0x7f, 0xbf, 0x57, 0xf2, 0xbc, 0xda, 0x3b, 0xb0, 0x89, 0x0f, 0x12, 0x92, 0x8e, 0xf4, 0xe5,
|
||||
0x53, 0xca, 0x48, 0xf9, 0x3f, 0x63, 0xdc, 0xcb, 0x5a, 0x5b, 0x8c, 0xfb, 0x8f, 0x40, 0xb6, 0x1f,
|
||||
0xc5, 0x1e, 0x0e, 0x8f, 0xb5, 0xff, 0xff, 0x5d, 0x48, 0x73, 0x6c, 0x7e, 0x07, 0x92, 0x4e, 0x09,
|
||||
0xd4, 0x42, 0x32, 0x9f, 0xc0, 0xe7, 0x3d, 0x71, 0x8e, 0x7d, 0xb9, 0x89, 0xc0, 0x89, 0x25, 0x5c,
|
||||
0xce, 0xbb, 0x24, 0xca, 0x78, 0x7e, 0x1c, 0x2a, 0x16, 0xd2, 0x6b, 0xf0, 0x85, 0x22, 0xd5, 0x10,
|
||||
0x93, 0x60, 0x28, 0x5f, 0x32, 0x0d, 0x77, 0x75, 0x6c, 0xfe, 0x58, 0x58, 0xcb, 0xe9, 0xd6, 0x17,
|
||||
0xa5, 0x7b, 0xed, 0xaf, 0x25, 0x58, 0xdf, 0x61, 0x81, 0xf6, 0x35, 0xbc, 0x30, 0xff, 0x49, 0xf0,
|
||||
0xba, 0x5d, 0xfe, 0xbd, 0x63, 0x97, 0xbd, 0x73, 0x8d, 0xb7, 0x16, 0xf1, 0x2e, 0x6a, 0xf7, 0x0d,
|
||||
0xd4, 0x4a, 0xde, 0xce, 0x1b, 0x15, 0xb9, 0xe6, 0xdd, 0x8d, 0xb7, 0x17, 0x72, 0x2f, 0xee, 0xbe,
|
||||
0x0d, 0x60, 0xbb, 0xf4, 0xa5, 0xe8, 0x54, 0xe4, 0x2b, 0x0b, 0x30, 0x6e, 0x2c, 0x18, 0x50, 0x40,
|
||||
0xc0, 0x70, 0x65, 0x7a, 0xeb, 0xbf, 0x5a, 0x45, 0x64, 0xe2, 0x67, 0xd8, 0xa7, 0xf3, 0x9b, 0x61,
|
||||
0x5a, 0xba, 0x6c, 0xab, 0x98, 0x96, 0x05, 0x54, 0x32, 0xad, 0xd2, 0xbc, 0x84, 0x50, 0x26, 0xf8,
|
||||
0x4a, 0x08, 0x25, 0x01, 0xd5, 0x10, 0x2a, 0x74, 0x6a, 0x2c, 0xdd, 0x7e, 0x7a, 0xef, 0x2a, 0xe8,
|
||||
0xbf, 0xfb, 0xe0, 0xd0, 0x04, 0x0f, 0x0f, 0x4d, 0xf0, 0xc7, 0xa1, 0x09, 0xee, 0x1c, 0x99, 0xb5,
|
||||
0x87, 0x47, 0x66, 0xed, 0x97, 0x23, 0xb3, 0xf6, 0xc5, 0x95, 0x99, 0xd5, 0x7c, 0x30, 0xfb, 0x43,
|
||||
0x40, 0xac, 0xcc, 0x41, 0x53, 0xd8, 0xde, 0xfc, 0x27, 0x00, 0x00, 0xff, 0xff, 0x7a, 0x79, 0x89,
|
||||
0xac, 0x2c, 0x0c, 0x00, 0x00,
|
||||
// 1001 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xcf, 0x6f, 0x1b, 0x45,
|
||||
0x14, 0xf6, 0xc4, 0xae, 0x55, 0x4f, 0x4a, 0xa0, 0xab, 0xe0, 0x6e, 0x96, 0xe2, 0x4d, 0x7c, 0x80,
|
||||
0xa8, 0x22, 0xbb, 0xb8, 0x40, 0x0b, 0x01, 0x09, 0xd5, 0x09, 0x08, 0x24, 0x2c, 0x95, 0x0d, 0x12,
|
||||
0x12, 0x17, 0x6b, 0xbc, 0x3b, 0x1d, 0x8f, 0xba, 0xbb, 0xb3, 0xda, 0x99, 0x4d, 0xe2, 0x4a, 0x48,
|
||||
0x15, 0x12, 0xa8, 0xc7, 0x1e, 0x39, 0xf6, 0x84, 0x10, 0xa7, 0x1e, 0xfa, 0x47, 0x54, 0xe2, 0x52,
|
||||
0xf5, 0x84, 0x38, 0xb4, 0x28, 0x41, 0x2a, 0x7f, 0x03, 0xe2, 0x80, 0x76, 0x77, 0xbc, 0xb6, 0xe3,
|
||||
0xf5, 0xa6, 0xae, 0x92, 0x9e, 0x6c, 0xbf, 0x79, 0x3f, 0xbe, 0xef, 0x9b, 0xf7, 0x66, 0xc6, 0x50,
|
||||
0xb7, 0x19, 0xf7, 0x18, 0x37, 0x83, 0x90, 0x09, 0x66, 0x33, 0x37, 0x60, 0xcc, 0x35, 0x77, 0x5b,
|
||||
0xa6, 0xd8, 0x37, 0x12, 0x93, 0x52, 0x4f, 0x1d, 0x8c, 0x71, 0x07, 0x63, 0xb7, 0xa5, 0x2d, 0x13,
|
||||
0x46, 0x58, 0x62, 0x34, 0xe3, 0x6f, 0xe9, 0xba, 0xd6, 0x90, 0xe9, 0x7a, 0x88, 0x63, 0x73, 0xb7,
|
||||
0xd5, 0xc3, 0x02, 0xb5, 0x4c, 0x9b, 0x51, 0x5f, 0xae, 0xaf, 0xa4, 0xeb, 0xdd, 0x34, 0x70, 0x3c,
|
||||
0xb5, 0x76, 0x41, 0x86, 0x7a, 0x9c, 0xc4, 0x00, 0x3c, 0x4e, 0xe4, 0x82, 0x4e, 0x18, 0x23, 0x2e,
|
||||
0x4e, 0x21, 0xf6, 0xa2, 0x1b, 0xa6, 0xa0, 0x1e, 0xe6, 0x02, 0x79, 0xc1, 0xb0, 0xe8, 0x51, 0x07,
|
||||
0x27, 0x0a, 0x91, 0xa0, 0x4c, 0x16, 0x6d, 0xfe, 0x0e, 0xe0, 0x72, 0x87, 0x93, 0xcf, 0x23, 0xdf,
|
||||
0xd9, 0x62, 0x9e, 0x17, 0xf9, 0x54, 0x0c, 0xae, 0x33, 0xe6, 0x2a, 0x36, 0xac, 0x22, 0x8f, 0x45,
|
||||
0xbe, 0x50, 0xc1, 0x6a, 0x79, 0x7d, 0xf1, 0xf2, 0x8a, 0x21, 0x11, 0xc5, 0xf0, 0x0d, 0x09, 0xdf,
|
||||
0xd8, 0x62, 0xd4, 0x6f, 0xbf, 0xfb, 0xf0, 0x89, 0x5e, 0xfa, 0xed, 0xa9, 0xbe, 0x4e, 0xa8, 0xe8,
|
||||
0x47, 0x3d, 0xc3, 0x66, 0x9e, 0x84, 0x2f, 0x3f, 0x36, 0xb8, 0x73, 0xd3, 0x14, 0x83, 0x00, 0xf3,
|
||||
0x24, 0x80, 0x5b, 0x32, 0xb5, 0x72, 0x05, 0xd6, 0x1c, 0x1c, 0x30, 0x4e, 0x05, 0x0b, 0xd5, 0x85,
|
||||
0x55, 0xb0, 0x5e, 0x6b, 0xab, 0x8f, 0x1f, 0x6c, 0x2c, 0xcb, 0x52, 0xd7, 0x1c, 0x27, 0xc4, 0x9c,
|
||||
0xef, 0x88, 0x90, 0xfa, 0xc4, 0x1a, 0xb9, 0x6e, 0xd6, 0xef, 0xdc, 0xd3, 0x4b, 0xff, 0xdc, 0xd3,
|
||||
0x4b, 0x3f, 0x3c, 0xbb, 0x7f, 0x69, 0x64, 0x6f, 0x36, 0xe0, 0xc5, 0x3c, 0x32, 0x16, 0xe6, 0x01,
|
||||
0xf3, 0x39, 0x6e, 0x1e, 0x00, 0xf8, 0x7a, 0x87, 0x93, 0x89, 0xc5, 0x9d, 0x00, 0xfb, 0x4e, 0x8c,
|
||||
0x04, 0x45, 0xa2, 0xcf, 0x42, 0x2a, 0x06, 0x2a, 0x38, 0x0e, 0x49, 0xe6, 0xaa, 0x5c, 0x84, 0xb5,
|
||||
0x10, 0xdb, 0x34, 0xa0, 0xd8, 0x17, 0x29, 0x03, 0x6b, 0x64, 0x18, 0x13, 0xb1, 0x7c, 0x6a, 0x22,
|
||||
0x6e, 0x2e, 0x25, 0x22, 0x64, 0x90, 0x9a, 0x3a, 0x7c, 0x33, 0x97, 0x63, 0xa6, 0xc2, 0x7f, 0x0b,
|
||||
0xf0, 0x42, 0x87, 0x93, 0x9d, 0xa8, 0xe7, 0x51, 0xd1, 0x8e, 0x1c, 0x82, 0xc5, 0xf5, 0x90, 0x05,
|
||||
0x8c, 0x23, 0xf7, 0x85, 0x75, 0xf8, 0x0c, 0x9e, 0xcf, 0x68, 0x77, 0x51, 0xea, 0x75, 0xec, 0x8e,
|
||||
0xbe, 0x96, 0x85, 0x48, 0xbb, 0xf2, 0x09, 0x3c, 0x27, 0x98, 0x40, 0x6e, 0xb7, 0x97, 0xc0, 0x52,
|
||||
0xcb, 0xab, 0xa0, 0x50, 0x36, 0x6b, 0x31, 0x71, 0x4f, 0x49, 0x28, 0x9f, 0x42, 0xc8, 0x05, 0x0a,
|
||||
0x45, 0x37, 0x9e, 0x02, 0xb5, 0x92, 0xc4, 0x6a, 0x46, 0x3a, 0x01, 0xc6, 0x70, 0x02, 0x8c, 0x6f,
|
||||
0x86, 0x23, 0xd2, 0xae, 0xdc, 0x7d, 0xaa, 0x03, 0xab, 0x96, 0xc4, 0xc4, 0x56, 0x45, 0x83, 0x67,
|
||||
0x45, 0x88, 0x7c, 0xbb, 0x8f, 0xb9, 0x7a, 0x66, 0x15, 0xac, 0x57, 0xac, 0xec, 0xb7, 0x72, 0x15,
|
||||
0x56, 0x03, 0x1c, 0x52, 0xe6, 0xa8, 0x55, 0x09, 0xea, 0x68, 0xe2, 0x6d, 0x39, 0x5a, 0xed, 0xca,
|
||||
0xcf, 0x71, 0x5e, 0xe9, 0x3e, 0xb5, 0x3f, 0x6b, 0x50, 0x9f, 0xa1, 0x7e, 0xb6, 0x43, 0x0c, 0x2e,
|
||||
0xc5, 0x5b, 0xe8, 0x22, 0xea, 0x49, 0x6a, 0xb9, 0xfa, 0x82, 0x79, 0xf5, 0xdd, 0xac, 0xc7, 0x58,
|
||||
0xa6, 0x33, 0x35, 0xbf, 0x87, 0xf5, 0xc9, 0x82, 0x43, 0x28, 0x13, 0xe7, 0x00, 0x38, 0xa5, 0x16,
|
||||
0x6e, 0xfe, 0x92, 0x76, 0xe4, 0x56, 0x88, 0x91, 0xc0, 0x5b, 0xcc, 0x17, 0xd4, 0x8f, 0x58, 0xc4,
|
||||
0xe3, 0x41, 0x7e, 0xe1, 0x8e, 0xbc, 0x32, 0x35, 0x99, 0x45, 0x71, 0xa3, 0x99, 0xfd, 0x1a, 0xc2,
|
||||
0x00, 0x87, 0x36, 0xf6, 0x05, 0x22, 0x38, 0x69, 0xc0, 0x5a, 0xbb, 0x15, 0x33, 0xfb, 0xf3, 0x89,
|
||||
0xfe, 0x46, 0x1a, 0xcc, 0x9d, 0x9b, 0x06, 0x65, 0xa6, 0x87, 0x44, 0xdf, 0xf8, 0x0a, 0x13, 0x64,
|
||||
0x0f, 0xb6, 0xb1, 0xfd, 0xf8, 0xc1, 0x06, 0x94, 0xb9, 0xb7, 0xb1, 0x6d, 0x8d, 0x25, 0x51, 0x3e,
|
||||
0x84, 0x55, 0xbc, 0x1f, 0xd0, 0x70, 0xf0, 0xdc, 0x3d, 0x29, 0xfd, 0x67, 0xf4, 0x4e, 0x9e, 0x4e,
|
||||
0x59, 0xef, 0xfc, 0x0a, 0x52, 0x2d, 0x91, 0x6f, 0x63, 0xf7, 0x84, 0xb4, 0x3c, 0x99, 0xe9, 0x9e,
|
||||
0x62, 0xf3, 0xf7, 0x42, 0x4a, 0x27, 0x07, 0x6a, 0xd6, 0x7f, 0x5f, 0xc2, 0x57, 0xec, 0x64, 0x1d,
|
||||
0x3b, 0xe9, 0x58, 0x83, 0x63, 0x25, 0x3c, 0x1b, 0xef, 0x56, 0x22, 0xe3, 0xb9, 0x61, 0x68, 0x32,
|
||||
0xdd, 0x6f, 0xc3, 0x57, 0xb3, 0x54, 0x7d, 0x4c, 0x49, 0x3f, 0xed, 0x8b, 0x8a, 0xb5, 0x34, 0x34,
|
||||
0x7f, 0x91, 0x58, 0xf3, 0xe9, 0x96, 0xe7, 0x3e, 0xcc, 0x7e, 0x04, 0x50, 0xdd, 0xa3, 0xa2, 0xef,
|
||||
0x84, 0x68, 0xcf, 0xef, 0x22, 0xd7, 0x65, 0x36, 0x12, 0xd8, 0xe9, 0xde, 0x88, 0x7c, 0x47, 0x76,
|
||||
0xc2, 0x89, 0x4e, 0x53, 0x3d, 0x2b, 0x76, 0x6d, 0x58, 0x2b, 0x96, 0xb2, 0x79, 0x0b, 0xae, 0x74,
|
||||
0x38, 0xf9, 0x56, 0x2e, 0x1e, 0x69, 0x89, 0x53, 0x3e, 0x58, 0xee, 0x00, 0xb8, 0x36, 0xb3, 0xf8,
|
||||
0x4b, 0x3d, 0x64, 0x2e, 0xff, 0x5b, 0x85, 0xe5, 0x0e, 0x27, 0xca, 0x1e, 0x3c, 0x3f, 0xfd, 0xdc,
|
||||
0x79, 0xc7, 0xc8, 0x7f, 0xcb, 0x19, 0x79, 0xef, 0x09, 0xed, 0xfd, 0x79, 0xbc, 0x33, 0x96, 0xb7,
|
||||
0xa0, 0x92, 0xf3, 0xf2, 0xd8, 0x28, 0xc8, 0x35, 0xed, 0xae, 0x7d, 0x30, 0x97, 0x7b, 0x56, 0xfb,
|
||||
0x36, 0x80, 0xcb, 0xb9, 0x17, 0xbe, 0x59, 0x90, 0x2f, 0x2f, 0x40, 0xbb, 0x3a, 0x67, 0x40, 0x06,
|
||||
0x01, 0xc3, 0xc5, 0xf1, 0x1b, 0xed, 0xad, 0x22, 0x22, 0x23, 0x3f, 0xcd, 0x78, 0x3e, 0xbf, 0x09,
|
||||
0xa6, 0xb9, 0x17, 0x49, 0x11, 0xd3, 0xbc, 0x80, 0x42, 0xa6, 0x45, 0x47, 0xb0, 0xf2, 0x13, 0x80,
|
||||
0xf5, 0x19, 0xe3, 0xd6, 0x2a, 0xc8, 0x99, 0x1f, 0xa2, 0x7d, 0x34, 0x77, 0xc8, 0xa4, 0x16, 0x79,
|
||||
0x17, 0x41, 0xa1, 0x16, 0x39, 0x01, 0xc5, 0x5a, 0x14, 0x9c, 0xdf, 0xda, 0x99, 0xdb, 0xcf, 0xee,
|
||||
0x5f, 0x02, 0xed, 0x8f, 0x1f, 0x1e, 0x34, 0xc0, 0xa3, 0x83, 0x06, 0xf8, 0xeb, 0xa0, 0x01, 0xee,
|
||||
0x1e, 0x36, 0x4a, 0x8f, 0x0e, 0x1b, 0xa5, 0x3f, 0x0e, 0x1b, 0xa5, 0xef, 0xd6, 0x26, 0xee, 0xd4,
|
||||
0xfd, 0xc9, 0x7f, 0x5b, 0xc9, 0x1c, 0xf7, 0xaa, 0x89, 0xed, 0xbd, 0xff, 0x03, 0x00, 0x00, 0xff,
|
||||
0xff, 0xbe, 0xf0, 0xd2, 0xdd, 0x91, 0x0d, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -810,6 +878,8 @@ type MsgClient interface {
|
||||
ClaimBudget(ctx context.Context, in *MsgClaimBudget, opts ...grpc.CallOption) (*MsgClaimBudgetResponse, error)
|
||||
// CreateContinuousFund defines a method to add funds continuously.
|
||||
CreateContinuousFund(ctx context.Context, in *MsgCreateContinuousFund, opts ...grpc.CallOption) (*MsgCreateContinuousFundResponse, error)
|
||||
// WithdrawContinuousFund defines a method to withdraw continuous fund allocated.
|
||||
WithdrawContinuousFund(ctx context.Context, in *MsgWithdrawContinuousFund, opts ...grpc.CallOption) (*MsgWithdrawContinuousFundResponse, error)
|
||||
// CancelContinuousFund defines a method for cancelling continuous fund.
|
||||
CancelContinuousFund(ctx context.Context, in *MsgCancelContinuousFund, opts ...grpc.CallOption) (*MsgCancelContinuousFundResponse, error)
|
||||
}
|
||||
@ -867,6 +937,15 @@ func (c *msgClient) CreateContinuousFund(ctx context.Context, in *MsgCreateConti
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) WithdrawContinuousFund(ctx context.Context, in *MsgWithdrawContinuousFund, opts ...grpc.CallOption) (*MsgWithdrawContinuousFundResponse, error) {
|
||||
out := new(MsgWithdrawContinuousFundResponse)
|
||||
err := c.cc.Invoke(ctx, "/cosmos.protocolpool.v1.Msg/WithdrawContinuousFund", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) CancelContinuousFund(ctx context.Context, in *MsgCancelContinuousFund, opts ...grpc.CallOption) (*MsgCancelContinuousFundResponse, error) {
|
||||
out := new(MsgCancelContinuousFundResponse)
|
||||
err := c.cc.Invoke(ctx, "/cosmos.protocolpool.v1.Msg/CancelContinuousFund", in, out, opts...)
|
||||
@ -892,6 +971,8 @@ type MsgServer interface {
|
||||
ClaimBudget(context.Context, *MsgClaimBudget) (*MsgClaimBudgetResponse, error)
|
||||
// CreateContinuousFund defines a method to add funds continuously.
|
||||
CreateContinuousFund(context.Context, *MsgCreateContinuousFund) (*MsgCreateContinuousFundResponse, error)
|
||||
// WithdrawContinuousFund defines a method to withdraw continuous fund allocated.
|
||||
WithdrawContinuousFund(context.Context, *MsgWithdrawContinuousFund) (*MsgWithdrawContinuousFundResponse, error)
|
||||
// CancelContinuousFund defines a method for cancelling continuous fund.
|
||||
CancelContinuousFund(context.Context, *MsgCancelContinuousFund) (*MsgCancelContinuousFundResponse, error)
|
||||
}
|
||||
@ -915,6 +996,9 @@ func (*UnimplementedMsgServer) ClaimBudget(ctx context.Context, req *MsgClaimBud
|
||||
func (*UnimplementedMsgServer) CreateContinuousFund(ctx context.Context, req *MsgCreateContinuousFund) (*MsgCreateContinuousFundResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateContinuousFund not implemented")
|
||||
}
|
||||
func (*UnimplementedMsgServer) WithdrawContinuousFund(ctx context.Context, req *MsgWithdrawContinuousFund) (*MsgWithdrawContinuousFundResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method WithdrawContinuousFund not implemented")
|
||||
}
|
||||
func (*UnimplementedMsgServer) CancelContinuousFund(ctx context.Context, req *MsgCancelContinuousFund) (*MsgCancelContinuousFundResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CancelContinuousFund not implemented")
|
||||
}
|
||||
@ -1013,6 +1097,24 @@ func _Msg_CreateContinuousFund_Handler(srv interface{}, ctx context.Context, dec
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_WithdrawContinuousFund_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgWithdrawContinuousFund)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).WithdrawContinuousFund(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/cosmos.protocolpool.v1.Msg/WithdrawContinuousFund",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).WithdrawContinuousFund(ctx, req.(*MsgWithdrawContinuousFund))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_CancelContinuousFund_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgCancelContinuousFund)
|
||||
if err := dec(in); err != nil {
|
||||
@ -1055,6 +1157,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "CreateContinuousFund",
|
||||
Handler: _Msg_CreateContinuousFund_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "WithdrawContinuousFund",
|
||||
Handler: _Msg_WithdrawContinuousFund_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CancelContinuousFund",
|
||||
Handler: _Msg_CancelContinuousFund_Handler,
|
||||
@ -1393,21 +1499,7 @@ func (m *MsgCreateContinuousFund) MarshalToSizedBuffer(dAtA []byte) (int, error)
|
||||
i -= n5
|
||||
i = encodeVarintTx(dAtA, i, uint64(n5))
|
||||
i--
|
||||
dAtA[i] = 0x42
|
||||
}
|
||||
if len(m.Cap) > 0 {
|
||||
for iNdEx := len(m.Cap) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
size, err := m.Cap[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintTx(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x3a
|
||||
}
|
||||
dAtA[i] = 0x22
|
||||
}
|
||||
{
|
||||
size := m.Percentage.Size()
|
||||
@ -1418,40 +1510,19 @@ func (m *MsgCreateContinuousFund) MarshalToSizedBuffer(dAtA []byte) (int, error)
|
||||
i = encodeVarintTx(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x32
|
||||
if len(m.Metadata) > 0 {
|
||||
i -= len(m.Metadata)
|
||||
copy(dAtA[i:], m.Metadata)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Metadata)))
|
||||
i--
|
||||
dAtA[i] = 0x2a
|
||||
}
|
||||
dAtA[i] = 0x1a
|
||||
if len(m.Recipient) > 0 {
|
||||
i -= len(m.Recipient)
|
||||
copy(dAtA[i:], m.Recipient)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Recipient)))
|
||||
i--
|
||||
dAtA[i] = 0x22
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if len(m.Authority) > 0 {
|
||||
i -= len(m.Authority)
|
||||
copy(dAtA[i:], m.Authority)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Authority)))
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
if len(m.Description) > 0 {
|
||||
i -= len(m.Description)
|
||||
copy(dAtA[i:], m.Description)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Description)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if len(m.Title) > 0 {
|
||||
i -= len(m.Title)
|
||||
copy(dAtA[i:], m.Title)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Title)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
@ -1537,6 +1608,16 @@ func (m *MsgCancelContinuousFundResponse) MarshalToSizedBuffer(dAtA []byte) (int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
{
|
||||
size, err := m.WithdrawnAllocatedFund.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintTx(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x22
|
||||
if len(m.RecipientAddress) > 0 {
|
||||
i -= len(m.RecipientAddress)
|
||||
copy(dAtA[i:], m.RecipientAddress)
|
||||
@ -1549,12 +1630,75 @@ func (m *MsgCancelContinuousFundResponse) MarshalToSizedBuffer(dAtA []byte) (int
|
||||
i--
|
||||
dAtA[i] = 0x10
|
||||
}
|
||||
n6, err6 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.CanceledTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CanceledTime):])
|
||||
if err6 != nil {
|
||||
return 0, err6
|
||||
n7, err7 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.CanceledTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CanceledTime):])
|
||||
if err7 != nil {
|
||||
return 0, err7
|
||||
}
|
||||
i -= n7
|
||||
i = encodeVarintTx(dAtA, i, uint64(n7))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *MsgWithdrawContinuousFund) 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 *MsgWithdrawContinuousFund) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgWithdrawContinuousFund) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.RecipientAddress) > 0 {
|
||||
i -= len(m.RecipientAddress)
|
||||
copy(dAtA[i:], m.RecipientAddress)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.RecipientAddress)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *MsgWithdrawContinuousFundResponse) 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 *MsgWithdrawContinuousFundResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgWithdrawContinuousFundResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
{
|
||||
size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintTx(dAtA, i, uint64(size))
|
||||
}
|
||||
i -= n6
|
||||
i = encodeVarintTx(dAtA, i, uint64(n6))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
return len(dAtA) - i, nil
|
||||
@ -1702,14 +1846,6 @@ func (m *MsgCreateContinuousFund) Size() (n int) {
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Title)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
l = len(m.Description)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
l = len(m.Authority)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
@ -1718,18 +1854,8 @@ func (m *MsgCreateContinuousFund) Size() (n int) {
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
l = len(m.Metadata)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
l = m.Percentage.Size()
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
if len(m.Cap) > 0 {
|
||||
for _, e := range m.Cap {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
}
|
||||
if m.Expiry != nil {
|
||||
l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.Expiry)
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
@ -1778,6 +1904,32 @@ func (m *MsgCancelContinuousFundResponse) Size() (n int) {
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
l = m.WithdrawnAllocatedFund.Size()
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MsgWithdrawContinuousFund) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.RecipientAddress)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MsgWithdrawContinuousFundResponse) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = m.Amount.Size()
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
return n
|
||||
}
|
||||
|
||||
@ -2637,70 +2789,6 @@ func (m *MsgCreateContinuousFund) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Title = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Description = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType)
|
||||
}
|
||||
@ -2732,7 +2820,7 @@ func (m *MsgCreateContinuousFund) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
m.Authority = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 4:
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType)
|
||||
}
|
||||
@ -2764,39 +2852,7 @@ func (m *MsgCreateContinuousFund) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
m.Recipient = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 5:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Metadata = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 6:
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Percentage", wireType)
|
||||
}
|
||||
@ -2830,41 +2886,7 @@ func (m *MsgCreateContinuousFund) Unmarshal(dAtA []byte) error {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 7:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Cap", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Cap = append(m.Cap, types.Coin{})
|
||||
if err := m.Cap[len(m.Cap)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 8:
|
||||
case 4:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Expiry", wireType)
|
||||
}
|
||||
@ -3198,6 +3220,204 @@ func (m *MsgCancelContinuousFundResponse) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
m.RecipientAddress = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 4:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field WithdrawnAllocatedFund", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if err := m.WithdrawnAllocatedFund.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipTx(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *MsgWithdrawContinuousFund) 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 ErrIntOverflowTx
|
||||
}
|
||||
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: MsgWithdrawContinuousFund: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgWithdrawContinuousFund: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field RecipientAddress", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.RecipientAddress = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipTx(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *MsgWithdrawContinuousFundResponse) 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 ErrIntOverflowTx
|
||||
}
|
||||
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: MsgWithdrawContinuousFundResponse: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgWithdrawContinuousFundResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipTx(dAtA[iNdEx:])
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
cosmossdk_io_math "cosmossdk.io/math"
|
||||
fmt "fmt"
|
||||
_ "github.com/cosmos/cosmos-proto"
|
||||
types "github.com/cosmos/cosmos-sdk/types"
|
||||
@ -142,8 +143,66 @@ func (m *Budget) GetPeriod() *time.Duration {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContinuousFund defines the fields of continuous fund proposal.
|
||||
type ContinuousFund struct {
|
||||
// Recipient address of the account receiving funds.
|
||||
Recipient string `protobuf:"bytes,1,opt,name=recipient,proto3" json:"recipient,omitempty"`
|
||||
// Percentage is the percentage of funds to be allocated from Community pool.
|
||||
Percentage cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=percentage,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"percentage"`
|
||||
// Optional, if expiry is set, removes the state object when expired.
|
||||
Expiry *time.Time `protobuf:"bytes,3,opt,name=expiry,proto3,stdtime" json:"expiry,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ContinuousFund) Reset() { *m = ContinuousFund{} }
|
||||
func (m *ContinuousFund) String() string { return proto.CompactTextString(m) }
|
||||
func (*ContinuousFund) ProtoMessage() {}
|
||||
func (*ContinuousFund) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_c1b7d0ea246d7f44, []int{1}
|
||||
}
|
||||
func (m *ContinuousFund) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *ContinuousFund) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_ContinuousFund.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 *ContinuousFund) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ContinuousFund.Merge(m, src)
|
||||
}
|
||||
func (m *ContinuousFund) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *ContinuousFund) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ContinuousFund.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ContinuousFund proto.InternalMessageInfo
|
||||
|
||||
func (m *ContinuousFund) GetRecipient() string {
|
||||
if m != nil {
|
||||
return m.Recipient
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ContinuousFund) GetExpiry() *time.Time {
|
||||
if m != nil {
|
||||
return m.Expiry
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Budget)(nil), "cosmos.protocolpool.v1.Budget")
|
||||
proto.RegisterType((*ContinuousFund)(nil), "cosmos.protocolpool.v1.ContinuousFund")
|
||||
}
|
||||
|
||||
func init() {
|
||||
@ -151,35 +210,41 @@ func init() {
|
||||
}
|
||||
|
||||
var fileDescriptor_c1b7d0ea246d7f44 = []byte{
|
||||
// 444 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x3f, 0x6f, 0xd4, 0x30,
|
||||
0x1c, 0xbd, 0xd0, 0xe3, 0x68, 0xdd, 0x1e, 0x7f, 0xa2, 0x0a, 0xb9, 0x19, 0xd2, 0xa3, 0x2c, 0xb7,
|
||||
0xe0, 0xe8, 0x60, 0x60, 0x00, 0x09, 0x9a, 0x02, 0x62, 0x60, 0x3a, 0x98, 0x58, 0x2c, 0x27, 0xf1,
|
||||
0x05, 0x8b, 0x24, 0xbf, 0xc8, 0xfe, 0xdd, 0xa9, 0x7c, 0x8b, 0x8e, 0x7c, 0x10, 0x3e, 0x04, 0x63,
|
||||
0x85, 0x18, 0xd8, 0x40, 0x77, 0x5f, 0x04, 0xc5, 0x76, 0xaa, 0xd2, 0x85, 0x6e, 0xce, 0xfb, 0xbd,
|
||||
0xf7, 0xf2, 0xfc, 0xfc, 0x23, 0x47, 0x39, 0x98, 0x1a, 0x4c, 0xd2, 0x6a, 0x40, 0xc8, 0xa1, 0x6a,
|
||||
0x01, 0xaa, 0x64, 0x35, 0x4b, 0xf0, 0x4b, 0x2b, 0x0d, 0xb3, 0x68, 0x78, 0xdf, 0x71, 0xd8, 0x65,
|
||||
0x0e, 0x5b, 0xcd, 0xa2, 0xfd, 0x12, 0x4a, 0xb0, 0x60, 0xd2, 0x9d, 0xdc, 0x3c, 0x3a, 0x70, 0x6c,
|
||||
0xee, 0x06, 0x97, 0xa5, 0x51, 0xec, 0x7f, 0x96, 0x09, 0x23, 0x93, 0xd5, 0x2c, 0x93, 0x28, 0x66,
|
||||
0x49, 0x0e, 0xaa, 0xf1, 0xf3, 0xc3, 0x12, 0xa0, 0xac, 0xa4, 0x0b, 0x93, 0x2d, 0x17, 0x09, 0xaa,
|
||||
0x5a, 0x1a, 0x14, 0x75, 0xdb, 0x1b, 0x5c, 0x25, 0x14, 0x4b, 0x2d, 0x50, 0x81, 0x37, 0x38, 0xfa,
|
||||
0xb9, 0x45, 0x46, 0xe9, 0xb2, 0x28, 0x25, 0x86, 0xaf, 0xc9, 0x3d, 0x2d, 0x73, 0xd5, 0x2a, 0xd9,
|
||||
0x20, 0x17, 0x45, 0xa1, 0xa5, 0x31, 0x34, 0x98, 0x04, 0xd3, 0x9d, 0x94, 0xfe, 0xf8, 0xf6, 0x68,
|
||||
0xdf, 0x07, 0x3b, 0x76, 0x93, 0xf7, 0xa8, 0x55, 0x53, 0xce, 0xef, 0x5e, 0x48, 0x3c, 0x1e, 0x3e,
|
||||
0x27, 0x7b, 0x08, 0x28, 0x2a, 0x9e, 0x59, 0x5b, 0x7a, 0x63, 0x12, 0x4c, 0x77, 0x1f, 0x1f, 0x30,
|
||||
0x2f, 0xef, 0x6e, 0xc2, 0xfc, 0x4d, 0xd8, 0x09, 0xa8, 0x66, 0xbe, 0x6b, 0xe9, 0x3e, 0xc4, 0x4b,
|
||||
0x72, 0x3b, 0xaf, 0x84, 0xaa, 0x65, 0xc1, 0x45, 0x0d, 0xcb, 0x06, 0xe9, 0xd6, 0xff, 0xf4, 0x63,
|
||||
0x2f, 0x38, 0xb6, 0xfc, 0xf0, 0x05, 0x21, 0x06, 0x85, 0x46, 0xde, 0x55, 0x41, 0x87, 0x56, 0x1d,
|
||||
0x31, 0x57, 0x03, 0xeb, 0x6b, 0x60, 0x1f, 0xfa, 0x9e, 0xd2, 0xe1, 0xd9, 0xef, 0xc3, 0x60, 0xbe,
|
||||
0x63, 0x35, 0x1d, 0x1a, 0xbe, 0x25, 0x77, 0x1a, 0x79, 0x8a, 0xdc, 0xda, 0xf2, 0x85, 0x86, 0x9a,
|
||||
0xde, 0xbc, 0xa6, 0xcb, 0xb8, 0x13, 0x9e, 0x74, 0xba, 0x37, 0x1a, 0xea, 0x30, 0x22, 0xdb, 0xa8,
|
||||
0x45, 0x93, 0x7f, 0x92, 0x86, 0x8e, 0x26, 0xc1, 0x74, 0x38, 0xbf, 0xf8, 0x0e, 0x1f, 0x92, 0x71,
|
||||
0x7f, 0xe6, 0x95, 0x5c, 0x20, 0xbd, 0x65, 0x09, 0x7b, 0x3d, 0xf8, 0x4e, 0x2e, 0x30, 0x7c, 0x4a,
|
||||
0x46, 0xad, 0xd4, 0x0a, 0x0a, 0xba, 0xed, 0x5b, 0xb8, 0x9a, 0xe0, 0x95, 0x7f, 0xce, 0x74, 0xf8,
|
||||
0xb5, 0x0b, 0xe0, 0xe9, 0xe9, 0xb3, 0xef, 0xeb, 0x38, 0x38, 0x5f, 0xc7, 0xc1, 0x9f, 0x75, 0x1c,
|
||||
0x9c, 0x6d, 0xe2, 0xc1, 0xf9, 0x26, 0x1e, 0xfc, 0xda, 0xc4, 0x83, 0x8f, 0x0f, 0x5c, 0x8f, 0xa6,
|
||||
0xf8, 0xcc, 0x14, 0x24, 0xa7, 0xff, 0xae, 0xb1, 0xdd, 0xe1, 0x6c, 0x64, 0xb1, 0x27, 0x7f, 0x03,
|
||||
0x00, 0x00, 0xff, 0xff, 0x07, 0x16, 0x5b, 0x67, 0xea, 0x02, 0x00, 0x00,
|
||||
// 531 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xc1, 0x6e, 0xd3, 0x40,
|
||||
0x14, 0x8c, 0x69, 0x08, 0xcd, 0xb6, 0x29, 0x60, 0x55, 0xc8, 0x0d, 0x92, 0x13, 0xc2, 0x25, 0x97,
|
||||
0xda, 0x0a, 0x48, 0x80, 0x04, 0x12, 0xd4, 0x09, 0x15, 0x87, 0x5e, 0x08, 0x9c, 0xb8, 0x58, 0x1b,
|
||||
0xfb, 0xc5, 0x5d, 0x61, 0xfb, 0x59, 0xbb, 0xeb, 0x28, 0xf9, 0x8b, 0x1e, 0xf9, 0x90, 0x7e, 0x44,
|
||||
0x8f, 0x55, 0x05, 0x12, 0xe2, 0x50, 0x50, 0xf2, 0x23, 0xc8, 0xeb, 0x4d, 0x48, 0x7b, 0x09, 0xb7,
|
||||
0xf5, 0xbc, 0x99, 0xf1, 0xec, 0x3c, 0x2d, 0xe9, 0x04, 0x28, 0x12, 0x14, 0x6e, 0xc6, 0x51, 0x62,
|
||||
0x80, 0x71, 0x86, 0x18, 0xbb, 0x93, 0x9e, 0x2b, 0x67, 0x19, 0x08, 0x47, 0xa1, 0xe6, 0xa3, 0x92,
|
||||
0xe3, 0xac, 0x73, 0x9c, 0x49, 0xaf, 0xb9, 0x1f, 0x61, 0x84, 0x0a, 0x74, 0x8b, 0x53, 0x39, 0x6f,
|
||||
0x1e, 0x94, 0x6c, 0xbf, 0x1c, 0xac, 0x4b, 0x9b, 0xb6, 0xfe, 0xd9, 0x88, 0x0a, 0x70, 0x27, 0xbd,
|
||||
0x11, 0x48, 0xda, 0x73, 0x03, 0x64, 0xa9, 0x9e, 0xb7, 0x22, 0xc4, 0x28, 0x86, 0x32, 0xcc, 0x28,
|
||||
0x1f, 0xbb, 0x92, 0x25, 0x20, 0x24, 0x4d, 0xb2, 0xa5, 0xc1, 0x6d, 0x42, 0x98, 0x73, 0x2a, 0x19,
|
||||
0x6a, 0x83, 0xce, 0xf7, 0x2d, 0x52, 0xf3, 0xf2, 0x30, 0x02, 0x69, 0xbe, 0x27, 0x0f, 0x39, 0x04,
|
||||
0x2c, 0x63, 0x90, 0x4a, 0x9f, 0x86, 0x21, 0x07, 0x21, 0x2c, 0xa3, 0x6d, 0x74, 0xeb, 0x9e, 0x75,
|
||||
0x75, 0x7e, 0xb8, 0xaf, 0x83, 0x1d, 0x95, 0x93, 0x4f, 0x92, 0xb3, 0x34, 0x1a, 0x3e, 0x58, 0x49,
|
||||
0x34, 0x6e, 0xbe, 0x21, 0xbb, 0x12, 0x25, 0x8d, 0xfd, 0x91, 0xb2, 0xb5, 0xee, 0xb4, 0x8d, 0xee,
|
||||
0xce, 0xb3, 0x03, 0x47, 0xcb, 0x8b, 0x9b, 0x38, 0xfa, 0x26, 0x4e, 0x1f, 0x59, 0x3a, 0xdc, 0x51,
|
||||
0x74, 0x1d, 0xe2, 0x1d, 0xd9, 0x0b, 0x62, 0xca, 0x12, 0x08, 0x7d, 0x9a, 0x60, 0x9e, 0x4a, 0x6b,
|
||||
0x6b, 0x93, 0xbe, 0xa1, 0x05, 0x47, 0x8a, 0x6f, 0xbe, 0x25, 0x44, 0x48, 0xca, 0xa5, 0x5f, 0x54,
|
||||
0x61, 0x55, 0x95, 0xba, 0xe9, 0x94, 0x35, 0x38, 0xcb, 0x1a, 0x9c, 0xcf, 0xcb, 0x9e, 0xbc, 0xea,
|
||||
0xd9, 0xef, 0x96, 0x31, 0xac, 0x2b, 0x4d, 0x81, 0x9a, 0x1f, 0xc8, 0xfd, 0x14, 0xa6, 0xd2, 0x57,
|
||||
0xb6, 0xfe, 0x98, 0x63, 0x62, 0xdd, 0xfd, 0x4f, 0x97, 0x46, 0x21, 0xec, 0x17, 0xba, 0x63, 0x8e,
|
||||
0x89, 0xd9, 0x24, 0xdb, 0x92, 0xd3, 0x34, 0x38, 0x05, 0x61, 0xd5, 0xda, 0x46, 0xb7, 0x3a, 0x5c,
|
||||
0x7d, 0x9b, 0x4f, 0x49, 0x63, 0x79, 0xf6, 0x63, 0x18, 0x4b, 0xeb, 0x9e, 0x22, 0xec, 0x2e, 0xc1,
|
||||
0x13, 0x18, 0x4b, 0xf3, 0x25, 0xa9, 0x65, 0xc0, 0x19, 0x86, 0xd6, 0xb6, 0x6e, 0xe1, 0x76, 0x82,
|
||||
0x81, 0x5e, 0xa7, 0x57, 0xfd, 0x56, 0x04, 0xd0, 0xf4, 0xce, 0x0f, 0x83, 0xec, 0xf5, 0x31, 0x95,
|
||||
0x2c, 0xcd, 0x31, 0x17, 0xc7, 0x79, 0x1a, 0x9a, 0x2f, 0x48, 0x7d, 0xb5, 0xab, 0x8d, 0x6b, 0xfd,
|
||||
0x47, 0x35, 0x3f, 0x12, 0x92, 0x01, 0x0f, 0x20, 0x95, 0x34, 0x02, 0xb5, 0xcd, 0xba, 0xd7, 0xbb,
|
||||
0xb8, 0x6e, 0x55, 0x7e, 0x5d, 0xb7, 0x1e, 0x97, 0x62, 0x11, 0x7e, 0x75, 0x18, 0xba, 0x09, 0x95,
|
||||
0xa7, 0xce, 0x09, 0x44, 0x34, 0x98, 0x0d, 0x20, 0xb8, 0x3a, 0x3f, 0x24, 0xda, 0x7b, 0x00, 0xc1,
|
||||
0x70, 0xcd, 0xc4, 0x7c, 0x45, 0x6a, 0x30, 0xcd, 0x18, 0x9f, 0xe9, 0xe5, 0x6e, 0x2e, 0x56, 0xf3,
|
||||
0xbd, 0xd7, 0x17, 0x73, 0xdb, 0xb8, 0x9c, 0xdb, 0xc6, 0x9f, 0xb9, 0x6d, 0x9c, 0x2d, 0xec, 0xca,
|
||||
0xe5, 0xc2, 0xae, 0xfc, 0x5c, 0xd8, 0x95, 0x2f, 0x4f, 0x6e, 0x44, 0x99, 0xde, 0x7c, 0x9e, 0xea,
|
||||
0x6d, 0x8e, 0x6a, 0x0a, 0x7b, 0xfe, 0x37, 0x00, 0x00, 0xff, 0xff, 0xb0, 0x0b, 0xb8, 0xdb, 0xc2,
|
||||
0x03, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *Budget) Marshal() (dAtA []byte, err error) {
|
||||
@ -276,6 +341,56 @@ func (m *Budget) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *ContinuousFund) 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 *ContinuousFund) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *ContinuousFund) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Expiry != nil {
|
||||
n6, err6 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.Expiry, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.Expiry):])
|
||||
if err6 != nil {
|
||||
return 0, err6
|
||||
}
|
||||
i -= n6
|
||||
i = encodeVarintTypes(dAtA, i, uint64(n6))
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
{
|
||||
size := m.Percentage.Size()
|
||||
i -= size
|
||||
if _, err := m.Percentage.MarshalTo(dAtA[i:]); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i = encodeVarintTypes(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
if len(m.Recipient) > 0 {
|
||||
i -= len(m.Recipient)
|
||||
copy(dAtA[i:], m.Recipient)
|
||||
i = encodeVarintTypes(dAtA, i, uint64(len(m.Recipient)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintTypes(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovTypes(v)
|
||||
base := offset
|
||||
@ -326,6 +441,25 @@ func (m *Budget) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *ContinuousFund) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Recipient)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTypes(uint64(l))
|
||||
}
|
||||
l = m.Percentage.Size()
|
||||
n += 1 + l + sovTypes(uint64(l))
|
||||
if m.Expiry != nil {
|
||||
l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.Expiry)
|
||||
n += 1 + l + sovTypes(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovTypes(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
@ -632,6 +766,158 @@ func (m *Budget) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *ContinuousFund) 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 ErrIntOverflowTypes
|
||||
}
|
||||
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: ContinuousFund: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: ContinuousFund: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTypes
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Recipient = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Percentage", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTypes
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if err := m.Percentage.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Expiry", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTypes
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.Expiry == nil {
|
||||
m.Expiry = new(time.Time)
|
||||
}
|
||||
if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.Expiry, dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipTypes(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthTypes
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipTypes(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user