Documentation ¶
Index ¶
- func GetTmConsPubKey(v types.Validator) (tmcrypto.PubKey, error)
- func NewValidator(t testing.TB, operator sdk.ValAddress, pubKey cryptotypes.PubKey) types.Validator
- func ToTmValidator(v types.Validator, r math.Int) (*tmtypes.Validator, error)
- func ToTmValidators(v types.Validators, r math.Int) ([]*tmtypes.Validator, error)
- 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 sdkstaking.BondStatus, jailed bool) stakingtypes.Validator
- func (sh *Helper) CreateValidator(addr sdk.ValAddress, pk cryptotypes.PubKey, stakeAmount math.Int, ok bool)
- func (sh *Helper) CreateValidatorMsg(addr sdk.ValAddress, pk cryptotypes.PubKey, stakeAmount math.Int) *stakingtypes.MsgCreateValidator
- func (sh *Helper) CreateValidatorWithMsg(ctx context.Context, msg *stakingtypes.MsgCreateValidator) (*stakingtypes.MsgCreateValidatorResponse, error)
- func (sh *Helper) CreateValidatorWithValPower(addr sdk.ValAddress, pk cryptotypes.PubKey, valPower int64, ok bool) math.Int
- func (sh *Helper) Delegate(delegator sdk.AccAddress, val sdk.ValAddress, amount math.Int)
- func (sh *Helper) DelegateWithPower(delegator sdk.AccAddress, val sdk.ValAddress, power int64)
- func (sh *Helper) RedeemTokensForShares(delegator sdk.AccAddress, amount sdk.Coin, ok bool)
- func (sh *Helper) TokenizeShares(delegator sdk.AccAddress, val sdk.ValAddress, amount sdk.Coin, ...)
- func (sh *Helper) TranserTokenizeShareRecord(recordId uint64, owner, newOwner sdk.AccAddress, ok bool)
- 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 math.Int, ok bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTmConsPubKey ¶
GetTmConsPubKey gets the validator's public key as a tmcrypto.PubKey.
func NewValidator ¶
func NewValidator(t testing.TB, operator sdk.ValAddress, pubKey cryptotypes.PubKey) types.Validator
NewValidator is a testing helper method to create validators in tests
func ToTmValidator ¶
ToTmValidator casts an SDK validator to a tendermint type Validator.
func ToTmValidators ¶
ToTmValidators casts all validators to the corresponding tendermint type.
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 message server 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 sdkstaking.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 cryptotypes.PubKey, stakeAmount math.Int, ok bool)
CreateValidator calls staking module `MsgServer/CreateValidator` to create a new validator
func (*Helper) CreateValidatorMsg ¶
func (sh *Helper) CreateValidatorMsg(addr sdk.ValAddress, pk cryptotypes.PubKey, stakeAmount math.Int) *stakingtypes.MsgCreateValidator
CreateValidatorMsg returns a message used to create validator in this service.
func (*Helper) CreateValidatorWithMsg ¶
func (sh *Helper) CreateValidatorWithMsg(ctx context.Context, msg *stakingtypes.MsgCreateValidator) (*stakingtypes.MsgCreateValidatorResponse, error)
CreateValidatorWithMsg calls staking module `MsgServer/CreateValidator`
func (*Helper) CreateValidatorWithValPower ¶
func (sh *Helper) CreateValidatorWithValPower(addr sdk.ValAddress, pk cryptotypes.PubKey, valPower int64, ok bool) math.Int
CreateValidatorWithValPower calls staking module `MsgServer/CreateValidator` to create a new validator with zero commission
func (*Helper) Delegate ¶
func (sh *Helper) Delegate(delegator sdk.AccAddress, val sdk.ValAddress, amount math.Int)
Delegate calls staking module staking module `MsgServer/Delegate` to delegate stake for a validator
func (*Helper) DelegateWithPower ¶
func (sh *Helper) DelegateWithPower(delegator sdk.AccAddress, val sdk.ValAddress, power int64)
DelegateWithPower calls staking module `MsgServer/Delegate` to delegate stake for a validator
func (*Helper) RedeemTokensForShares ¶
func (*Helper) TokenizeShares ¶
func (sh *Helper) TokenizeShares(delegator sdk.AccAddress, val sdk.ValAddress, amount sdk.Coin, shareOwner sdk.AccAddress, ok bool)
func (*Helper) TranserTokenizeShareRecord ¶
func (sh *Helper) TranserTokenizeShareRecord(recordId uint64, owner, newOwner sdk.AccAddress, ok bool)
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 math.Int, ok bool)
Undelegate calls staking module `MsgServer/Undelegate` to unbound some stake from a validator.