keeper

package
v0.6.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// LockStartID is the ID of the first lock.
	LockStartID uint64 = 0
)

Variables

View Source
var (
	// MaxTime is the maximum golang time that can be represented.
	// It is a date so forward in the future that identifies a
	// lockup which did not yet start to unlock.
	// NOTE: this is not maximum golang time because, since we encode it
	// using timestampb.Timestamp under the hood we need to adhere to proto time
	// rules. Equivalent to: time.Date(9999, time.December, 31, 23, 59, 59, 0, time.UTC)
	MaxTime = time.Unix(253402297199, 0).UTC()
)

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an instance of MsgServer.

func NewQueryServerImpl added in v0.2.2

func NewQueryServerImpl(k Keeper) types.QueryServer

Types

type Keeper added in v0.2.2

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

Keeper provides a way to manage module storage.

func NewLockupKeeper

func NewLockupKeeper(cdc codec.Codec, storeKey sdk.StoreKey, ak types.AccountKeeper,
	bk types.BankKeeper, dk types.DistrKeeper) Keeper

NewLockupKeeper returns an instance of Keeper.

func (Keeper) AccountLockedCoins added in v0.2.2

func (k Keeper) AccountLockedCoins(ctx sdk.Context, account sdk.AccAddress) (coins sdk.Coins, err error)

AccountLockedCoins returns the locked coins of the given sdk.AccAddress

func (Keeper) AccountUnlockedCoins added in v0.2.2

func (k Keeper) AccountUnlockedCoins(ctx sdk.Context, account sdk.AccAddress) (coins sdk.Coins, err error)

AccountUnlockedCoins returns the unlocked coins of the given sdk.AccAddress

func (Keeper) InitiateUnlocking added in v0.2.2

func (k Keeper) InitiateUnlocking(ctx sdk.Context, lockID uint64) (updatedLock *types.Lock, err error)

InitiateUnlocking starts the unlocking process of a lockup.

func (Keeper) LockTokens added in v0.2.2

func (k Keeper) LockTokens(ctx sdk.Context, owner sdk.AccAddress,
	coins sdk.Coins, duration time.Duration) (*types.Lock, error)

LockTokens lock tokens from an account for specified duration.

func (Keeper) LocksByDenom added in v0.2.2

func (k Keeper) LocksByDenom(ctx sdk.Context, do func(lock *types.Lock) (stop bool)) (coins sdk.Coins, err error)

LocksByDenom allows to iterate over types.Lock associated with a denom. CONTRACT: no writes on store can happen until the function exits.

func (Keeper) LocksByDenomUnlockingAfter added in v0.2.2

func (k Keeper) LocksByDenomUnlockingAfter(ctx sdk.Context, denom string, duration time.Duration, do func(lock *types.Lock) (stop bool))

LocksByDenomUnlockingAfter allows to iterate over types.Lock associated with a denom that unlock after the provided duration. CONTRACT: no writes on store can happen until the function exits.

func (Keeper) LocksState added in v0.2.2

func (k Keeper) LocksState(ctx sdk.Context) LockState

func (Keeper) Logger added in v0.2.2

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

Logger returns a logger instance.

func (Keeper) TotalLockedCoins added in v0.2.2

func (k Keeper) TotalLockedCoins(ctx sdk.Context) (coins sdk.Coins, err error)

TotalLockedCoins returns the module account locked coins.

func (Keeper) UnlockAvailableCoins added in v0.2.2

func (k Keeper) UnlockAvailableCoins(ctx sdk.Context, account sdk.AccAddress) (coins sdk.Coins, err error)

UnlockAvailableCoins unlocks all the available coins for the provided account sdk.AccAddress.

func (Keeper) UnlockTokens added in v0.2.2

func (k Keeper) UnlockTokens(ctx sdk.Context, lockID uint64) (unlockedTokens sdk.Coins, err error)

UnlockTokens returns tokens back from the module account address to the lock owner. The ID associated with the lock must exist, and the current block time must be after lock end time.

type LockState

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

func (LockState) Create

func (s LockState) Create(l *types.Lock)

Create creates a new types.Lock, and sets the lock ID.

func (LockState) Delete

func (s LockState) Delete(l *types.Lock) error

func (LockState) Get

func (s LockState) Get(id uint64) (*types.Lock, error)

func (LockState) IterateCoinsByDenomUnlockingAfter added in v0.1.0

func (s LockState) IterateCoinsByDenomUnlockingAfter(denom string, unlockingAfter time.Time, f func(id uint64) (stop bool))

func (LockState) IterateCoinsByDenomUnlockingBefore added in v0.1.0

func (s LockState) IterateCoinsByDenomUnlockingBefore(denom string, unlockingBefore time.Time, f func(id uint64) (stop bool))

func (LockState) IterateLockedCoins

func (s LockState) IterateLockedCoins(addr sdk.AccAddress) sdk.Coins

func (LockState) IterateLocks added in v0.2.6

func (s LockState) IterateLocks(do func(lock *types.Lock) (stop bool))

func (LockState) IterateLocksByAddress added in v0.2.2

func (s LockState) IterateLocksByAddress(addr sdk.AccAddress, do func(id uint64) (stop bool))

func (LockState) IterateTotalLockedCoins

func (s LockState) IterateTotalLockedCoins() sdk.Coins

IterateTotalLockedCoins returns the total amount of locked coins

func (LockState) IterateUnlockedCoins

func (s LockState) IterateUnlockedCoins(addr sdk.AccAddress) sdk.Coins

func (LockState) UnlockedIDsByAddress

func (s LockState) UnlockedIDsByAddress(addr sdk.AccAddress) []uint64

UnlockedIDsByAddress returns the list of types.Lock IDs which can be unlocked given the lock owner sdk.AccAddress.

func (LockState) Update added in v0.1.0

func (s LockState) Update(update *types.Lock) error

Jump to

Keyboard shortcuts

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