v2

package
v11.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthModels        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowModels          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupModels = fmt.Errorf("proto: unexpected end of group")
)
View Source
var DelegationType_name = map[int32]string{
	0: "DELEGATION_TYPE_UNSPECIFIED",
	1: "DELEGATION_TYPE_POOL",
	2: "DELEGATION_TYPE_OPERATOR",
	3: "DELEGATION_TYPE_SERVICE",
}
View Source
var DelegationType_value = map[string]int32{
	"DELEGATION_TYPE_UNSPECIFIED": 0,
	"DELEGATION_TYPE_POOL":        1,
	"DELEGATION_TYPE_OPERATOR":    2,
	"DELEGATION_TYPE_SERVICE":     3,
}

Functions

func MigrateStore

func MigrateStore(ctx sdk.Context, keeper Keeper, storeService corestoretypes.KVStoreService, cdc codec.BinaryCodec) error

MigrateStore performs in-place store migrations from v1 to v2. The migrations include: - Removing joined operators that are not allowed by the services they have joined - Upgrading the user preferences to the new format

Types

type DTData

type DTData struct {
	UnbondingDelegationType DelegationType `` /* 175-byte string literal not displayed */
	DelegatorAddress        string         `protobuf:"bytes,2,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"`
	TargetID                uint32         `protobuf:"varint,3,opt,name=target_id,json=targetId,proto3" json:"target_id,omitempty"`
}

DTData is a struct that contains the basic information about an unbonding delegation. It is intended to be used as a marshalable pointer. For example, a DTData can be used to construct the key to getting an UnbondingDelegation from state.

func (*DTData) Descriptor

func (*DTData) Descriptor() ([]byte, []int)

func (*DTData) Marshal

func (m *DTData) Marshal() (dAtA []byte, err error)

func (*DTData) MarshalTo

func (m *DTData) MarshalTo(dAtA []byte) (int, error)

func (*DTData) MarshalToSizedBuffer

func (m *DTData) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*DTData) ProtoMessage

func (*DTData) ProtoMessage()

func (*DTData) Reset

func (m *DTData) Reset()

func (*DTData) Size

func (m *DTData) Size() (n int)

func (*DTData) String

func (m *DTData) String() string

func (*DTData) Unmarshal

func (m *DTData) Unmarshal(dAtA []byte) error

func (*DTData) XXX_DiscardUnknown

func (m *DTData) XXX_DiscardUnknown()

func (*DTData) XXX_Marshal

func (m *DTData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DTData) XXX_Merge

func (m *DTData) XXX_Merge(src proto.Message)

func (*DTData) XXX_Size

func (m *DTData) XXX_Size() int

func (*DTData) XXX_Unmarshal

func (m *DTData) XXX_Unmarshal(b []byte) error

type DTDataList

type DTDataList struct {
	Data []DTData `protobuf:"bytes,1,rep,name=data,proto3" json:"data"`
}

DTDataList defines an array of DTData objects.

func (*DTDataList) Descriptor

func (*DTDataList) Descriptor() ([]byte, []int)

func (*DTDataList) GetData

func (m *DTDataList) GetData() []DTData

func (*DTDataList) Marshal

func (m *DTDataList) Marshal() (dAtA []byte, err error)

func (*DTDataList) MarshalTo

func (m *DTDataList) MarshalTo(dAtA []byte) (int, error)

func (*DTDataList) MarshalToSizedBuffer

func (m *DTDataList) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*DTDataList) ProtoMessage

func (*DTDataList) ProtoMessage()

func (*DTDataList) Reset

func (m *DTDataList) Reset()

func (*DTDataList) Size

func (m *DTDataList) Size() (n int)

func (*DTDataList) String

func (m *DTDataList) String() string

func (*DTDataList) Unmarshal

func (m *DTDataList) Unmarshal(dAtA []byte) error

func (*DTDataList) XXX_DiscardUnknown

func (m *DTDataList) XXX_DiscardUnknown()

func (*DTDataList) XXX_Marshal

func (m *DTDataList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DTDataList) XXX_Merge

func (m *DTDataList) XXX_Merge(src proto.Message)

func (*DTDataList) XXX_Size

func (m *DTDataList) XXX_Size() int

func (*DTDataList) XXX_Unmarshal

func (m *DTDataList) XXX_Unmarshal(b []byte) error

type Delegation

