Documentation ¶
Index ¶
- Constants
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
- type Keeper
- func (k Keeper) AddCollateral(ctx sdk.Context, address sdk.AccAddress, increment sdk.Coins) error
- func (k Keeper) AddReward(ctx sdk.Context, address sdk.AccAddress, increment sdk.Coins) error
- func (k Keeper) AddTotalCollateral(ctx sdk.Context, increment sdk.Coins) error
- func (k Keeper) Aggregate(ctx sdk.Context, contract, function string) error
- func (k Keeper) CollectBounty(ctx sdk.Context, value sdk.Coins, creator sdk.AccAddress) error
- func (k Keeper) CreateOperator(ctx sdk.Context, address sdk.AccAddress, collateral sdk.Coins, ...) error
- func (k Keeper) CreateTask(ctx sdk.Context, contract string, function string, bounty sdk.Coins, ...) error
- func (k Keeper) CreateWithdraw(ctx sdk.Context, address sdk.AccAddress, amount sdk.Coins) error
- func (k Keeper) DeleteClosingTaskIDs(ctx sdk.Context, closingBlock int64)
- func (k Keeper) DeleteOperator(ctx sdk.Context, address sdk.AccAddress) error
- func (k Keeper) DeleteTask(ctx sdk.Context, task types.Task) error
- func (k Keeper) DeleteWithdraw(ctx sdk.Context, address sdk.AccAddress, startTime int64) error
- func (k Keeper) DistributeBounty(ctx sdk.Context, task types.Task) error
- func (k Keeper) FinalizeMatureWithdraws(ctx sdk.Context)
- func (k Keeper) FundCommunityPool(ctx sdk.Context, amount sdk.Coins) error
- func (k Keeper) GetAccountKeeper() types.AccountKeeper
- func (k Keeper) GetAllOperators(ctx sdk.Context) types.Operators
- func (k Keeper) GetAllTasks(ctx sdk.Context) (tasks []types.Task)
- func (k Keeper) GetAllWithdraws(ctx sdk.Context) types.Withdraws
- func (k Keeper) GetAllWithdrawsForExport(ctx sdk.Context) types.Withdraws
- func (k Keeper) GetClosingTaskIDs(ctx sdk.Context, closingBlock int64) []types.TaskID
- func (k Keeper) GetCollateralAmount(ctx sdk.Context, address sdk.AccAddress) (sdk.Int, error)
- func (k Keeper) GetLockedPoolParams(ctx sdk.Context) types.LockedPoolParams
- func (k Keeper) GetOperator(ctx sdk.Context, address sdk.AccAddress) (types.Operator, error)
- func (k Keeper) GetTask(ctx sdk.Context, contract, function string) (types.Task, error)
- func (k Keeper) GetTaskParams(ctx sdk.Context) types.TaskParams
- func (k Keeper) GetTotalCollateral(ctx sdk.Context) (sdk.Coins, error)
- func (k Keeper) IsBelowMinCollateral(ctx sdk.Context, currentCollateral sdk.Coins) bool
- func (k Keeper) IsOperator(ctx sdk.Context, address sdk.AccAddress) bool
- func (k Keeper) IsValidResponse(ctx sdk.Context, task types.Task, response types.Response) error
- func (k Keeper) IterateAllOperators(ctx sdk.Context, callback func(operator types.Operator) (stop bool))
- func (k Keeper) IterateAllWithdraws(ctx sdk.Context, callback func(withdraw types.Withdraw) (stop bool))
- func (k Keeper) IterateMatureWithdraws(ctx sdk.Context, callback func(withdraw types.Withdraw) (stop bool))
- func (k Keeper) IteratorAllTasks(ctx sdk.Context, callback func(task types.Task) (stop bool))
- func (q Keeper) Operator(c context.Context, req *types.QueryOperatorRequest) (*types.QueryOperatorResponse, error)
- func (q Keeper) Operators(c context.Context, req *types.QueryOperatorsRequest) (*types.QueryOperatorsResponse, error)
- func (k Keeper) ReduceCollateral(ctx sdk.Context, address sdk.AccAddress, decrement sdk.Coins) error
- func (k Keeper) ReduceTotalCollateral(ctx sdk.Context, decrement sdk.Coins) error
- func (k Keeper) RemoveOperator(ctx sdk.Context, address sdk.AccAddress) error
- func (k Keeper) RemoveTask(ctx sdk.Context, contract, function string, force bool, creator sdk.AccAddress) error
- func (k Keeper) RespondToTask(ctx sdk.Context, contract string, function string, score int64, ...) error
- func (q Keeper) Response(c context.Context, req *types.QueryResponseRequest) (*types.QueryResponseResponse, error)
- func (k Keeper) SetClosingBlockStore(ctx sdk.Context, task types.Task)
- func (k Keeper) SetLockedPoolParams(ctx sdk.Context, poolParams types.LockedPoolParams)
- func (k Keeper) SetOperator(ctx sdk.Context, operator types.Operator)
- func (k Keeper) SetTask(ctx sdk.Context, task types.Task)
- func (k Keeper) SetTaskParams(ctx sdk.Context, taskParams types.TaskParams)
- func (k Keeper) SetTotalCollateral(ctx sdk.Context, collateral sdk.Coins)
- func (k Keeper) SetWithdraw(ctx sdk.Context, withdraw types.Withdraw)
- func (q Keeper) Task(c context.Context, req *types.QueryTaskRequest) (*types.QueryTaskResponse, error)
- func (k Keeper) TotalValidTaskCollateral(ctx sdk.Context, task types.Task) sdk.Int
- func (k Keeper) UpdateAndGetAllTasks(ctx sdk.Context) (tasks []types.Task)
- func (k Keeper) UpdateAndSetTask(ctx sdk.Context, task types.Task)
- func (k Keeper) WithdrawAllReward(ctx sdk.Context, address sdk.AccAddress) (sdk.Coins, error)
- func (q Keeper) Withdraws(c context.Context, req *types.QueryWithdrawsRequest) (*types.QueryWithdrawsResponse, error)
Constants ¶
const ( QueryOperator = "operator" QueryOperators = "operators" QueryWithdraws = "withdraws" QueryTask = "task" QueryResponse = "response" )
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
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 ¶
AddCollateral increases an operator's collateral, effective immediately.
func (Keeper) AddTotalCollateral ¶
AddTotalCollateral increases total collateral.
func (Keeper) Aggregate ¶
Aggregate does an aggregation of responses for a task and updated task result.
func (Keeper) CollectBounty ¶
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 ¶
CreateWithdraw creates a withdrawal.
func (Keeper) DeleteClosingTaskIDs ¶
DeleteClosingTaskIDs deletes stores for task IDs closed at given block.
func (Keeper) DeleteOperator ¶
DeleteOperators deletes an operator from store.
func (Keeper) DeleteTask ¶
DeleteTask deletes a task from KVStore.
func (Keeper) DeleteWithdraw ¶
DeleteWithdraw deletes a withdrawal from store.
func (Keeper) DistributeBounty ¶
DistributeBounty distributes bounty to operators based on responses and the aggregation result.
func (Keeper) FinalizeMatureWithdraws ¶
FinalizeMatureWithdraws finishes mature (unlocked) withdrawals and removes them.
func (Keeper) FundCommunityPool ¶
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 ¶
GetAllOperators gets all operators.
func (Keeper) GetAllTasks ¶
GetAllTasks gets all tasks.
func (Keeper) GetAllWithdraws ¶
GetAllWithdraws gets all withdrawals from store.
func (Keeper) GetAllWithdrawsForExport ¶
GetAllWithdrawsForExport gets all withdrawals from store and adjusts DueBlock value for import-export.
func (Keeper) GetClosingTaskIDs ¶
GetClosingTaskIDs returns a list of task IDs by the closing block.
func (Keeper) GetCollateralAmount ¶
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 ¶
GetOperator gets an operator from store.
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 ¶
GetTotalCollateral gets total collateral from store.
func (Keeper) IsBelowMinCollateral ¶
IsBelowMinCollateral determines if collateral is below the minimum requirement.
func (Keeper) IsOperator ¶
IsOperator determines if an address belongs to an operator.
func (Keeper) IsValidResponse ¶
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 ¶
IteratorAllTasks iterates over all the stored tasks and performs a callback function.
func (Keeper) Operator ¶
func (q Keeper) Operator(c context.Context, req *types.QueryOperatorRequest) (*types.QueryOperatorResponse, error)
Operator queries an operator based on its address.
func (Keeper) Operators ¶
func (q Keeper) Operators(c context.Context, req *types.QueryOperatorsRequest) (*types.QueryOperatorsResponse, error)
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 ¶
ReduceTotalCollateral reduces total collateral.
func (Keeper) RemoveOperator ¶
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 ¶
func (q Keeper) Response(c context.Context, req *types.QueryResponseRequest) (*types.QueryResponseResponse, error)
Response queries a response based on its task contract, task function, and operator address.
func (Keeper) SetClosingBlockStore ¶
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 ¶
SetOperator sets an operator to store.
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 ¶
SetTotalCollateral sets total collateral to store.
func (Keeper) SetWithdraw ¶
SetWithdraw sets a withdrawal in store.
func (Keeper) Task ¶
func (q Keeper) Task(c context.Context, req *types.QueryTaskRequest) (*types.QueryTaskResponse, error)
Task queries a task given its contract and function.
func (Keeper) TotalValidTaskCollateral ¶
TotalValidTaskCollateral calculates the total amount of valid collateral of a task.
func (Keeper) UpdateAndGetAllTasks ¶
UpdateAndGetAllTasks updates all tasks and returns them.
func (Keeper) UpdateAndSetTask ¶
UpdateAndSetTask updates a task and set it in KVStore.
func (Keeper) WithdrawAllReward ¶
WithdrawAllReward gives back all rewards of an operator.
func (Keeper) Withdraws ¶
func (q Keeper) Withdraws(c context.Context, req *types.QueryWithdrawsRequest) (*types.QueryWithdrawsResponse, error)
Withdraws queries all withdraws.