teststaking

package
v2.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ZeroCommission

func ZeroCommission() stakingtypes.CommissionRates

ZeroCommission constructs a commission rates with all zeros.

Types

type Helper

type Helper struct {
	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 NewHelper

func NewHelper(t *testing.T, ctx sdk.Context, k keeper.Keeper) *Helper

NewHelper creates staking Handler wrapper for 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 it 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 handler to create a new staking validator

func (*Helper) CreateValidatorWithValPower

func (sh *Helper) CreateValidatorWithValPower(addr sdk.ValAddress, pk cryptotypes.PubKey, valPower int64, ok bool) math.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 math.Int)

Delegate calls handler to delegate stake for a validator

func (*Helper) Redelegate

func (sh *Helper) Redelegate(delegator sdk.AccAddress, srcVal, dstVal sdk.ValAddress, amount int64, ok bool)

Redelegate calls handler to begin redelegation.

func (*Helper) TurnBlock

func (sh *Helper) TurnBlock(ctx sdk.Context)

TurnBlock updates context and calls endblocker.

func (*Helper) Undelegate

func (sh *Helper) Undelegate(delegator sdk.AccAddress, val sdk.ValAddress, amount int64, ok bool)

Undelegate calls handler to unbind some stake from a validator.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL