types

package
v0.34.1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleName = "lien"

	StoreKey = ModuleName
)

Variables

View Source
var (
	ErrInvalidLengthGenesis        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGenesis          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthLien        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowLien          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupLien = fmt.Errorf("proto: unexpected end of group")
)
View Source
var DefaultAccountWrapper = AccountWrapper{
	Wrap:   identWrap,
	Unwrap: identWrap,
}

DefaultAccountWrapper is an AccountWrapper that does nothing.

Functions

func LienByAddressDecodeKey

func LienByAddressDecodeKey(key []byte) sdk.AccAddress

LienByAddressDecodeKey returns the address for the lien lookup key.

func LienByAddressKey

func LienByAddressKey(addr sdk.AccAddress) []byte

LienByAddressKey returns the lien lookup key for the addr.

Types

type AccountLien

type AccountLien struct {
	// Account address, bech32-encoded.
	Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	// The liened amount. Should be nonzero.
	Lien *Lien `protobuf:"bytes,2,opt,name=lien,proto3" json:"lien,omitempty"`
}

The lien on a particular account

func (*AccountLien) Descriptor

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

func (*AccountLien) GetAddress

func (m *AccountLien) GetAddress() string

func (*AccountLien) GetLien

func (m *AccountLien) GetLien() *Lien

func (*AccountLien) Marshal

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

func (*AccountLien) MarshalTo

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

func (*AccountLien) MarshalToSizedBuffer

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

func (*AccountLien) ProtoMessage

func (*AccountLien) ProtoMessage()

func (*AccountLien) Reset

func (m *AccountLien) Reset()

func (*AccountLien) Size

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

func (*AccountLien) String

func (m *AccountLien) String() string

func (*AccountLien) Unmarshal

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

func (*AccountLien) XXX_DiscardUnknown

func (m *AccountLien) XXX_DiscardUnknown()

func (*AccountLien) XXX_Marshal

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

func (*AccountLien) XXX_Merge

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

func (*AccountLien) XXX_Size

func (m *AccountLien) XXX_Size() int

func (*AccountLien) XXX_Unmarshal

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

type AccountState

type AccountState struct {
	Total     sdk.Coins `json:"total"`
	Bonded    sdk.Coins `json:"bonded"`
	Unbonding sdk.Coins `json:"unbonding"`
	Locked    sdk.Coins `json:"locked"`
	Liened    sdk.Coins `json:"liened"`
	Unvested  sdk.Coins `json:"unvested"`
}

AccountState represents the abstract state of an account. See ../spec/01_concepts.md for details.

func (AccountState) IsEqual

func (s AccountState) IsEqual(other AccountState) bool

