keeper

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueryOperator  = "operator"
	QueryOperators = "operators"
	QueryWithdraws = "withdraws"
	QueryTask      = "task"
	QueryResponse  = "response"
)

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

func NewQuerier

func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier

NewQuerier is the module level router for state queries.

Types

type Keeper

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

func NewKeeper

func NewKeeper(cdc codec.BinaryMarshaler, storeKey sdk.StoreKey, authKeeper types.AccountKeeper, distriKeeper types.DistrKeeper,
	stakingKeeper types.StakingKeeper, bankKeeper types.BankKeeper, paramSpace types.ParamSubspace) Keeper

func (Keeper) AddCollateral

func (k Keeper) AddCollateral(ctx sdk.Context, address sdk.AccAddress, increment sdk.Coins) error

AddCollateral increases an operator's collateral, effective immediately.

func (Keeper) AddReward

func (k Keeper) AddReward(ctx sdk.Context, address sdk.AccAddress, increment sdk.Coins) error

AddReward increases an operators accumulated rewards.

func (Keeper) AddTotalCollateral

func (k Keeper) AddTotalCollateral(ctx sdk.Context, increment sdk.Coins) error

AddTotalCollateral increases total collateral.

func (Keeper) Aggregate

func (k Keeper) Aggregate(ctx sdk.Context, contract, function string) error

Aggregate does an aggregation of responses for a task and updated task result.

func (Keeper) CollectBounty

func (k Keeper) CollectBounty(ctx sdk.Context, value sdk.Coins, creator sdk.AccAddress) error

CollectBounty collects task bounty from the operator.

func (Keeper) CreateOperator

func (k Keeper) CreateOperator(ctx sdk.Context, address sdk.AccAddress, collateral sdk.Coins, proposer sdk.AccAddress, name string) error

CreateOperator creates an operator and deposits collateral.

func (Keeper) CreateTask

func (k Keeper) CreateTask(ctx sdk.Context, contract string, function string, bounty sdk.Coins,
	description string, expiration time.Time, creator sdk.AccAddress, waitingBlocks int64) error

CreateTask creates a new task.

func (Keeper) CreateWithdraw

func (k Keeper) CreateWithdraw(ctx sdk.Context, address sdk.AccAddress, amount sdk.Coins) error

CreateWithdraw creates a withdrawal.

func (Keeper) DeleteClosingTaskIDs

func (k Keeper) DeleteClosingTaskIDs(ctx sdk.Context, closingBlock int64)

DeleteClosingTaskIDs deletes stores for task IDs closed at given block.

func (Keeper) DeleteOperator

func (k Keeper) DeleteOperator(ctx sdk.Context, address sdk.AccAddress) error

DeleteOperators deletes an operator from store.

func (Keeper) DeleteTask

func (k Keeper) DeleteTask(ctx sdk.Context, task types.Task) error

DeleteTask deletes a task from KVStore.

func (Keeper) DeleteWithdraw

func (k Keeper) DeleteWithdraw(ctx sdk.Context, address sdk.AccAddress, startTime int64) error

DeleteWithdraw deletes a withdrawal from store.

func (Keeper) DistributeBounty

func (k Keeper) DistributeBounty(ctx sdk.Context, task types.Task) error

DistributeBounty distributes bounty to operators based on responses and the aggregation result.

func (Keeper) FinalizeMatureWithdraws

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

FinalizeMatureWithdraws finishes mature (unlocked) withdrawals and removes them.

func (Keeper) FundCommunityPool

func (k Keeper) FundCommunityPool(ctx sdk.Context, amount sdk.Coins) error

FundCommunityPool transfers money from module account to community pool.

func (Keeper) GetAccountKeeper

func (k Keeper) GetAccountKeeper() types.AccountKeeper

GetAccountKeeper returns the auth keeper wrapped in module keeper.

func (Keeper) GetAllOperators

func (k Keeper) GetAllOperators(ctx sdk.Context) types.Operators

GetAllOperators gets all operators.

func (Keeper) GetAllTasks

func (k Keeper) GetAllTasks(ctx sdk.Context) (tasks []types.Task)

GetAllTasks gets all tasks.

func (Keeper) GetAllWithdraws

func (k Keeper) GetAllWithdraws(ctx sdk.Context) types.Withdraws

GetAllWithdraws gets all withdrawals from store.

func (Keeper) GetAllWithdrawsForExport

func (k Keeper) GetAllWithdrawsForExport(ctx sdk.Context) types.Withdraws

GetAllWithdrawsForExport gets all withdrawals from store and adjusts DueBlock value for import-export.

func (Keeper) GetClosingTaskIDs

func (k Keeper) GetClosingTaskIDs(ctx sdk.Context, closingBlock int64) []types.TaskID

GetClosingTaskIDs returns a list of task IDs by the closing block.

func (Keeper) GetCollateralAmount

func (k Keeper) GetCollateralAmount(ctx sdk.Context, address sdk.AccAddress) (sdk.Int, error)

GetCollateralAmount gets an operator's collateral.

func (Keeper) GetLockedPoolParams

func (k Keeper) GetLockedPoolParams(ctx sdk.Context) types.LockedPoolParams

GetLockedPoolParams gets the current locked pool params from the global param store.

func (Keeper) GetOperator

func (k Keeper) GetOperator(ctx sdk.Context, address sdk.AccAddress) (types.Operator, error)

GetOperator gets an operator from store.

func (Keeper) GetTask

func (k Keeper) GetTask(ctx sdk.Context, contract, function string) (types.Task, error)

