Documentation ¶
Index ¶
- Constants
- func GetSlashPercentageAndJailDuration(category types.DisputeCategory) (math.Int, uint64, error)
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func Ratio(total, part math.Int) math.Int
- type DisputesIndex
- type Keeper
- func (k Keeper) AddDisputeRound(ctx sdk.Context, sender sdk.AccAddress, dispute types.Dispute, ...) error
- func (k Keeper) AddReporterVoteCount(ctx context.Context, id, amount uint64, choice types.VoteEnum) error
- func (k Keeper) CalculateReward(ctx sdk.Context, addr sdk.AccAddress, id uint64) (math.Int, error)
- func (k Keeper) ClaimReward(ctx sdk.Context, addr sdk.AccAddress, id uint64) error
- func (k Keeper) CloseDispute(ctx context.Context, id uint64) error
- func (k Keeper) ExecuteVote(ctx context.Context, id uint64) error
- func (k Keeper) GetAccountBalance(ctx context.Context, addr sdk.AccAddress) (math.Int, error)
- func (k Keeper) GetDisputeByReporter(ctx sdk.Context, r oracletypes.MicroReport, c types.DisputeCategory) (types.Dispute, error)
- func (k Keeper) GetDisputeFee(ctx sdk.Context, rep oracletypes.MicroReport, category types.DisputeCategory) (math.Int, error)
- func (k Keeper) GetOpenDisputes(ctx context.Context) ([]uint64, error)
- func (k Keeper) GetSumOfAllGroupVotesAllRounds(ctx context.Context, id uint64) (math.Int, error)
- func (k Keeper) GetTeamAddress(ctx context.Context) (sdk.AccAddress, error)
- func (k Keeper) GetTotalSupply(ctx context.Context) math.Int
- func (k Keeper) GetUserTotalTips(ctx context.Context, voter sdk.AccAddress, blockNumber uint64) (math.Int, error)
- func (k Keeper) GetVoters(ctx context.Context, id uint64) ([]collections.KeyValue[collections.Pair[uint64, []byte], types.Voter], error)
- func (k Keeper) HashId(ctx sdk.Context, r oracletypes.MicroReport, c types.DisputeCategory) [32]byte
- func (k Keeper) InitVoterClasses() *types.VoterClasses
- func (k Keeper) JailReporter(ctx context.Context, repAddr sdk.AccAddress, jailDuration uint64) error
- func (k Keeper) Logger(ctx context.Context) log.Logger
- func (k Keeper) NextDisputeId(ctx sdk.Context) uint64
- func (k Keeper) PayDisputeFee(ctx sdk.Context, proposer sdk.AccAddress, fee sdk.Coin, fromBond bool, ...) error
- func (k Keeper) PayFromAccount(ctx sdk.Context, addr sdk.AccAddress, fee sdk.Coin) error
- func (k Keeper) PayFromBond(ctx sdk.Context, reporterAddr sdk.AccAddress, fee sdk.Coin, hashId []byte) error
- func (k Keeper) RefundDisputeFee(ctx context.Context, feePayer sdk.AccAddress, payerInfo types.PayerInfo, ...) (math.Int, error)
- func (k Keeper) ReporterKey(ctx sdk.Context, r oracletypes.MicroReport, c types.DisputeCategory) string
- func (k Keeper) ReturnFeetoStake(ctx context.Context, hashId []byte, remainingAmt math.Int) error
- func (k Keeper) ReturnSlashedTokens(ctx context.Context, dispute types.Dispute) error
- func (k Keeper) RewardReporterBondToFeePayers(ctx context.Context, feePayer sdk.AccAddress, payerInfo types.PayerInfo, ...) (math.Int, error)
- func (k Keeper) SetBlockInfo(ctx context.Context, hashId []byte) error
- func (k Keeper) SetNewDispute(ctx sdk.Context, sender sdk.AccAddress, msg types.MsgProposeDispute) error
- func (k Keeper) SetStartVote(ctx sdk.Context, id uint64) error
- func (k Keeper) SetTeamVote(ctx context.Context, id uint64, voter sdk.AccAddress, choice types.VoteEnum) (math.Int, error)
- func (k Keeper) SetTokenholderVote(ctx context.Context, id uint64, voter sdk.AccAddress, blockNumber uint64, ...) (math.Int, error)
- func (k Keeper) SetVoterReporterStake(ctx context.Context, id uint64, voter sdk.AccAddress, blockNumber uint64, ...) (math.Int, error)
- func (k Keeper) SetVoterTips(ctx context.Context, id uint64, voter sdk.AccAddress, blockNumber uint64, ...) (math.Int, error)
- func (k Keeper) SlashAndJailReporter(ctx sdk.Context, report oracletypes.MicroReport, ...) error
- func (k Keeper) SubtractReporterVoteCount(ctx context.Context, id, amount uint64, choice types.VoteEnum) error
- func (k Keeper) TallyVote(ctx context.Context, id uint64) error
- func (k Keeper) TeamVote(ctx context.Context, id uint64) (math.Int, error)
- func (k Keeper) UpdateDispute(ctx context.Context, id uint64, dispute types.Dispute, vote types.Vote, ...) error
- type Querier
- func (k Querier) Disputes(ctx context.Context, req *types.QueryDisputesRequest) (*types.QueryDisputesResponse, error)
- func (k Querier) OpenDisputes(ctx context.Context, req *types.QueryOpenDisputesRequest) (*types.QueryOpenDisputesResponse, error)
- func (k Querier) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Querier) Tally(ctx context.Context, req *types.QueryDisputesTallyRequest) (*types.QueryDisputesTallyResponse, error)
- func (k Querier) TeamAddress(ctx context.Context, req *types.QueryTeamAddressRequest) (*types.QueryTeamAddressResponse, error)
- func (k Querier) TeamVote(ctx context.Context, req *types.QueryTeamVoteRequest) (*types.QueryTeamVoteResponse, error)
- type VoterInfo
- type VotersVoteIndex
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func GetSlashPercentageAndJailDuration ¶
Get percentage of slash amount based on category, returned as fixed6
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.
Types ¶
type DisputesIndex ¶
type DisputesIndex struct { DisputeByReporter *indexes.Multi[[]byte, uint64, types.Dispute] OpenDisputes *indexes.Multi[bool, uint64, types.Dispute] PendingExecution *indexes.Multi[bool, uint64, types.Dispute] // New index for PendingExecution }
func NewDisputesIndex ¶
func NewDisputesIndex(sb *collections.SchemaBuilder) DisputesIndex
func (DisputesIndex) IndexesList ¶
func (a DisputesIndex) IndexesList() []collections.Index[uint64, types.Dispute]
type Keeper ¶
type Keeper struct { Params collections.Item[types.Params] Disputes *collections.IndexedMap[uint64, types.Dispute, DisputesIndex] // dispute id -> dispute Votes collections.Map[uint64, types.Vote] Voter *collections.IndexedMap[collections.Pair[uint64, []byte], types.Voter, VotersVoteIndex] TeamVoter collections.Map[uint64, bool] UsersGroup collections.Map[collections.Pair[uint64, []byte], math.Int] ReportersGroup collections.Map[collections.Pair[uint64, []byte], math.Int] ReportersWithDelegatorsVotedBefore collections.Map[collections.Pair[[]byte, uint64], math.Int] BlockInfo collections.Map[[]byte, types.BlockInfo] DisputeFeePayer collections.Map[collections.Pair[uint64, []byte], types.PayerInfo] // dust is extra tokens leftover after truncating decimals, stored as fixed256x12 Dust collections.Item[math.Int] VoteCountsByGroup collections.Map[uint64, types.StakeholderVoteCounts] // contains filtered or unexported fields }
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeService store.KVStoreService, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, oracleKeeper types.OracleKeeper, reporterKeeper types.ReporterKeeper, ) Keeper
func (Keeper) AddDisputeRound ¶
func (k Keeper) AddDisputeRound(ctx sdk.Context, sender sdk.AccAddress, dispute types.Dispute, msg types.MsgProposeDispute) error
Update existing dispute when conditions are met
func (Keeper) AddReporterVoteCount ¶
func (Keeper) CalculateReward ¶
func (Keeper) ClaimReward ¶
Pay fee from account
func (Keeper) CloseDispute ¶
close dispute by id
func (Keeper) ExecuteVote ¶
Execute the transfer of fee after the vote on a dispute is complete
func (Keeper) GetAccountBalance ¶
func (Keeper) GetDisputeByReporter ¶
func (k Keeper) GetDisputeByReporter(ctx sdk.Context, r oracletypes.MicroReport, c types.DisputeCategory) (types.Dispute, error)
Get dispute by reporter key
func (Keeper) GetDisputeFee ¶
func (k Keeper) GetDisputeFee(ctx sdk.Context, rep oracletypes.MicroReport, category types.DisputeCategory) (math.Int, error)
Get dispute fee
func (Keeper) GetOpenDisputes ¶
gets all open disputes
func (Keeper) GetSumOfAllGroupVotesAllRounds ¶
func (Keeper) GetTeamAddress ¶
func (Keeper) GetTotalSupply ¶
Get total trb supply
func (Keeper) GetUserTotalTips ¶
func (Keeper) HashId ¶
func (k Keeper) HashId(ctx sdk.Context, r oracletypes.MicroReport, c types.DisputeCategory) [32]byte
Generate hash id
func (Keeper) InitVoterClasses ¶
func (k Keeper) InitVoterClasses() *types.VoterClasses
func (Keeper) JailReporter ¶
func (Keeper) NextDisputeId ¶
Get next dispute id
func (Keeper) PayDisputeFee ¶
func (k Keeper) PayDisputeFee(ctx sdk.Context, proposer sdk.AccAddress, fee sdk.Coin, fromBond bool, hashId []byte) error
Pay dispute fee
func (Keeper) PayFromAccount ¶
Pay fee from account
func (Keeper) PayFromBond ¶
func (k Keeper) PayFromBond(ctx sdk.Context, reporterAddr sdk.AccAddress, fee sdk.Coin, hashId []byte) error
Pay fee from validator's bond can only be called by the validator itself
func (Keeper) RefundDisputeFee ¶
func (Keeper) ReporterKey ¶
func (k Keeper) ReporterKey(ctx sdk.Context, r oracletypes.MicroReport, c types.DisputeCategory) string
Make a reporter key by combining reporter address and a hash of dispute params
func (Keeper) ReturnFeetoStake ¶
func (Keeper) ReturnSlashedTokens ¶
return slashed tokens when reporter either wins dispute or dispute is invalid
func (Keeper) RewardReporterBondToFeePayers ¶
func (Keeper) SetBlockInfo ¶
creates a snapshot of total reporter power and total tips
func (Keeper) SetNewDispute ¶
func (k Keeper) SetNewDispute(ctx sdk.Context, sender sdk.AccAddress, msg types.MsgProposeDispute) error
Set new dispute
func (Keeper) SetStartVote ¶
Set vote start info for a dispute
func (Keeper) SetTeamVote ¶
func (Keeper) SetTokenholderVote ¶
func (Keeper) SetVoterReporterStake ¶
func (Keeper) SetVoterTips ¶
func (Keeper) SlashAndJailReporter ¶
func (k Keeper) SlashAndJailReporter(ctx sdk.Context, report oracletypes.MicroReport, category types.DisputeCategory, hashId []byte) error
Slash and jail reporter
func (Keeper) SubtractReporterVoteCount ¶
type Querier ¶
type Querier struct {
Keeper
}
func NewQuerier ¶
func (Querier) Disputes ¶
func (k Querier) Disputes(ctx context.Context, req *types.QueryDisputesRequest) (*types.QueryDisputesResponse, error)
func (Querier) OpenDisputes ¶
func (k Querier) OpenDisputes(ctx context.Context, req *types.QueryOpenDisputesRequest) (*types.QueryOpenDisputesResponse, error)
func (Querier) Params ¶
func (k Querier) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Querier) Tally ¶
func (k Querier) Tally(ctx context.Context, req *types.QueryDisputesTallyRequest) (*types.QueryDisputesTallyResponse, error)
func (Querier) TeamAddress ¶
func (k Querier) TeamAddress(ctx context.Context, req *types.QueryTeamAddressRequest) (*types.QueryTeamAddressResponse, error)
func (Querier) TeamVote ¶
func (k Querier) TeamVote(ctx context.Context, req *types.QueryTeamVoteRequest) (*types.QueryTeamVoteResponse, error)
type VotersVoteIndex ¶
type VotersVoteIndex struct {
VotersById *indexes.Multi[uint64, collections.Pair[uint64, []byte], types.Voter]
}
func NewVotersIndex ¶
func NewVotersIndex(sb *collections.SchemaBuilder) VotersVoteIndex
func (VotersVoteIndex) IndexesList ¶
func (a VotersVoteIndex) IndexesList() []collections.Index[collections.Pair[uint64, []byte], types.Voter]
Source Files ¶
- claim_reward.go
- dispute.go
- dispute_fee.go
- execute.go
- indexes.go
- keeper.go
- msg_server.go
- msg_server_add_evidence.go
- msg_server_add_fee_to_dispute.go
- msg_server_claim_reward.go
- msg_server_propose_dispute.go
- msg_server_vote.go
- msg_server_withdraw_fee_refund.go
- msg_update_team.go
- query.go
- query_params.go
- tally.go
- vote.go