Add a lockup account type

This commit is contained in:
Prathamesh Musale 2025-05-15 12:38:29 +05:30
parent 7af9e9d496
commit 0ed01e5e45
5 changed files with 1099 additions and 1 deletions

View File

@ -43,7 +43,7 @@ build-linux:
$(BUILD_TARGETS): go.sum $(BUILDDIR)/
@echo "--> installing laconicd"
go $@ $(BUILD_FLAGS) $(BUILD_ARGS) ./...
go $@ $(BUILD_FLAGS) $(BUILD_ARGS) ./cmd/laconicd
$(BUILDDIR)/:
mkdir -p $(BUILDDIR)/

View File

@ -0,0 +1,672 @@
// Code generated by protoc-gen-go-pulsar. DO NOT EDIT.
package typesv1
import (
fmt "fmt"
_ "github.com/cosmos/cosmos-proto"
runtime "github.com/cosmos/cosmos-proto/runtime"
types "github.com/cosmos/cosmos-sdk/x/auth/types"
_ "github.com/cosmos/gogoproto/gogoproto"
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 (
md_LockupAccount protoreflect.MessageDescriptor
fd_LockupAccount_base_account protoreflect.FieldDescriptor
fd_LockupAccount_distribution protoreflect.FieldDescriptor
)
func init() {
file_cerc_types_v1_lockup_proto_init()
md_LockupAccount = File_cerc_types_v1_lockup_proto.Messages().ByName("LockupAccount")
fd_LockupAccount_base_account = md_LockupAccount.Fields().ByName("base_account")
fd_LockupAccount_distribution = md_LockupAccount.Fields().ByName("distribution")
}
var _ protoreflect.Message = (*fastReflection_LockupAccount)(nil)
type fastReflection_LockupAccount LockupAccount
func (x *LockupAccount) ProtoReflect() protoreflect.Message {
return (*fastReflection_LockupAccount)(x)
}
func (x *LockupAccount) slowProtoReflect() protoreflect.Message {
mi := &file_cerc_types_v1_lockup_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_LockupAccount_messageType fastReflection_LockupAccount_messageType
var _ protoreflect.MessageType = fastReflection_LockupAccount_messageType{}
type fastReflection_LockupAccount_messageType struct{}
func (x fastReflection_LockupAccount_messageType) Zero() protoreflect.Message {
return (*fastReflection_LockupAccount)(nil)
}
func (x fastReflection_LockupAccount_messageType) New() protoreflect.Message {
return new(fastReflection_LockupAccount)
}
func (x fastReflection_LockupAccount_messageType) Descriptor() protoreflect.MessageDescriptor {
return md_LockupAccount
}
// Descriptor returns message descriptor, which contains only the protobuf
// type information for the message.
func (x *fastReflection_LockupAccount) Descriptor() protoreflect.MessageDescriptor {
return md_LockupAccount
}
// 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_LockupAccount) Type() protoreflect.MessageType {
return _fastReflection_LockupAccount_messageType
}
// New returns a newly allocated and mutable empty message.
func (x *fastReflection_LockupAccount) New() protoreflect.Message {
return new(fastReflection_LockupAccount)
}
// Interface unwraps the message reflection interface and
// returns the underlying ProtoMessage interface.
func (x *fastReflection_LockupAccount) Interface() protoreflect.ProtoMessage {
return (*LockupAccount)(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_LockupAccount) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
if x.BaseAccount != nil {
value := protoreflect.ValueOfMessage(x.BaseAccount.ProtoReflect())
if !f(fd_LockupAccount_base_account, value) {
return
}
}
if x.Distribution != "" {
value := protoreflect.ValueOfString(x.Distribution)
if !f(fd_LockupAccount_distribution, 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_LockupAccount) Has(fd protoreflect.FieldDescriptor) bool {
switch fd.FullName() {
case "cerc.types.v1.LockupAccount.base_account":
return x.BaseAccount != nil
case "cerc.types.v1.LockupAccount.distribution":
return x.Distribution != ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.types.v1.LockupAccount"))
}
panic(fmt.Errorf("message cerc.types.v1.LockupAccount 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_LockupAccount) Clear(fd protoreflect.FieldDescriptor) {
switch fd.FullName() {
case "cerc.types.v1.LockupAccount.base_account":
x.BaseAccount = nil
case "cerc.types.v1.LockupAccount.distribution":
x.Distribution = ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.types.v1.LockupAccount"))
}
panic(fmt.Errorf("message cerc.types.v1.LockupAccount 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_LockupAccount) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
switch descriptor.FullName() {
case "cerc.types.v1.LockupAccount.base_account":
value := x.BaseAccount
return protoreflect.ValueOfMessage(value.ProtoReflect())
case "cerc.types.v1.LockupAccount.distribution":
value := x.Distribution
return protoreflect.ValueOfString(value)
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.types.v1.LockupAccount"))
}
panic(fmt.Errorf("message cerc.types.v1.LockupAccount 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_LockupAccount) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
switch fd.FullName() {
case "cerc.types.v1.LockupAccount.base_account":
x.BaseAccount = value.Message().Interface().(*types.ModuleAccount)
case "cerc.types.v1.LockupAccount.distribution":
x.Distribution = value.Interface().(string)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.types.v1.LockupAccount"))
}
panic(fmt.Errorf("message cerc.types.v1.LockupAccount 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_LockupAccount) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cerc.types.v1.LockupAccount.base_account":
if x.BaseAccount == nil {
x.BaseAccount = new(types.ModuleAccount)
}
return protoreflect.ValueOfMessage(x.BaseAccount.ProtoReflect())
case "cerc.types.v1.LockupAccount.distribution":
panic(fmt.Errorf("field distribution of message cerc.types.v1.LockupAccount is not mutable"))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.types.v1.LockupAccount"))
}
panic(fmt.Errorf("message cerc.types.v1.LockupAccount 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_LockupAccount) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cerc.types.v1.LockupAccount.base_account":
m := new(types.ModuleAccount)
return protoreflect.ValueOfMessage(m.ProtoReflect())
case "cerc.types.v1.LockupAccount.distribution":
return protoreflect.ValueOfString("")
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.types.v1.LockupAccount"))
}
panic(fmt.Errorf("message cerc.types.v1.LockupAccount 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_LockupAccount) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
switch d.FullName() {
default:
panic(fmt.Errorf("%s is not a oneof field in cerc.types.v1.LockupAccount", 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_LockupAccount) 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_LockupAccount) 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_LockupAccount) 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_LockupAccount) ProtoMethods() *protoiface.Methods {
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
x := input.Message.Interface().(*LockupAccount)
if x == nil {
return protoiface.SizeOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Size: 0,
}
}
options := runtime.SizeInputToOptions(input)
_ = options
var n int
var l int
_ = l
if x.BaseAccount != nil {
l = options.Size(x.BaseAccount)
n += 1 + l + runtime.Sov(uint64(l))
}
l = len(x.Distribution)
if l > 0 {
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().(*LockupAccount)
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.Distribution) > 0 {
i -= len(x.Distribution)
copy(dAtA[i:], x.Distribution)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Distribution)))
i--
dAtA[i] = 0x12
}
if x.BaseAccount != nil {
encoded, err := options.Marshal(x.BaseAccount)
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().(*LockupAccount)
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: LockupAccount: wiretype end group for non-group")
}
if fieldNum <= 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: LockupAccount: 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 BaseAccount", 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.BaseAccount == nil {
x.BaseAccount = &types.ModuleAccount{}
}
if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.BaseAccount); 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 Distribution", 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.Distribution = string(dAtA[iNdEx:postIndex])
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: cerc/types/v1/lockup.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)
)
// LockupAccount extends the Cosmos SDK ModuleAccount with a distribution field.
type LockupAccount struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
BaseAccount *types.ModuleAccount `protobuf:"bytes,1,opt,name=base_account,json=baseAccount,proto3" json:"base_account,omitempty"`
Distribution string `protobuf:"bytes,2,opt,name=distribution,proto3" json:"distribution,omitempty"`
}
func (x *LockupAccount) Reset() {
*x = LockupAccount{}
if protoimpl.UnsafeEnabled {
mi := &file_cerc_types_v1_lockup_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LockupAccount) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LockupAccount) ProtoMessage() {}
// Deprecated: Use LockupAccount.ProtoReflect.Descriptor instead.
func (*LockupAccount) Descriptor() ([]byte, []int) {
return file_cerc_types_v1_lockup_proto_rawDescGZIP(), []int{0}
}
func (x *LockupAccount) GetBaseAccount() *types.ModuleAccount {
if x != nil {
return x.BaseAccount
}
return nil
}
func (x *LockupAccount) GetDistribution() string {
if x != nil {
return x.Distribution
}
return ""
}
var File_cerc_types_v1_lockup_proto protoreflect.FileDescriptor
var file_cerc_types_v1_lockup_proto_rawDesc = []byte{
0x0a, 0x1a, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f,
0x6c, 0x6f, 0x63, 0x6b, 0x75, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x63, 0x65,
0x72, 0x63, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x19, 0x63, 0x6f, 0x73,
0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61,
0x75, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa7, 0x01, 0x0a,
0x0d, 0x4c, 0x6f, 0x63, 0x6b, 0x75, 0x70, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x4b,
0x0a, 0x0c, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75,
0x74, 0x68, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x04, 0xd0, 0xde, 0x1f, 0x01, 0x52, 0x0b,
0x62, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x64,
0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0c, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x3a,
0x25, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0xca, 0xb4, 0x2d, 0x19, 0x63, 0x65, 0x72,
0x63, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4c, 0x6f, 0x63, 0x6b, 0x75, 0x70, 0x41, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x42, 0xad, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x63,
0x65, 0x72, 0x63, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4c, 0x6f,
0x63, 0x6b, 0x75, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x35, 0x67, 0x69, 0x74,
0x2e, 0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f,
0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x65, 0x72,
0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x74, 0x79, 0x70, 0x65, 0x73,
0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x54, 0x58, 0xaa, 0x02, 0x0d, 0x43, 0x65, 0x72, 0x63, 0x2e,
0x54, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x43, 0x65, 0x72, 0x63, 0x5c,
0x54, 0x79, 0x70, 0x65, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x43, 0x65, 0x72, 0x63, 0x5c,
0x54, 0x79, 0x70, 0x65, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61,
0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x43, 0x65, 0x72, 0x63, 0x3a, 0x3a, 0x54, 0x79, 0x70,
0x65, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_cerc_types_v1_lockup_proto_rawDescOnce sync.Once
file_cerc_types_v1_lockup_proto_rawDescData = file_cerc_types_v1_lockup_proto_rawDesc
)
func file_cerc_types_v1_lockup_proto_rawDescGZIP() []byte {
file_cerc_types_v1_lockup_proto_rawDescOnce.Do(func() {
file_cerc_types_v1_lockup_proto_rawDescData = protoimpl.X.CompressGZIP(file_cerc_types_v1_lockup_proto_rawDescData)
})
return file_cerc_types_v1_lockup_proto_rawDescData
}
var file_cerc_types_v1_lockup_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_cerc_types_v1_lockup_proto_goTypes = []interface{}{
(*LockupAccount)(nil), // 0: cerc.types.v1.LockupAccount
(*types.ModuleAccount)(nil), // 1: cosmos.auth.v1beta1.ModuleAccount
}
var file_cerc_types_v1_lockup_proto_depIdxs = []int32{
1, // 0: cerc.types.v1.LockupAccount.base_account:type_name -> cosmos.auth.v1beta1.ModuleAccount
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_cerc_types_v1_lockup_proto_init() }
func file_cerc_types_v1_lockup_proto_init() {
if File_cerc_types_v1_lockup_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_cerc_types_v1_lockup_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LockupAccount); 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_cerc_types_v1_lockup_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_cerc_types_v1_lockup_proto_goTypes,
DependencyIndexes: file_cerc_types_v1_lockup_proto_depIdxs,
MessageInfos: file_cerc_types_v1_lockup_proto_msgTypes,
}.Build()
File_cerc_types_v1_lockup_proto = out.File
file_cerc_types_v1_lockup_proto_rawDesc = nil
file_cerc_types_v1_lockup_proto_goTypes = nil
file_cerc_types_v1_lockup_proto_depIdxs = nil
}

View File

@ -0,0 +1,20 @@
syntax = "proto3";
package cerc.types.v1;
import "cosmos_proto/cosmos.proto";
import "cosmos/auth/v1beta1/auth.proto";
import "gogoproto/gogo.proto";
option go_package = "git.vdb.to/cerc-io/laconicd/x/types";
// LockupAccount extends the Cosmos SDK ModuleAccount with a distribution field.
message LockupAccount {
option (gogoproto.goproto_getters) = false;
option (gogoproto.equal) = false;
option (cosmos_proto.implements_interface) = "cerc.types.LockupAccountI";
cosmos.auth.v1beta1.ModuleAccount base_account = 1
[ (gogoproto.embed) = true ];
string distribution = 2;
}

34
x/types/lockup.go Normal file
View File

@ -0,0 +1,34 @@
package types
import (
"errors"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
)
var (
_ authtypes.GenesisAccount = (*LockupAccount)(nil)
_ LockupAccountI = (*LockupAccount)(nil)
)
// LockupAccountI defines an account interface for accounts with lockup distribution
type LockupAccountI interface {
sdk.AccountI
GetDistribution() string
}
// Validate checks for errors on the account fields
func (la LockupAccount) Validate() error {
if la.BaseAccount == nil {
return errors.New("uninitialized LockupAccount: BaseAccount is nil")
}
return la.BaseAccount.Validate()
}
// GetAzimuthId returns the Azimuth Id associated with the account
func (la LockupAccount) GetDistribution() string {
return la.Distribution
}

372
x/types/lockup.pb.go Normal file
View File

@ -0,0 +1,372 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: cerc/types/v1/lockup.proto
package types
import (
fmt "fmt"
_ "github.com/cosmos/cosmos-proto"
types "github.com/cosmos/cosmos-sdk/x/auth/types"
_ "github.com/cosmos/gogoproto/gogoproto"
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
// LockupAccount extends the Cosmos SDK ModuleAccount with a distribution field.
type LockupAccount struct {
*types.ModuleAccount `protobuf:"bytes,1,opt,name=base_account,json=baseAccount,proto3,embedded=base_account" json:"base_account,omitempty"`
Distribution string `protobuf:"bytes,2,opt,name=distribution,proto3" json:"distribution,omitempty"`
}
func (m *LockupAccount) Reset() { *m = LockupAccount{} }
func (m *LockupAccount) String() string { return proto.CompactTextString(m) }
func (*LockupAccount) ProtoMessage() {}
func (*LockupAccount) Descriptor() ([]byte, []int) {
return fileDescriptor_8fa58dc19f6348bf, []int{0}
}
func (m *LockupAccount) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *LockupAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_LockupAccount.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 *LockupAccount) XXX_Merge(src proto.Message) {
xxx_messageInfo_LockupAccount.Merge(m, src)
}
func (m *LockupAccount) XXX_Size() int {
return m.Size()
}
func (m *LockupAccount) XXX_DiscardUnknown() {
xxx_messageInfo_LockupAccount.DiscardUnknown(m)
}
var xxx_messageInfo_LockupAccount proto.InternalMessageInfo
func init() {
proto.RegisterType((*LockupAccount)(nil), "cerc.types.v1.LockupAccount")
}
func init() { proto.RegisterFile("cerc/types/v1/lockup.proto", fileDescriptor_8fa58dc19f6348bf) }
var fileDescriptor_8fa58dc19f6348bf = []byte{
// 281 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0x4e, 0x2d, 0x4a,
0xd6, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2f, 0x33, 0xd4, 0xcf, 0xc9, 0x4f, 0xce, 0x2e, 0x2d,
0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x05, 0xc9, 0xe9, 0x81, 0xe5, 0xf4, 0xca, 0x0c,
0xa5, 0x24, 0x93, 0xf3, 0x8b, 0x73, 0xf3, 0x8b, 0xe3, 0xc1, 0x92, 0xfa, 0x10, 0x0e, 0x44, 0xa5,
0x94, 0x1c, 0x84, 0xa7, 0x9f, 0x58, 0x5a, 0x92, 0xa1, 0x5f, 0x66, 0x98, 0x94, 0x5a, 0x92, 0x68,
0x08, 0xe6, 0x40, 0xe5, 0x45, 0xd2, 0xf3, 0xd3, 0xf3, 0x21, 0xfa, 0x40, 0x2c, 0x88, 0xa8, 0xd2,
0x72, 0x46, 0x2e, 0x5e, 0x1f, 0xb0, 0x85, 0x8e, 0xc9, 0xc9, 0xf9, 0xa5, 0x79, 0x25, 0x42, 0xde,
0x5c, 0x3c, 0x49, 0x89, 0xc5, 0xa9, 0xf1, 0x89, 0x10, 0xbe, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xb7,
0x91, 0x92, 0x1e, 0xd4, 0x32, 0xb0, 0x89, 0x50, 0xe3, 0xf5, 0x7c, 0xf3, 0x53, 0x4a, 0x73, 0x52,
0xa1, 0x3a, 0x9d, 0x58, 0x2e, 0xdc, 0x93, 0x67, 0x0c, 0xe2, 0x06, 0xe9, 0x86, 0x19, 0xa6, 0xc4,
0xc5, 0x93, 0x92, 0x59, 0x5c, 0x52, 0x94, 0x99, 0x54, 0x5a, 0x92, 0x99, 0x9f, 0x27, 0xc1, 0xa4,
0xc0, 0xa8, 0xc1, 0x19, 0x84, 0x22, 0x66, 0xa5, 0xda, 0xb1, 0x40, 0x9e, 0xe1, 0xc5, 0x02, 0x79,
0x86, 0x53, 0x5b, 0x74, 0x25, 0x91, 0xbc, 0x8b, 0xe2, 0x2c, 0x4f, 0x27, 0xdb, 0x13, 0x8f, 0xe4,
0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f,
0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x52, 0x4e, 0xcf, 0x2c, 0xd1, 0x2b, 0x4b, 0x49, 0xd2,
0x03, 0x05, 0x49, 0x6a, 0x51, 0xb2, 0x6e, 0x66, 0xbe, 0x7e, 0x4e, 0x62, 0x72, 0x7e, 0x5e, 0x66,
0x72, 0x8a, 0x7e, 0x05, 0x24, 0x60, 0x93, 0xd8, 0xc0, 0xfe, 0x35, 0x06, 0x04, 0x00, 0x00, 0xff,
0xff, 0xef, 0x5d, 0x16, 0x13, 0x6d, 0x01, 0x00, 0x00,
}
func (m *LockupAccount) 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 *LockupAccount) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *LockupAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Distribution) > 0 {
i -= len(m.Distribution)
copy(dAtA[i:], m.Distribution)
i = encodeVarintLockup(dAtA, i, uint64(len(m.Distribution)))
i--
dAtA[i] = 0x12
}
if m.ModuleAccount != nil {
{
size, err := m.ModuleAccount.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintLockup(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintLockup(dAtA []byte, offset int, v uint64) int {
offset -= sovLockup(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *LockupAccount) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.ModuleAccount != nil {
l = m.ModuleAccount.Size()
n += 1 + l + sovLockup(uint64(l))
}
l = len(m.Distribution)
if l > 0 {
n += 1 + l + sovLockup(uint64(l))
}
return n
}
func sovLockup(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozLockup(x uint64) (n int) {
return sovLockup(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *LockupAccount) 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 ErrIntOverflowLockup
}
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: LockupAccount: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: LockupAccount: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ModuleAccount", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowLockup
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthLockup
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthLockup
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.ModuleAccount == nil {
m.ModuleAccount = &types.ModuleAccount{}
}
if err := m.ModuleAccount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Distribution", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowLockup
}
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 ErrInvalidLengthLockup
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthLockup
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Distribution = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipLockup(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthLockup
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipLockup(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, ErrIntOverflowLockup
}
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, ErrIntOverflowLockup
}
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, ErrIntOverflowLockup
}
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, ErrInvalidLengthLockup
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupLockup
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthLockup
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthLockup = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowLockup = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupLockup = fmt.Errorf("proto: unexpected end of group")
)