IsEqual returns whether two AccountStates are equal. (Coins don't play nicely with equality (==) or reflect.DeepEqual().)

type AccountWrapper

type AccountWrapper struct {
	Wrap   func(sdk.Context, authtypes.AccountI) authtypes.AccountI
	Unwrap func(sdk.Context, authtypes.AccountI) authtypes.AccountI
}

AccountWrapper wraps/unwraps accounts. The Wrap and Unwrap functions map accounts to accounts.

type BankKeeper

type BankKeeper interface {
	GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
	GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin
}

type GenesisState

type GenesisState struct {
	Liens []AccountLien `protobuf:"bytes,1,rep,name=liens,proto3" json:"liens"`
}

The initial or exported state.

func (*GenesisState) Descriptor

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

func (*GenesisState) GetLiens

func (m *GenesisState) GetLiens() []AccountLien

func (*GenesisState) Marshal

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

func (*GenesisState) MarshalTo

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

func (*GenesisState) MarshalToSizedBuffer

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

func (*GenesisState) ProtoMessage

func (*GenesisState) ProtoMessage()

func (*GenesisState) Reset

func (m *GenesisState) Reset()

func (*GenesisState) Size

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

func (*GenesisState) String

func (m *GenesisState) String() string

func (*GenesisState) Unmarshal

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

func (*GenesisState) XXX_DiscardUnknown

func (m *GenesisState) XXX_DiscardUnknown()

func (*GenesisState) XXX_Marshal

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

func (*GenesisState) XXX_Merge

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

func (*GenesisState) XXX_Size

func (m *GenesisState) XXX_Size() int

func (*GenesisState) XXX_Unmarshal

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

type Lien

type Lien struct {
	// coins holds the amount liened
	Coins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins" yaml:"coins"`
	// delegated tracks the net amount delegated for non-vesting accounts,
	// or zero coins for vesting accounts.
	// (Vesting accounts have their own fields to track delegation.)
	Delegated github_com_cosmos_cosmos_sdk_types.Coins `` /* 132-byte string literal not displayed */
}

Lien contains the lien state of a particular account.

func (*Lien) Descriptor

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

func (*Lien) GetCoins

func (*Lien) GetDelegated

func (m *Lien) GetDelegated() github_com_cosmos_cosmos_sdk_types.Coins

func (*Lien) Marshal

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

func (*Lien) MarshalTo

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

func (*Lien) MarshalToSizedBuffer

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

func (*Lien) ProtoMessage

func (*Lien) ProtoMessage()

func (*Lien) Reset

func (m *Lien) Reset()

func (*Lien) Size

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

func (*Lien) String

func (m *Lien) String() string

func (*Lien) Unmarshal

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

func (*Lien) XXX_DiscardUnknown

func (m *Lien) XXX_DiscardUnknown()

func (*Lien) XXX_Marshal

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

func (*Lien) XXX_Merge

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

func (*Lien) XXX_Size

func (m *Lien) XXX_Size() int

func (*Lien) XXX_Unmarshal

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

type StakingKeeper

type StakingKeeper interface {
	BondDenom(ctx sdk.Context) string
	GetDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress, maxRetrieve uint16) []stakingTypes.Delegation
	GetUnbondingDelegations(ctx sdk.Context, delegator sdk.AccAddress, maxRetrieve uint16) []stakingTypes.UnbondingDelegation
	GetValidator(ctx sdk.Context, addr sdk.ValAddress) (stakingTypes.Validator, bool)
}

type WrappedAccountKeeper

type WrappedAccountKeeper struct {
	authkeeper.AccountKeeper
	AccountWrapper
}

WrappedAccountKeeper wraps an account AccountKeeper transform accounts when reading or writing accounts from/to storage. Applies the Wrap function when reading accounts from the store and applies the Unwrap function when writing them to the store.

Note that we do not wrap the Accounts() method since the returned accounts are serialized and sent in the GRPC response and we don't need to modify their behavior.

func NewWrappedAccountKeeper

func NewWrappedAccountKeeper(ak authkeeper.AccountKeeper) *WrappedAccountKeeper

NewWrappedAccountKeeper returns a WrappedAccountKeeper with the default (identity) wrapper.

func (*WrappedAccountKeeper) GetAccount

func (wak *WrappedAccountKeeper) GetAccount(ctx sdk.Context, address sdk.AccAddress) authtypes.AccountI

GetAccount implements AccountKeeper.GetAccount(). It calls the embedded AccountKeeper then Wraps the account.

func (*WrappedAccountKeeper) IterateAccounts

func (wak *WrappedAccountKeeper) IterateAccounts(ctx sdk.Context, cb func(account authtypes.AccountI) (stop bool))

IterateAccounts implements AccountKeeper.IterateAccounts(). It calls the embedded AccountKeeper but Wraps the retrieved accounts.

func (*WrappedAccountKeeper) SetAccount

func (wak *WrappedAccountKeeper) SetAccount(ctx sdk.Context, acc authtypes.AccountI)

SetAccount implements AccountKeeper.SetAccount(). It Unwraps the account then calls the embedded AccountKeeper.

func (*WrappedAccountKeeper) SetWrapper

func (wak *WrappedAccountKeeper) SetWrapper(aw AccountWrapper)

SetWrapper updates the AccountWrapper. We need to modify the wrapper after it's created for the planned use, since there is a circular dependency in the creation of the WrappedAccountKeeper and the lien.Keeper.

Jump to

Keyboard shortcuts

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