GetTask returns a task given contract and function.

func (Keeper) GetTaskParams

func (k Keeper) GetTaskParams(ctx sdk.Context) types.TaskParams

GetTaskParams gets the current task params from the global param store.

func (Keeper) GetTotalCollateral

func (k Keeper) GetTotalCollateral(ctx sdk.Context) (sdk.Coins, error)

GetTotalCollateral gets total collateral from store.

func (Keeper) IsBelowMinCollateral

func (k Keeper) IsBelowMinCollateral(ctx sdk.Context, currentCollateral sdk.Coins) bool

IsBelowMinCollateral determines if collateral is below the minimum requirement.

func (Keeper) IsOperator

func (k Keeper) IsOperator(ctx sdk.Context, address sdk.AccAddress) bool

IsOperator determines if an address belongs to an operator.

func (Keeper) IsValidResponse

func (k Keeper) IsValidResponse(ctx sdk.Context, task types.Task, response types.Response) error

IsValidResponse returns error if a response is not valid.

func (Keeper) IterateAllOperators

func (k Keeper) IterateAllOperators(ctx sdk.Context, callback func(operator types.Operator) (stop bool))

IterateAllOperators iterates all operators.

func (Keeper) IterateAllWithdraws

func (k Keeper) IterateAllWithdraws(ctx sdk.Context, callback func(withdraw types.Withdraw) (stop bool))

IterateAllWithdraws iterates all withdrawals in store.

func (Keeper) IterateMatureWithdraws

func (k Keeper) IterateMatureWithdraws(ctx sdk.Context, callback func(withdraw types.Withdraw) (stop bool))

IterateMatureWithdraws iterates all mature (unlocked) withdrawals in store.

func (Keeper) IteratorAllTasks

func (k Keeper) IteratorAllTasks(ctx sdk.Context, callback func(task types.Task) (stop bool))

IteratorAllTasks iterates over all the stored tasks and performs a callback function.

func (Keeper) Operator

Operator queries an operator based on its address.

func (Keeper) Operators

Operators queries all operators.

func (Keeper) ReduceCollateral

func (k Keeper) ReduceCollateral(ctx sdk.Context, address sdk.AccAddress, decrement sdk.Coins) error

ReduceCollateral reduces an operator's collateral and creates a withdrawal for it.

func (Keeper) ReduceTotalCollateral

func (k Keeper) ReduceTotalCollateral(ctx sdk.Context, decrement sdk.Coins) error

ReduceTotalCollateral reduces total collateral.

func (Keeper) RemoveOperator

func (k Keeper) RemoveOperator(ctx sdk.Context, address sdk.AccAddress) error

RemoveOperator removes an operator, creates an withdrawal for collateral and gives back rewards immediately.

func (Keeper) RemoveTask

func (k Keeper) RemoveTask(ctx sdk.Context, contract, function string, force bool, creator sdk.AccAddress) error

RemoveTask removes a task from kvstore if it is closed, expired and requested by its creator.

func (Keeper) RespondToTask

func (k Keeper) RespondToTask(ctx sdk.Context, contract string, function string, score int64, operatorAddress sdk.AccAddress) error

RespondToTask records the response from an operator for a task.

func (Keeper) Response

Response queries a response based on its task contract, task function, and operator address.

func (Keeper) SetClosingBlockStore

func (k Keeper) SetClosingBlockStore(ctx sdk.Context, task types.Task)

SetClosingBlockStore sets the store of the aggregation block for a task.

func (Keeper) SetLockedPoolParams

func (k Keeper) SetLockedPoolParams(ctx sdk.Context, poolParams types.LockedPoolParams)

SetLockedPoolParams sets the current locked pool params to the global param store.

func (Keeper) SetOperator

func (k Keeper) SetOperator(ctx sdk.Context, operator types.Operator)

SetOperator sets an operator to store.

func (Keeper) SetTask

func (k Keeper) SetTask(ctx sdk.Context, task types.Task)

SetTask sets a task in KVStore.

func (Keeper) SetTaskParams

func (k Keeper) SetTaskParams(ctx sdk.Context, taskParams types.TaskParams)

SetTaskParams sets the current task params to the global param store.

func (Keeper) SetTotalCollateral

func (k Keeper) SetTotalCollateral(ctx sdk.Context, collateral sdk.Coins)

SetTotalCollateral sets total collateral to store.

func (Keeper) SetWithdraw

func (k Keeper) SetWithdraw(ctx sdk.Context, withdraw types.Withdraw)

SetWithdraw sets a withdrawal in store.

func (Keeper) Task

Task queries a task given its contract and function.

func (Keeper) TotalValidTaskCollateral

func (k Keeper) TotalValidTaskCollateral(ctx sdk.Context, task types.Task) sdk.Int

TotalValidTaskCollateral calculates the total amount of valid collateral of a task.

func (Keeper) UpdateAndGetAllTasks

func (k Keeper) UpdateAndGetAllTasks(ctx sdk.Context) (tasks []types.Task)

UpdateAndGetAllTasks updates all tasks and returns them.

func (Keeper) UpdateAndSetTask

func (k Keeper) UpdateAndSetTask(ctx sdk.Context, task types.Task)

UpdateAndSetTask updates a task and set it in KVStore.

func (Keeper) WithdrawAllReward

func (k Keeper) WithdrawAllReward(ctx sdk.Context, address sdk.AccAddress) (sdk.Coins, error)

WithdrawAllReward gives back all rewards of an operator.

func (Keeper) Withdraws

Withdraws queries all withdraws.

Jump to

Keyboard shortcuts

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