keeper

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureModuleAccountAndAccountDataNameRecord added in v1.16.0

func EnsureModuleAccountAndAccountDataNameRecord(ctx sdk.Context, accountK types.AccountKeeper, nameK types.NameKeeper) (err error)

EnsureModuleAccountAndAccountDataNameRecord makes sure that the attribute module account exists and that the account data name record exists, is restricted, and owned by the attribute module. An error is returned if any of that cannot be made to be the way we want it.

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the attribute MsgServer interface for the provided Keeper.

Types

type Handler

type Handler func(record types.Attribute) error

Handler is a name record handler function for use with IterateRecords.

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

Keeper defines the attribute module Keeper

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec, key storetypes.StoreKey, paramSpace paramtypes.Subspace,
	authKeeper types.AccountKeeper, nameKeeper types.NameKeeper,
) Keeper

NewKeeper returns an attribute keeper. It handles: - setting attributes against an account - removing attributes - scanning for existing attributes on an account

CONTRACT: the parameter Subspace must have the param key table already initialized

func (Keeper) AccountData added in v1.16.0

AccountData returns the accountdata for a specified account.

func (Keeper) AccountsByAttribute added in v1.15.0

func (k Keeper) AccountsByAttribute(ctx sdk.Context, name string) (addresses []sdk.AccAddress, err error)

AccountsByAttribute returns a list of sdk.AccAddress that have attribute name assigned

func (Keeper) Attribute

Attribute queries for a specific attribute

func (Keeper) AttributeAccounts added in v1.15.0

AttributeAccounts queries for all accounts that have a specific attribute

func (Keeper) Attributes

Attributes queries for all attributes on a specified account

func (Keeper) DecAttrNameAddressLookup added in v1.15.0

func (k Keeper) DecAttrNameAddressLookup(ctx sdk.Context, name string, addrBytes []byte)

DecAttrNameAddressLookup decrements the name to account lookups and removes value if decremented to 0

func (Keeper) DeleteAttribute

func (k Keeper) DeleteAttribute(ctx sdk.Context, addr string, name string, value *[]byte, owner sdk.AccAddress) error

DeleteAttribute removes attributes under the given account from the state store.

func (Keeper) DeleteExpiredAttributes added in v1.16.0

func (k Keeper) DeleteExpiredAttributes(ctx sdk.Context, limit int) int

DeleteExpiredAttributes find and delete expired attributes returns the total deleted limit sets the max amount to delete in a call, 0 for not limit

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis(ctx sdk.Context) (data *types.GenesisState)

ExportGenesis exports the current keeper state of the attribute module.

func (Keeper) GetAccountData added in v1.16.0

func (k Keeper) GetAccountData(ctx sdk.Context, addr string) (string, error)

GetAccountData gets the value of the special accountdata attribute for the given address.

func (Keeper) GetAllAttributes

func (k Keeper) GetAllAttributes(ctx sdk.Context, addr string) ([]types.Attribute, error)

GetAllAttributes gets all attributes for an address.

func (Keeper) GetAllAttributesAddr added in v1.16.0

func (k Keeper) GetAllAttributesAddr(ctx sdk.Context, addr []byte) ([]types.Attribute, error)

GetAllAttributesAddr gets all attributes for an AccAddress or MetadataAddress.

func (Keeper) GetAttributes

func (k Keeper) GetAttributes(ctx sdk.Context, addr string, name string) ([]types.Attribute, error)

GetAttributes gets all attributes with the given name from an account.

func (Keeper) GetMaxValueLength

func (k Keeper) GetMaxValueLength(ctx sdk.Context) (maxValueLength uint32)

GetMaxValueLength returns the current distribution community tax (or default if unset)

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams returns the total set of account parameters.

func (Keeper) IncAttrNameAddressLookup added in v1.15.0

func (k Keeper) IncAttrNameAddressLookup(ctx sdk.Context, name string, addrBytes []byte)

IncAttrNameAddressLookup increments the count of name to address lookups

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx sdk.Context, data *types.GenesisState)

InitGenesis creates the initial genesis state for the attribute module.

func (Keeper) IterateRecords

func (k Keeper) IterateRecords(ctx sdk.Context, prefix []byte, handle Handler) error

IterateRecords iterates over all the stored attribute records and passes them to a callback function.

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) Params

Params queries params of attribute module

func (Keeper) PurgeAttribute added in v1.15.0

func (k Keeper) PurgeAttribute(ctx sdk.Context, name string, owner sdk.AccAddress) error

PurgeAttribute removes attributes under the given account from the state store.

func (Keeper) Scan

Scan queries all attributes associated with a specified account that contain a particular suffix in their name.

func (Keeper) SetAccountData added in v1.16.0

func (k Keeper) SetAccountData(ctx sdk.Context, addr string, value string) error

SetAccountData sets/updates/deletes the value of the special accountdata attribute for a given address. An error is only returned if the account data cannot be set as requested.

func (Keeper) SetAttribute

func (k Keeper) SetAttribute(
	ctx sdk.Context, attr types.Attribute, owner sdk.AccAddress,
) error

SetAttribute stores an attribute under the given account. The attribute name must resolve to the given owner address.

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets the account parameters to the param space.

func (Keeper) UpdateAttribute added in v1.5.0

func (k Keeper) UpdateAttribute(ctx sdk.Context, originalAttribute types.Attribute, updateAttribute types.Attribute, owner sdk.AccAddress,
) error

UpdateAttribute updates an attribute under the given account. The attribute name must resolve to the given owner address and value must resolve to an existing attribute.

func (Keeper) UpdateAttributeExpiration added in v1.16.0

func (k Keeper) UpdateAttributeExpiration(ctx sdk.Context, updateAttribute types.Attribute, owner sdk.AccAddress,
) error

UpdateAttributeExpiration updates the expiration date on an attribute.

func (Keeper) ValidateExpirationDate added in v1.16.0

func (k Keeper) ValidateExpirationDate(ctx sdk.Context, attr types.Attribute) error

ValidateExpirationDate returns error if attribute has an expiration date that is in the past of current block time

type Migrator added in v1.7.0

type Migrator struct {
	// contains filtered or unexported fields
}

Migrator is a struct for handling in-place store migrations.

func NewMigrator added in v1.7.0

func NewMigrator(keeper Keeper) Migrator

NewMigrator returns a new Migrator.

Jump to

Keyboard shortcuts

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