keeper

package
v0.0.0-...-1d4aedf Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

Types

type Distributor

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

func NewDistributor

func NewDistributor(keeper Keeper) Distributor

func (Distributor) Claim

func (d Distributor) Claim(ctx sdk.Context, veID uint64) error

func (Distributor) DistributePerPeriod

func (d Distributor) DistributePerPeriod(ctx sdk.Context)

type Emitter

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

func NewEmitter

func NewEmitter(keeper Keeper) Emitter

func (Emitter) AddTotalEmission

func (e Emitter) AddTotalEmission(ctx sdk.Context, emission sdk.Int)

func (Emitter) CirculationRate

func (e Emitter) CirculationRate(ctx sdk.Context) sdk.Dec

func (Emitter) CirculationSupply

func (e Emitter) CirculationSupply(ctx sdk.Context) sdk.Int

func (Emitter) Emission

func (e Emitter) Emission(ctx sdk.Context) sdk.Int

func (Emitter) EmissionCompensation

func (e Emitter) EmissionCompensation(ctx sdk.Context, emission sdk.Int) sdk.Int

func (Emitter) Emit

func (e Emitter) Emit(ctx sdk.Context) sdk.Int

Emit emits coin rewards of every period, on the basis of predefined emission policy. The part of compensation for ve holders will be sent into the distribution pool. The remaining will be deposited as rewards by the voter module.

type Keeper

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

Keeper defines the ve module interface

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey,
	memKey sdk.StoreKey,
	ps paramtypes.Subspace,
	accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	nftKeeper types.NftKeeper,
) *Keeper

NewKeeper creates a new ve Keeper instance

func (Keeper) AddTotalEmission

func (k Keeper) AddTotalEmission(ctx sdk.Context, emission sdk.Int)

func (Keeper) CheckVeAttached

func (k Keeper) CheckVeAttached(ctx sdk.Context, veID uint64) error

CheckVeAttached checks whether the ve has attached/voted

func (Keeper) DecVeAttached

func (k Keeper) DecVeAttached(ctx sdk.Context, veID uint64)

DecVeAttached decreases one for attached times of ve

func (Keeper) DeleteLockedAmountByUser

func (k Keeper) DeleteLockedAmountByUser(ctx sdk.Context, veID uint64)

DeleteLockedAmountByUser deletes locked amount of the specified ve

func (Keeper) DepositFor

func (k Keeper) DepositFor(ctx sdk.Context, sender sdk.AccAddress, veID uint64, amount sdk.Int, unlockTime uint64, locked types.LockedBalance, sendCoins bool) error

DepositFor deposits some more amount and/or update locking end time for a veNFT.

	 veID: must be valid ve id
  amount: locked amount to add; can be zero if no more amount to deposit
  unlockTime: when unlocking; can be zero if no need to update
  locked: existing locked; may be zero if no existing locked
  sendCoins: false when extend time or merge

func (Keeper) GetCheckpoint

func (k Keeper) GetCheckpoint(ctx sdk.Context, epoch uint64) types.Checkpoint

func (Keeper) GetDistributionAccruedLastTimestamp

func (k Keeper) GetDistributionAccruedLastTimestamp(ctx sdk.Context) uint64

func (Keeper) GetDistributionClaimLastTimestampByUser

func (k Keeper) GetDistributionClaimLastTimestampByUser(ctx sdk.Context, veID uint64) uint64

func (Keeper) GetDistributionPerPeriod

func (k Keeper) GetDistributionPerPeriod(ctx sdk.Context, timestamp uint64) sdk.Int

func (Keeper) GetDistributionTotalAmount

func (k Keeper) GetDistributionTotalAmount(ctx sdk.Context) sdk.Int

func (Keeper) GetEmissionAtLastPeriod

func (k Keeper) GetEmissionAtLastPeriod(ctx sdk.Context) sdk.Int

func (Keeper) GetEmissionLastTimestamp

func (k Keeper) GetEmissionLastTimestamp(ctx sdk.Context) uint64

func (Keeper) GetEpoch

func (k Keeper) GetEpoch(ctx sdk.Context) uint64

func (Keeper) GetLockedAmountByUser

func (k Keeper) GetLockedAmountByUser(ctx sdk.Context, veID uint64) types.LockedBalance

GetLockedAmountByUser Gets locked amount of the specified ve

func (Keeper) GetNextVeID

func (k Keeper) GetNextVeID(ctx sdk.Context) uint64

GetNextVeID gets the next ID for creating new ve

func (Keeper) GetParams

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

GetParams get all parameters as types.Params

func (Keeper) GetSlopeChange

func (k Keeper) GetSlopeChange(ctx sdk.Context, timestamp uint64) sdk.Int

func (Keeper) GetTotalEmission

func (k Keeper) GetTotalEmission(ctx sdk.Context) sdk.Int

func (Keeper) GetTotalLockedAmount

func (k Keeper) GetTotalLockedAmount(ctx sdk.Context) sdk.Int

GetTotalLockedAmount gets total locked amount

func (Keeper) GetTotalVotingPower

func (k Keeper) GetTotalVotingPower(ctx sdk.Context, atTime uint64, atBlock int64) sdk.Int

func (Keeper) GetUserCheckpoint

func (k Keeper) GetUserCheckpoint(ctx sdk.Context, veID uint64, epoch uint64) types.Checkpoint

func (Keeper) GetUserEpoch

func (k Keeper) GetUserEpoch(ctx sdk.Context, veID uint64) uint64

func (Keeper) GetVeAttached

func (k Keeper) GetVeAttached(ctx sdk.Context, veID uint64) uint64

GetVeAttached gets the attached times of ve