type Delegation struct {
	// Type is the type of delegation.
	Type DelegationType `protobuf:"varint,1,opt,name=type,proto3,enum=milkyway.restaking.v1.DelegationType" json:"type,omitempty"`
	// UserAddress is the encoded address of the user.
	UserAddress string `protobuf:"bytes,2,opt,name=user_address,json=userAddress,proto3" json:"user_address,omitempty"`
	// TargetID is the id of the target to which the delegation is associated
	// (pool, operator, service).
	TargetID uint32 `protobuf:"varint,3,opt,name=target_id,json=targetId,proto3" json:"target_id,omitempty"`
	// Shares define the delegation shares received.
	Shares github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,4,rep,name=shares,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"shares"`
}

Delegation represents the bond with tokens held by an account with a given target.

func (*Delegation) Descriptor

func (*Delegation) Descriptor() ([]byte, []int)

func (*Delegation) Marshal

func (m *Delegation) Marshal() (dAtA []byte, err error)

func (*Delegation) MarshalTo

func (m *Delegation) MarshalTo(dAtA []byte) (int, error)

func (*Delegation) MarshalToSizedBuffer

func (m *Delegation) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Delegation) ProtoMessage

func (*Delegation) ProtoMessage()

func (*Delegation) Reset

func (m *Delegation) Reset()

func (*Delegation) Size

func (m *Delegation) Size() (n int)

func (*Delegation) String

func (m *Delegation) String() string

func (*Delegation) Unmarshal

func (m *Delegation) Unmarshal(dAtA []byte) error

func (*Delegation) XXX_DiscardUnknown

func (m *Delegation) XXX_DiscardUnknown()

func (*Delegation) XXX_Marshal

func (m *Delegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Delegation) XXX_Merge

func (m *Delegation) XXX_Merge(src proto.Message)

func (*Delegation) XXX_Size

func (m *Delegation) XXX_Size() int

func (*Delegation) XXX_Unmarshal

func (m *Delegation) XXX_Unmarshal(b []byte) error

type DelegationResponse

type DelegationResponse struct {
	Delegation Delegation                               `protobuf:"bytes,1,opt,name=delegation,proto3" json:"delegation"`
	Balance    github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=balance,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"balance"`
}

DelegationResponse is equivalent to Delegation except that it contains a balance in addition to shares which is more suitable for client responses.

func (*DelegationResponse) Descriptor

func (*DelegationResponse) Descriptor() ([]byte, []int)

func (*DelegationResponse) GetBalance

func (*DelegationResponse) GetDelegation

func (m *DelegationResponse) GetDelegation() Delegation

func (*DelegationResponse) Marshal

func (m *DelegationResponse) Marshal() (dAtA []byte, err error)

func (*DelegationResponse) MarshalTo

func (m *DelegationResponse) MarshalTo(dAtA []byte) (int, error)

func (*DelegationResponse) MarshalToSizedBuffer

func (m *DelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*DelegationResponse) ProtoMessage

func (*DelegationResponse) ProtoMessage()

func (*DelegationResponse) Reset

func (m *DelegationResponse) Reset()

func (*DelegationResponse) Size

func (m *DelegationResponse) Size() (n int)

func (*DelegationResponse) String

func (m *DelegationResponse) String() string

func (*DelegationResponse) Unmarshal

func (m *DelegationResponse) Unmarshal(dAtA []byte) error

func (*DelegationResponse) XXX_DiscardUnknown

func (m *DelegationResponse) XXX_DiscardUnknown()

func (*DelegationResponse) XXX_Marshal

func (m *DelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DelegationResponse) XXX_Merge

func (m *DelegationResponse) XXX_Merge(src proto.Message)

func (*DelegationResponse) XXX_Size

func (m *DelegationResponse) XXX_Size() int

func (*DelegationResponse) XXX_Unmarshal

func (m *DelegationResponse) XXX_Unmarshal(b []byte) error

type DelegationType

type DelegationType int32

DelegationType defines the type of delegation.

const (
	// DELEGATION_TYPE_UNSPECIFIED defines an unspecified delegation type.
	DELEGATION_TYPE_UNSPECIFIED DelegationType = 0
	// DELEGATION_TYPE_POOL defines a delegation to a pool.
	DELEGATION_TYPE_POOL DelegationType = 1
	// DELEGATION_TYPE_OPERATOR defines a delegation to an operator.
	DELEGATION_TYPE_OPERATOR DelegationType = 2
	// DELEGATION_TYPE_SERVICE defines a delegation to a service.
	DELEGATION_TYPE_SERVICE DelegationType = 3
)

func (DelegationType) EnumDescriptor

func (DelegationType) EnumDescriptor() ([]byte, []int)

func (DelegationType) String

func (x DelegationType) String() string

type Keeper

