github.com/cosmos/cosmos-sdk@v0.50.10/x/distribution/types/validator.go (about)

     1  package types
     2  
     3  import (
     4  	sdkmath "cosmossdk.io/math"
     5  
     6  	sdk "github.com/cosmos/cosmos-sdk/types"
     7  )
     8  
     9  // create a new ValidatorHistoricalRewards
    10  func NewValidatorHistoricalRewards(cumulativeRewardRatio sdk.DecCoins, referenceCount uint32) ValidatorHistoricalRewards {
    11  	return ValidatorHistoricalRewards{
    12  		CumulativeRewardRatio: cumulativeRewardRatio,
    13  		ReferenceCount:        referenceCount,
    14  	}
    15  }
    16  
    17  // create a new ValidatorCurrentRewards
    18  func NewValidatorCurrentRewards(rewards sdk.DecCoins, period uint64) ValidatorCurrentRewards {
    19  	return ValidatorCurrentRewards{
    20  		Rewards: rewards,
    21  		Period:  period,
    22  	}
    23  }
    24  
    25  // return the initial accumulated commission (zero)
    26  func InitialValidatorAccumulatedCommission() ValidatorAccumulatedCommission {
    27  	return ValidatorAccumulatedCommission{}
    28  }
    29  
    30  // create a new ValidatorSlashEvent
    31  func NewValidatorSlashEvent(validatorPeriod uint64, fraction sdkmath.LegacyDec) ValidatorSlashEvent {
    32  	return ValidatorSlashEvent{
    33  		ValidatorPeriod: validatorPeriod,
    34  		Fraction:        fraction,
    35  	}
    36  }