Documentation ¶
Index ¶
- func NewValidator(t *testing.T, operator sdk.ValAddress, pubKey crypto.PubKey) types.Validator
- func ZeroCommission() stakingtypes.CommissionRates
- type Helper
- func (sh *Helper) CheckDelegator(delegator sdk.AccAddress, val sdk.ValAddress, found bool)
- func (sh *Helper) CheckValidator(addr sdk.ValAddress, status stakingtypes.BondStatus, jailed bool) stakingtypes.Validator
- func (sh *Helper) CreateValidator(addr sdk.ValAddress, pk crypto.PubKey, stakeAmount int64, ok bool)
- func (sh *Helper) CreateValidatorMsg(addr sdk.ValAddress, pk crypto.PubKey, stakeAmount int64) *stakingtypes.MsgCreateValidator
- func (sh *Helper) CreateValidatorWithValPower(addr sdk.ValAddress, pk crypto.PubKey, valPower int64, ok bool) sdk.Int
- func (sh *Helper) Delegate(delegator sdk.AccAddress, val sdk.ValAddress, amount int64)
- func (sh *Helper) DelegateWithPower(delegator sdk.AccAddress, val sdk.ValAddress, power int64)
- func (sh *Helper) Handle(msg sdk.Msg, ok bool) *sdk.Result
- func (sh *Helper) TurnBlock(newTime time.Time) sdk.Context
- func (sh *Helper) TurnBlockTimeDiff(diff time.Duration) sdk.Context
- func (sh *Helper) Undelegate(delegator sdk.AccAddress, val sdk.ValAddress, amount sdk.Int, ok bool) *sdk.Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewValidator ¶
NewValidator is a testing helper method to create validators in tests
func ZeroCommission ¶
func ZeroCommission() stakingtypes.CommissionRates
ZeroCommission constructs a commission rates with all zeros.
Types ¶
type Helper ¶
type Helper struct { Ctx sdk.Context Commission stakingtypes.CommissionRates // Coin Denomination Denom string // contains filtered or unexported fields }
Helper is a structure which wraps the staking handler and provides methods useful in tests
func (*Helper) CheckDelegator ¶
func (sh *Helper) CheckDelegator(delegator sdk.AccAddress, val sdk.ValAddress, found bool)
CheckDelegator asserts that a delegator exists
func (*Helper) CheckValidator ¶
func (sh *Helper) CheckValidator(addr sdk.ValAddress, status stakingtypes.BondStatus, jailed bool) stakingtypes.Validator
CheckValidator asserts that a validor exists and has a given status (if status!="") and if has a right jailed flag.
func (*Helper) CreateValidator ¶
func (sh *Helper) CreateValidator(addr sdk.ValAddress, pk crypto.PubKey, stakeAmount int64, ok bool)
CreateValidator calls handler to create a new staking validator
func (*Helper) CreateValidatorMsg ¶
func (sh *Helper) CreateValidatorMsg(addr sdk.ValAddress, pk crypto.PubKey, stakeAmount int64) *stakingtypes.MsgCreateValidator
CreateValidatorMsg returns a message used to create validator in this service.
func (*Helper) CreateValidatorWithValPower ¶
func (sh *Helper) CreateValidatorWithValPower(addr sdk.ValAddress, pk crypto.PubKey, valPower int64, ok bool) sdk.Int
CreateValidatorWithValPower calls handler to create a new staking validator with zero commission
func (*Helper) Delegate ¶
func (sh *Helper) Delegate(delegator sdk.AccAddress, val sdk.ValAddress, amount int64)
Delegate calls handler to delegate stake for a validator
func (*Helper) DelegateWithPower ¶
func (sh *Helper) DelegateWithPower(delegator sdk.AccAddress, val sdk.ValAddress, power int64)
DelegateWithPower calls handler to delegate stake for a validator
func (*Helper) TurnBlockTimeDiff ¶
TurnBlockTimeDiff calls EndBlocker and updates the block time by adding the duration to the current block time
func (*Helper) Undelegate ¶
func (sh *Helper) Undelegate(delegator sdk.AccAddress, val sdk.ValAddress, amount sdk.Int, ok bool) *sdk.Result
Undelegate calls handler to unbound some stake from a validator.