type Keeper interface {
	IterateAllOperatorsJoinedServices(ctx context.Context, action func(operatorID uint32, serviceID uint32) (stop bool, err error)) error
	CanOperatorValidateService(ctx context.Context, serviceID uint32, operatorID uint32) (bool, error)
	RemoveServiceFromOperatorJoinedServices(ctx context.Context, operatorID uint32, serviceID uint32) error

	GetAllPoolDelegations(ctx context.Context) ([]restakingtypes.Delegation, error)
	GetAllOperatorDelegations(ctx context.Context) ([]restakingtypes.Delegation, error)
	GetAllServiceDelegations(ctx context.Context) ([]restakingtypes.Delegation, error)
}

type UnbondingDelegation

type UnbondingDelegation struct {
	// Type is the type of the unbonding delegation.
	Type DelegationType `protobuf:"varint,1,opt,name=type,proto3,enum=milkyway.restaking.v1.DelegationType" json:"type,omitempty"`
	// DelegatorAddress is the encoded address of the delegator.
	DelegatorAddress string `protobuf:"bytes,2,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"`
	// TargetID is the ID of the target from which the tokens will be undelegated
	// (pool, service, operator)
	TargetID uint32 `protobuf:"varint,3,opt,name=target_id,json=targetId,proto3" json:"target_id,omitempty"`
	// Entries are the unbonding delegation entries.
	Entries []UnbondingDelegationEntry `protobuf:"bytes,4,rep,name=entries,proto3" json:"entries"`
}

UnbondingDelegation stores all of a single delegator's unbonding bonds for a single target in an time-ordered list.

func (*UnbondingDelegation) Descriptor

func (*UnbondingDelegation) Descriptor() ([]byte, []int)

func (*UnbondingDelegation) Marshal

func (m *UnbondingDelegation) Marshal() (dAtA []byte, err error)

func (*UnbondingDelegation) MarshalTo

func (m *UnbondingDelegation) MarshalTo(dAtA []byte) (int, error)

func (*UnbondingDelegation) MarshalToSizedBuffer

func (m *UnbondingDelegation) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*UnbondingDelegation) ProtoMessage

func (*UnbondingDelegation) ProtoMessage()

func (*UnbondingDelegation) Reset

func (m *UnbondingDelegation) Reset()

func (*UnbondingDelegation) Size

func (m *UnbondingDelegation) Size() (n int)

func (*UnbondingDelegation) String

func (m *UnbondingDelegation) String() string

func (*UnbondingDelegation) Unmarshal

func (m *UnbondingDelegation) Unmarshal(dAtA []byte) error

func (*UnbondingDelegation) XXX_DiscardUnknown

func (m *UnbondingDelegation) XXX_DiscardUnknown()

func (*UnbondingDelegation) XXX_Marshal

func (m *UnbondingDelegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*UnbondingDelegation) XXX_Merge

func (m *UnbondingDelegation) XXX_Merge(src proto.Message)

func (*UnbondingDelegation) XXX_Size

func (m *UnbondingDelegation) XXX_Size() int

func (*UnbondingDelegation) XXX_Unmarshal

func (m *UnbondingDelegation) XXX_Unmarshal(b []byte) error

type UnbondingDelegationEntry