func (Keeper) GetVeVoted

func (k Keeper) GetVeVoted(ctx sdk.Context, veID uint64) bool

GetVeVoted gets whether the ve has voted

func (Keeper) GetVotingPower

func (k Keeper) GetVotingPower(ctx sdk.Context, veID uint64, atTime uint64, atBlock int64) sdk.Int

func (Keeper) HasNftClass

func (k Keeper) HasNftClass(ctx sdk.Context) bool

HasNftClass determines whether the NFT class of ve exist

func (Keeper) IncVeAttached

func (k Keeper) IncVeAttached(ctx sdk.Context, veID uint64)

IncVeAttached increases one for attached times of ve

func (Keeper) LockDenom

func (k Keeper) LockDenom(ctx sdk.Context) (res string)

func (Keeper) Logger

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

func (Keeper) Params

func (Keeper) RegulateCheckpoint

func (k Keeper) RegulateCheckpoint(ctx sdk.Context)

func (Keeper) RegulateUserCheckpoint

func (k Keeper) RegulateUserCheckpoint(ctx sdk.Context, veID uint64, lockedOld types.LockedBalance, lockedNew types.LockedBalance)

RegulateUserCheckpoint regulates user checkpoint. veID: must be valid ve id lockedOld:

Amount: can be zero
End: can be expired or zero

lockedNew:

Amount: can be zero
End: must be in the future or be zero

func (Keeper) SaveNftClass

func (k Keeper) SaveNftClass(ctx sdk.Context) error

SaveNftClass saves the NFT class of ve into the nft module

func (Keeper) SetCheckpoint

func (k Keeper) SetCheckpoint(ctx sdk.Context, epoch uint64, point types.Checkpoint)

func (Keeper) SetDistributionAccruedLastTimestamp

func (k Keeper) SetDistributionAccruedLastTimestamp(ctx sdk.Context, timestamp uint64)

func (Keeper) SetDistributionClaimLastTimestampByUser

func (k Keeper) SetDistributionClaimLastTimestampByUser(ctx sdk.Context, veID uint64, timestamp uint64)

func (Keeper) SetDistributionPerPeriod

func (k Keeper) SetDistributionPerPeriod(ctx sdk.Context, timestamp uint64, amount sdk.Int)

func (Keeper) SetDistributionTotalAmount

func (k Keeper) SetDistributionTotalAmount(ctx sdk.Context, total sdk.Int)

func (Keeper) SetEmissionAtLastPeriod

func (k Keeper) SetEmissionAtLastPeriod(ctx sdk.Context, emission sdk.Int)

func (Keeper) SetEmissionLastTimestamp

func (k Keeper) SetEmissionLastTimestamp(ctx sdk.Context, timestamp uint64)

func (Keeper) SetEpoch

func (k Keeper) SetEpoch(ctx sdk.Context, epoch uint64)

func (Keeper) SetGetDelegatedAmountByUser

func (k Keeper) SetGetDelegatedAmountByUser(getDelegatedAmount func(ctx sdk.Context, veID uint64) sdk.Int)

func (Keeper) SetLockedAmountByUser

func (k Keeper) SetLockedAmountByUser(ctx sdk.Context, veID uint64, amount types.LockedBalance)

SetLockedAmountByUser sets locked amount of the specified ve

func (Keeper) SetNextVeID

func (k Keeper) SetNextVeID(ctx sdk.Context, nextVeID uint64)

SetNextVeID sets the next ID for creating new ve

func (Keeper) SetParams

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

SetParams set the params

func (Keeper) SetSlopeChange

func (k Keeper) SetSlopeChange(ctx sdk.Context, timestamp uint64, slopeChange sdk.Int)

func (Keeper) SetTotalEmission

func (k Keeper) SetTotalEmission(ctx sdk.Context, total sdk.Int)

func (Keeper) SetTotalLockedAmount

func (k Keeper) SetTotalLockedAmount(ctx sdk.Context, amount sdk.Int)

SetTotalLockedAmount sets total locked amount

func (Keeper) SetUserCheckpoint

func (k Keeper) SetUserCheckpoint(ctx sdk.Context, veID uint64, epoch uint64, point types.Checkpoint)

func (Keeper) SetUserEpoch

func (k Keeper) SetUserEpoch(ctx sdk.Context, veID uint64, epoch uint64)

func (Keeper) SetVeAttached

func (k Keeper) SetVeAttached(ctx sdk.Context, veID uint64, attached uint64)

SetVeAttached sets the attached times of ve

func (Keeper) SetVeVoted

func (k Keeper) SetVeVoted(ctx sdk.Context, veID uint64, voted bool)

SetVeVoted sets whether the ve has voted

func (Keeper) SlashLockedAmountByUser

func (k Keeper) SlashLockedAmountByUser(ctx sdk.Context, veID uint64, amount sdk.Int)

func (Keeper) VeNft

func (Keeper) VeNfts

type NftAppModule

type NftAppModule struct {
	nft.AppModule
	// contains filtered or unexported fields
}

func NewNftAppModule

func NewNftAppModule(module nft.AppModule, keeper NftKeeper) NftAppModule

func (NftAppModule) RegisterServices

func (am NftAppModule) RegisterServices(cfg module.Configurator)

type NftKeeper

type NftKeeper struct {
	nftkeeper.Keeper
	// contains filtered or unexported fields
}

func NewNftKeeper

func NewNftKeeper(keeper nftkeeper.Keeper, veKeeper func() Keeper) NftKeeper

func (NftKeeper) Send

Send implement Send method of the types.MsgServer of the nft module. Here we customize it with checking whether the ve NFT has been attached.

Jump to

Keyboard shortcuts

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