Documentation ¶
Index ¶
- Constants
- func CalculateRewardAmount(reporterPower, reportsCount, totalPower uint64, reward math.Int) reportertypes.BigUint
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func WithCollectionPaginationTriplePrefix[K1, K2, K3 any](prefix K1) func(o *query.CollectionsPaginateOptions[collections.Triple[K1, K2, K3]])
- func WithCollectionPaginationTripleSuperPrefix[K1, K2, K3 any](prefix1 K1, prefix2 K2) func(o *query.CollectionsPaginateOptions[collections.Triple[K1, K2, K3]])
- type Hooks
- type Keeper
- func (k Keeper) AddToTipperTotal(ctx context.Context, tipper sdk.AccAddress, amt math.Int) error
- func (k Keeper) AddtoTotalTips(ctx context.Context, amt math.Int) error
- func (k Keeper) AllocateRewards(ctx context.Context, reporters []*types.AggregateReporter, reward math.Int, ...) error
- func (k Keeper) AllocateTip(ctx context.Context, addr []byte, amount reportertypes.BigUint, height uint64) error
- func (k Keeper) ClearOldqueries(ctx context.Context, queryId []byte) error
- func (k Keeper) CurrentQuery(ctx context.Context, queryId []byte) (query types.QueryMeta, err error)
- func (k Keeper) DirectReveal(ctx context.Context, query types.QueryMeta, qDataBytes []byte, value string, ...) error
- func (k Keeper) FlagAggregateReport(ctx context.Context, report types.MicroReport) error
- func (k Keeper) GenesisCycleList(ctx context.Context, cyclelist [][]byte) error
- func (k Keeper) GetAggregateBefore(ctx context.Context, queryId []byte, timestampBefore time.Time) (aggregate *types.Aggregate, timestamp time.Time, err error)
- func (k Keeper) GetAggregateBeforeByReporter(ctx context.Context, queryId []byte, timestamp time.Time, ...) (aggregate *types.Aggregate, err error)
- func (k Keeper) GetAggregateByIndex(ctx context.Context, queryId []byte, index uint64) (aggregate *types.Aggregate, timestamp time.Time, err error)
- func (k Keeper) GetAggregateByTimestamp(ctx context.Context, queryId []byte, timestamp time.Time) (aggregate types.Aggregate, err error)
- func (k Keeper) GetAggregatedReportsByHeight(ctx context.Context, height uint64) []types.Aggregate
- func (k Keeper) GetAuthority() string
- func (k Keeper) GetCurrentAggregateReport(ctx context.Context, queryId []byte) (aggregate *types.Aggregate, timestamp time.Time, err error)
- func (k Keeper) GetCurrentQueryInCycleList(ctx context.Context) ([]byte, error)
- func (k Keeper) GetCyclelist(ctx context.Context) ([][]byte, error)
- func (k Keeper) GetDataSpec(ctx context.Context, queryType string) (regTypes.DataSpec, error)
- func (k Keeper) GetNextCurrentQueryInCycleList(ctx context.Context) ([]byte, error)
- func (k Keeper) GetParams(ctx context.Context) (types.Params, error)
- func (k Keeper) GetQueryTip(ctx context.Context, queryId []byte) (math.Int, error)
- func (k Keeper) GetTimeBasedRewards(ctx context.Context) math.Int
- func (k Keeper) GetTimeBasedRewardsAccount(ctx context.Context) sdk.ModuleAccountI
- func (k Keeper) GetTimestampAfter(ctx context.Context, queryId []byte, timestamp time.Time) (time.Time, error)
- func (k Keeper) GetTimestampBefore(ctx context.Context, queryId []byte, timestamp time.Time) (time.Time, error)
- func (k Keeper) GetTipsAtBlockForTipper(ctx context.Context, blockNumber uint64, tipper sdk.AccAddress) (math.Int, error)
- func (k Keeper) GetTotalTips(ctx context.Context) (math.Int, error)
- func (k Keeper) GetTotalTipsAtBlock(ctx context.Context, blockNumber uint64) (math.Int, error)
- func (k Keeper) GetUserTips(ctx context.Context, tipper sdk.AccAddress) (math.Int, error)
- func (k Keeper) HandleBridgeDepositDirectReveal(ctx context.Context, query types.QueryMeta, querydata []byte, ...) error
- func (k Keeper) Hooks() Hooks
- func (k Keeper) InitCycleListQuery(ctx context.Context, queries [][]byte) error
- func (k Keeper) InitializeQuery(ctx context.Context, querydata []byte) (types.QueryMeta, error)
- func (k Keeper) Logger(ctx context.Context) log.Logger
- func (k Keeper) PreventBridgeWithdrawalReport(queryData []byte) error
- func (k Keeper) RotateQueries(ctx context.Context) error
- func (k Keeper) SetAggregate(ctx context.Context, report *types.Aggregate) error
- func (k Keeper) SetAggregatedReport(ctx context.Context) (err error)
- func (k Keeper) SetParams(ctx context.Context, params types.Params) error
- func (k Keeper) SetValue(ctx context.Context, reporter sdk.AccAddress, query types.QueryMeta, ...) error
- func (k Keeper) TokenBridgeDepositCheck(ctx context.Context, queryData []byte) (types.QueryMeta, error)
- func (k Keeper) UpdateQuery(ctx context.Context, queryType string, newBlockWindow uint64) error
- func (k Keeper) WeightedMedian(ctx context.Context, reports []types.MicroReport, metaId uint64) (*types.Aggregate, error)
- func (k Keeper) WeightedMode(ctx context.Context, reports []types.MicroReport, metaId uint64) (*types.Aggregate, error)
- type Querier
- func (k Querier) CurrentCyclelistQuery(ctx context.Context, req *types.QueryCurrentCyclelistQueryRequest) (*types.QueryCurrentCyclelistQueryResponse, error)
- func (k Querier) GetAggregateBeforeByReporter(ctx context.Context, req *types.QueryGetAggregateBeforeByReporterRequest) (*types.QueryGetAggregateBeforeByReporterResponse, error)
- func (k Querier) GetCurrentAggregateReport(ctx context.Context, req *types.QueryGetCurrentAggregateReportRequest) (*types.QueryGetCurrentAggregateReportResponse, error)
- func (k Querier) GetCurrentQueryByQueryId(ctx context.Context, req *types.QueryGetCurrentQueryByQueryIdRequest) (*types.QueryGetCurrentQueryByQueryIdResponse, error)
- func (q Querier) GetCurrentTip(ctx context.Context, req *types.QueryGetCurrentTipRequest) (*types.QueryGetCurrentTipResponse, error)
- func (k Querier) GetDataBefore(ctx context.Context, req *types.QueryGetDataBeforeRequest) (*types.QueryGetDataBeforeResponse, error)
- func (k Querier) GetQuery(ctx context.Context, req *types.QueryGetQueryRequest) (*types.QueryGetQueryResponse, error)
- func (k Querier) GetReportsByAggregate(ctx context.Context, req *types.QueryGetReportsByAggregateRequest) (*types.QueryGetReportsByAggregateResponse, error)
- func (k Querier) GetReportsbyQid(ctx context.Context, req *types.QueryGetReportsbyQidRequest) (*types.QueryMicroReportsResponse, error)
- func (k Querier) GetReportsbyReporter(ctx context.Context, req *types.QueryGetReportsbyReporterRequest) (*types.QueryMicroReportsResponse, error)
- func (k Querier) GetReportsbyReporterQid(ctx context.Context, req *types.QueryGetReportsbyReporterQidRequest) (*types.QueryMicroReportsResponse, error)
- func (q Querier) GetTimeBasedRewards(ctx context.Context, req *types.QueryGetTimeBasedRewardsRequest) (*types.QueryGetTimeBasedRewardsResponse, error)
- func (q Querier) GetUserTipTotal(ctx context.Context, req *types.QueryGetUserTipTotalRequest) (*types.QueryGetUserTipTotalResponse, error)
- func (k Querier) NextCyclelistQuery(ctx context.Context, req *types.QueryNextCyclelistQueryRequest) (*types.QueryNextCyclelistQueryResponse, error)
- func (k Querier) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Querier) RetrieveData(ctx context.Context, req *types.QueryRetrieveDataRequest) (*types.QueryRetrieveDataResponse, error)
- func (k Querier) TippedQueries(ctx context.Context, req *types.QueryTippedQueriesRequest) (*types.QueryTippedQueriesResponse, error)
- type ReportersReportCount
Constants ¶
const (
TRBBridgeQueryType = "TRBBridge"
)
Variables ¶
This section is empty.
Functions ¶
func CalculateRewardAmount ¶
func CalculateRewardAmount(reporterPower, reportsCount, totalPower uint64, reward math.Int) reportertypes.BigUint
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.
func WithCollectionPaginationTriplePrefix ¶
func WithCollectionPaginationTriplePrefix[K1, K2, K3 any](prefix K1) func(o *query.CollectionsPaginateOptions[collections.Triple[K1, K2, K3]])
WithCollectionPaginationTriplePrefix applies a prefix to a collection, whose key is a collection.Triple, being paginated that needs prefixing.
func WithCollectionPaginationTripleSuperPrefix ¶
func WithCollectionPaginationTripleSuperPrefix[K1, K2, K3 any](prefix1 K1, prefix2 K2) func(o *query.CollectionsPaginateOptions[collections.Triple[K1, K2, K3]])
Types ¶
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
Hooks wrapper struct for oracle keeper
type Keeper ¶
type Keeper struct { Params collections.Item[types.Params] Schema collections.Schema // key: reporter, queryid Tips *collections.IndexedMap[collections.Pair[[]byte, []byte], math.Int, types.TipsIndex] // key: queryId, tipper TipperTotal *collections.IndexedMap[collections.Pair[[]byte, uint64], math.Int, types.TipperTotalIndex] // key: tipperAcc, blockNumber // total tips given over time TotalTips collections.Map[uint64, math.Int] // key: blockNumber, value: total tips // key: queryId, timestamp Nonces collections.Map[[]byte, uint64] // key: queryId Reports *collections.IndexedMap[collections.Triple[[]byte, []byte, uint64], types.MicroReport, types.ReportsIndex] // key: queryId, reporter, query.id QuerySequencer collections.Sequence Query *collections.IndexedMap[collections.Pair[[]byte, uint64], types.QueryMeta, types.QueryMetaIndex] // key: queryId Aggregates *collections.IndexedMap[collections.Pair[[]byte, uint64], types.Aggregate, types.AggregatesIndex] // key: queryId, timestamp // key: queryId // keep track of the current cycle Cyclelist collections.Map[[]byte, []byte] CyclelistSequencer collections.Sequence // contains filtered or unexported fields }
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeService store.KVStoreService, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, registryKeeper types.RegistryKeeper, reporterKeeper types.ReporterKeeper, authority string, ) Keeper
func (Keeper) AddToTipperTotal ¶
func (Keeper) AddtoTotalTips ¶
func (Keeper) AllocateRewards ¶
func (k Keeper) AllocateRewards(ctx context.Context, reporters []*types.AggregateReporter, reward math.Int, fromPool string) error
AllocateRewards distributes rewards to reporters based on their power and number of reports. It calculates the reward amount for each reporter and allocates the rewards. Finally, it sends the allocated rewards to the apprppopriate module based on the source of the reward.
func (Keeper) AllocateTip ¶
func (Keeper) ClearOldqueries ¶
func (Keeper) CurrentQuery ¶
func (Keeper) DirectReveal ¶
func (Keeper) FlagAggregateReport ¶
func (Keeper) GenesisCycleList ¶
func (Keeper) GetAggregateBefore ¶
func (Keeper) GetAggregateBeforeByReporter ¶
func (Keeper) GetAggregateByIndex ¶
func (Keeper) GetAggregateByTimestamp ¶
func (Keeper) GetAggregatedReportsByHeight ¶
func (Keeper) GetAuthority ¶
GetAuthority returns the module's authority.
func (Keeper) GetCurrentAggregateReport ¶
func (Keeper) GetCurrentQueryInCycleList ¶
func (Keeper) GetDataSpec ¶
func (Keeper) GetNextCurrentQueryInCycleList ¶
func (Keeper) GetQueryTip ¶
func (Keeper) GetTimeBasedRewards ¶
func (Keeper) GetTimeBasedRewardsAccount ¶
func (k Keeper) GetTimeBasedRewardsAccount(ctx context.Context) sdk.ModuleAccountI
func (Keeper) GetTimestampAfter ¶
func (Keeper) GetTimestampBefore ¶
func (Keeper) GetTipsAtBlockForTipper ¶
func (k Keeper) GetTipsAtBlockForTipper(ctx context.Context, blockNumber uint64, tipper sdk.AccAddress) (math.Int, error)
get tips at block
func (Keeper) GetTotalTipsAtBlock ¶
func (Keeper) GetUserTips ¶
func (Keeper) HandleBridgeDepositDirectReveal ¶
func (Keeper) InitCycleListQuery ¶
should be called only once when updating the cycle list
func (Keeper) InitializeQuery ¶
initialize query for a given query data
func (Keeper) PreventBridgeWithdrawalReport ¶
func (Keeper) RotateQueries ¶
rotation of the cycle list
func (Keeper) SetAggregate ¶
func (Keeper) SetAggregatedReport ¶
SetAggregatedReport calculates and allocates rewards to reporters based on aggregated reports. at a specific blockchain height (to be ran in end-blocker) It retrieves the revealed reports from the reports store, by query. calculates the aggregate report for each query using either the weighted-median or weighted-mode method. Rewards based on the source are then allocated to the reporters.
func (Keeper) TokenBridgeDepositCheck ¶
func (Keeper) UpdateQuery ¶
func (Keeper) WeightedMedian ¶
type Querier ¶
type Querier struct {
// contains filtered or unexported fields
}
func NewQuerier ¶
func (Querier) CurrentCyclelistQuery ¶
func (k Querier) CurrentCyclelistQuery(ctx context.Context, req *types.QueryCurrentCyclelistQueryRequest) (*types.QueryCurrentCyclelistQueryResponse, error)
func (Querier) GetAggregateBeforeByReporter ¶
func (k Querier) GetAggregateBeforeByReporter(ctx context.Context, req *types.QueryGetAggregateBeforeByReporterRequest) (*types.QueryGetAggregateBeforeByReporterResponse, error)
func (Querier) GetCurrentAggregateReport ¶
func (k Querier) GetCurrentAggregateReport(ctx context.Context, req *types.QueryGetCurrentAggregateReportRequest) (*types.QueryGetCurrentAggregateReportResponse, error)
func (Querier) GetCurrentQueryByQueryId ¶
func (k Querier) GetCurrentQueryByQueryId(ctx context.Context, req *types.QueryGetCurrentQueryByQueryIdRequest) (*types.QueryGetCurrentQueryByQueryIdResponse, error)
func (Querier) GetCurrentTip ¶
func (q Querier) GetCurrentTip(ctx context.Context, req *types.QueryGetCurrentTipRequest) (*types.QueryGetCurrentTipResponse, error)
func (Querier) GetDataBefore ¶
func (k Querier) GetDataBefore(ctx context.Context, req *types.QueryGetDataBeforeRequest) (*types.QueryGetDataBeforeResponse, error)
func (Querier) GetQuery ¶
func (k Querier) GetQuery(ctx context.Context, req *types.QueryGetQueryRequest) (*types.QueryGetQueryResponse, error)
func (Querier) GetReportsByAggregate ¶
func (k Querier) GetReportsByAggregate(ctx context.Context, req *types.QueryGetReportsByAggregateRequest) (*types.QueryGetReportsByAggregateResponse, error)
func (Querier) GetReportsbyQid ¶
func (k Querier) GetReportsbyQid(ctx context.Context, req *types.QueryGetReportsbyQidRequest) (*types.QueryMicroReportsResponse, error)
func (Querier) GetReportsbyReporter ¶
func (k Querier) GetReportsbyReporter(ctx context.Context, req *types.QueryGetReportsbyReporterRequest) (*types.QueryMicroReportsResponse, error)
func (Querier) GetReportsbyReporterQid ¶
func (k Querier) GetReportsbyReporterQid(ctx context.Context, req *types.QueryGetReportsbyReporterQidRequest) (*types.QueryMicroReportsResponse, error)
func (Querier) GetTimeBasedRewards ¶
func (q Querier) GetTimeBasedRewards(ctx context.Context, req *types.QueryGetTimeBasedRewardsRequest) (*types.QueryGetTimeBasedRewardsResponse, error)
func (Querier) GetUserTipTotal ¶
func (q Querier) GetUserTipTotal(ctx context.Context, req *types.QueryGetUserTipTotalRequest) (*types.QueryGetUserTipTotalResponse, error)
func (Querier) NextCyclelistQuery ¶
func (k Querier) NextCyclelistQuery(ctx context.Context, req *types.QueryNextCyclelistQueryRequest) (*types.QueryNextCyclelistQueryResponse, error)
func (Querier) Params ¶
func (k Querier) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Querier) RetrieveData ¶
func (k Querier) RetrieveData(ctx context.Context, req *types.QueryRetrieveDataRequest) (*types.QueryRetrieveDataResponse, error)
func (Querier) TippedQueries ¶
func (k Querier) TippedQueries(ctx context.Context, req *types.QueryTippedQueriesRequest) (*types.QueryTippedQueriesResponse, error)
type ReportersReportCount ¶
Source Files ¶
- aggregate.go
- cycle_list.go
- hooks.go
- keeper.go
- msg_server.go
- msg_server_submit_value.go
- msg_server_tip.go
- msg_update_cyclelist.go
- msg_update_params.go
- params.go
- query.go
- query_current_cyclelist_query.go
- query_get_current_query_by_query_id.go
- query_get_current_tip.go
- query_get_data_before.go
- query_get_reports.go
- query_get_reports_by_aggregate.go
- query_get_time_based_rewards.go
- query_get_user_tip_total.go
- query_params.go
- rewards.go
- submit_value.go
- tip.go
- token_bridge_deposit.go
- token_bridge_withdrawal_blocker.go
- weighted_median.go
- weighted_mode.go