type UnbondingDelegationEntry struct {
	// CreationHeight is the height which the unbonding took place.
	CreationHeight int64 `protobuf:"varint,1,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty"`
	// CompletionTime is the unix time for unbonding completion.
	CompletionTime time.Time `protobuf:"bytes,2,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time"`
	// InitialBalance defines the tokens initially scheduled to receive at
	// completion.
	InitialBalance github_com_cosmos_cosmos_sdk_types.Coins `` /* 147-byte string literal not displayed */
	// Balance defines the tokens to receive at completion.
	Balance github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,4,rep,name=balance,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"balance"`
	// Incrementing id that uniquely identifies this entry
	UnbondingID uint64 `protobuf:"varint,5,opt,name=unbonding_id,json=unbondingId,proto3" json:"unbonding_id,omitempty"`
}

UnbondingDelegationEntry defines an unbonding object with relevant metadata.

func (*UnbondingDelegationEntry) Descriptor

func (*UnbondingDelegationEntry) Descriptor() ([]byte, []int)

func (*UnbondingDelegationEntry) Equal

func (this *UnbondingDelegationEntry) Equal(that interface{}) bool

func (*UnbondingDelegationEntry) GetBalance

func (*UnbondingDelegationEntry) GetCompletionTime

func (m *UnbondingDelegationEntry) GetCompletionTime() time.Time

func (*UnbondingDelegationEntry) GetCreationHeight

func (m *UnbondingDelegationEntry) GetCreationHeight() int64

func (*UnbondingDelegationEntry) GetInitialBalance

func (*UnbondingDelegationEntry) GetUnbondingID

func (m *UnbondingDelegationEntry) GetUnbondingID() uint64

func (*UnbondingDelegationEntry) Marshal

func (m *UnbondingDelegationEntry) Marshal() (dAtA []byte, err error)

func (*UnbondingDelegationEntry) MarshalTo

func (m *UnbondingDelegationEntry) MarshalTo(dAtA []byte) (int, error)

func (*UnbondingDelegationEntry) MarshalToSizedBuffer

func (m *UnbondingDelegationEntry) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*UnbondingDelegationEntry) ProtoMessage

func (*UnbondingDelegationEntry) ProtoMessage()

func (*UnbondingDelegationEntry) Reset

func (m *UnbondingDelegationEntry) Reset()

func (*UnbondingDelegationEntry) Size

func (m *UnbondingDelegationEntry) Size() (n int)

func (*UnbondingDelegationEntry) String

func (m *UnbondingDelegationEntry) String() string

func (*UnbondingDelegationEntry) Unmarshal

func (m *UnbondingDelegationEntry) Unmarshal(dAtA []byte) error

func (*UnbondingDelegationEntry) XXX_DiscardUnknown

func (m *UnbondingDelegationEntry) XXX_DiscardUnknown()

func (*UnbondingDelegationEntry) XXX_Marshal

func (m *UnbondingDelegationEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*UnbondingDelegationEntry) XXX_Merge

func (m *UnbondingDelegationEntry) XXX_Merge(src proto.Message)

func (*UnbondingDelegationEntry) XXX_Size

func (m *UnbondingDelegationEntry) XXX_Size() int

func (*UnbondingDelegationEntry) XXX_Unmarshal

func (m *UnbondingDelegationEntry) XXX_Unmarshal(b []byte) error

type UserPreferences

type UserPreferences struct {
	// TrustNonAccreditedServices tells whether the user trusts all non-accredited
	// services present on the platform.
	TrustNonAccreditedServices bool `` /* 144-byte string literal not displayed */
	// TrustAccreditedServices tells whether the user trusts all accredited
	// services present on the platform.
	TrustAccreditedServices bool `` /* 133-byte string literal not displayed */
	// TrustedServicesIDs is a list of service IDs that the user trusts (both
	// accredited and non-accredited).
	TrustedServicesIDs []uint32 `protobuf:"varint,3,rep,packed,name=trusted_services_ids,json=trustedServicesIds,proto3" json:"trusted_services_ids,omitempty"`
}

UserPreferences is a struct that contains a user's preferences for restaking.

func (*UserPreferences) Descriptor

func (*UserPreferences) Descriptor() ([]byte, []int)

func (*UserPreferences) GetTrustAccreditedServices

func (m *UserPreferences) GetTrustAccreditedServices() bool

func (*UserPreferences) GetTrustNonAccreditedServices

func (m *UserPreferences) GetTrustNonAccreditedServices() bool

func (*UserPreferences) GetTrustedServicesIDs

func (m *UserPreferences) GetTrustedServicesIDs() []uint32

func (*UserPreferences) Marshal

func (m *UserPreferences) Marshal() (dAtA []byte, err error)

func (*UserPreferences) MarshalTo

func (m *UserPreferences) MarshalTo(dAtA []byte) (int, error)

func (*UserPreferences) MarshalToSizedBuffer

func (m *UserPreferences) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*UserPreferences) ProtoMessage

func (*UserPreferences) ProtoMessage()

func (*UserPreferences) Reset

func (m *UserPreferences) Reset()

func (*UserPreferences) Size

func (m *UserPreferences) Size() (n int)

func (*UserPreferences) String

func (m *UserPreferences) String() string

func (*UserPreferences) Unmarshal

func (m *UserPreferences) Unmarshal(dAtA []byte) error

func (*UserPreferences) XXX_DiscardUnknown

func (m *UserPreferences) XXX_DiscardUnknown()

func (*UserPreferences) XXX_Marshal

func (m *UserPreferences) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*UserPreferences) XXX_Merge

func (m *UserPreferences) XXX_Merge(src proto.Message)

func (*UserPreferences) XXX_Size

func (m *UserPreferences) XXX_Size() int

func (*UserPreferences) XXX_Unmarshal

func (m *UserPreferences) XXX_Unmarshal(b []byte) error

type UserPreferencesEntry

type UserPreferencesEntry struct {
	UserAddress string
	Preferences UserPreferences
}

UserPreferencesEntry represents a user preferences entry.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL