github.com/lino-network/lino@v0.6.11/x/vote/keeper.go (about)

     1  package vote
     2  
     3  //go:generate mockery -name VoteKeeper
     4  
     5  import (
     6  	codec "github.com/cosmos/cosmos-sdk/codec"
     7  	sdk "github.com/cosmos/cosmos-sdk/types"
     8  
     9  	linotypes "github.com/lino-network/lino/types"
    10  	votemn "github.com/lino-network/lino/x/vote/manager"
    11  	"github.com/lino-network/lino/x/vote/model"
    12  	"github.com/lino-network/lino/x/vote/types"
    13  )
    14  
    15  type VoteKeeper interface {
    16  	InitGenesis(ctx sdk.Context)
    17  	DoesVoterExist(ctx sdk.Context, username linotypes.AccountKey) bool
    18  	StakeIn(ctx sdk.Context, username linotypes.AccountKey, amount linotypes.Coin) sdk.Error
    19  	StakeOut(ctx sdk.Context, username linotypes.AccountKey, amount linotypes.Coin) sdk.Error
    20  	ClaimInterest(ctx sdk.Context, username linotypes.AccountKey) sdk.Error
    21  	GetVoterDuty(ctx sdk.Context, username linotypes.AccountKey) (types.VoterDuty, sdk.Error)
    22  	AssignDuty(
    23  		ctx sdk.Context, username linotypes.AccountKey, duty types.VoterDuty, frozenAmount linotypes.Coin) sdk.Error
    24  	// It's caller's duty to move coins from stake-in pool to the destination pool.
    25  	SlashStake(ctx sdk.Context, username linotypes.AccountKey, amount linotypes.Coin, destPool linotypes.PoolName) (linotypes.Coin, sdk.Error)
    26  	UnassignDuty(ctx sdk.Context, username linotypes.AccountKey, waitingPeriodSec int64) sdk.Error
    27  	ExecUnassignDutyEvent(ctx sdk.Context, event types.UnassignDutyEvent) sdk.Error
    28  	GetLinoStake(ctx sdk.Context, username linotypes.AccountKey) (linotypes.Coin, sdk.Error)
    29  	StakeInFor(ctx sdk.Context, sender linotypes.AccountKey, receiver linotypes.AccountKey, amount linotypes.Coin) sdk.Error
    30  	RecordFriction(ctx sdk.Context, friction linotypes.Coin) sdk.Error
    31  	DailyAdvanceLinoStakeStats(ctx sdk.Context) sdk.Error
    32  
    33  	// Getter
    34  	GetVoter(ctx sdk.Context, username linotypes.AccountKey) (*model.Voter, sdk.Error)
    35  	GetStakeStatsOfDay(ctx sdk.Context, day int64) (*model.LinoStakeStat, sdk.Error)
    36  
    37  	// import export
    38  	ExportToFile(ctx sdk.Context, cdc *codec.Codec, filepath string) error
    39  	ImportFromFile(ctx sdk.Context, cdc *codec.Codec, filepath string) error
    40  }
    41  
    42  var _ VoteKeeper = votemn.VoteManager{}