sample

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: Apache-2.0 Imports: 30 Imported by: 1

Documentation

Overview

Package sample provides methods to initialize sample object of various types for test purposes

Index

Constants

View Source
const (
	// BondDenom defines the bond denom used in testing
	BondDenom = "stake"
)
View Source
const ConsensusStateNb = 2

Variables

This section is empty.

Functions

func AccAddress

func AccAddress(r *rand.Rand) sdk.AccAddress

AccAddress returns a sample account address

func AccountRemoval

func AccountRemoval(address string) *launch.AccountRemoval

AccountRemoval returns a sample AccountRemoval

func Address added in v0.2.0

func Address(r *rand.Rand) string

Address returns a sample string account address

func AllRequestContents

func AllRequestContents(r *rand.Rand, launchID uint64, genesis, vesting, validator string) []launch.RequestContent

AllRequestContents creates all contents types for request

func AlphaString

func AlphaString(r *rand.Rand, n int) string

AlphaString returns a random string with lowercase alpha char of length n

func Bool added in v0.2.0

func Bool(r *rand.Rand) bool

Bool returns randomly true or false

func Bytes

func Bytes(r *rand.Rand, n int) []byte

Bytes returns a random array of bytes

func Campaign added in v0.2.0

func Campaign(r *rand.Rand, id uint64) campaign.Campaign

Campaign returns a sample campaign

func CampaignGenesisState added in v0.2.0

func CampaignGenesisState(r *rand.Rand) campaign.GenesisState

CampaignGenesisState returns a sample genesis state for the campaign module

func CampaignGenesisStateWithAccounts added in v0.2.0

func CampaignGenesisStateWithAccounts(r *rand.Rand) campaign.GenesisState

CampaignGenesisStateWithAccounts returns a sample genesis state for the campaign module that includes accounts

func CampaignName added in v0.2.0

func CampaignName(r *rand.Rand) string

CampaignName returns a sample campaign name

func CampaignParams added in v0.2.0

func CampaignParams(r *rand.Rand) campaign.Params

CampaignParams returns a sample of params for the campaign module

func Chain

func Chain(r *rand.Rand, id, coordinatorID uint64) launch.Chain

Chain returns a sample Chain

func Codec

func Codec() codec.Codec

Codec returns a codec with preregistered interfaces

func Coin

func Coin(r *rand.Rand) sdk.Coin

Coin returns a sample coin structure

func CoinWithRange added in v0.2.0

func CoinWithRange(r *rand.Rand, min, max int64) sdk.Coin

CoinWithRange returns a sample coin structure where the amount is a random number between provided min and max values with a random denom

func CoinWithRangeAmount added in v0.2.0

func CoinWithRangeAmount(r *rand.Rand, denom string, min, max int64) sdk.Coin

CoinWithRangeAmount returns a sample coin structure where the amount is a random number between provided min and max values with a given denom

func Coins

func Coins(r *rand.Rand) sdk.Coins

Coins returns a sample coins structure

func CoinsWithRange added in v0.2.0

func CoinsWithRange(r *rand.Rand, min, max int64) sdk.Coins

CoinsWithRange returns a sample coins structure where the amount is a random number between provided min and max values

func CoinsWithRangeAmount added in v0.2.0

func CoinsWithRangeAmount(r *rand.Rand, denom1, denom2, denom3 string, min, max int64) sdk.Coins

CoinsWithRangeAmount returns a sample coins structure where the amount is a random number between provided min and max values with a set of given denoms

func ConsAddress added in v0.2.0

func ConsAddress(r *rand.Rand) sdk.ConsAddress

ConsAddress returns a sample consensus address

func ConsensusState added in v0.2.0

func ConsensusState(nb int) types.ConsensusState

ConsensusState returns a sample ConsensusState nb allows to select a consensus state with a matching validator set consensus state 0 match with validator set 0 nb is 0 if above max value

func Coordinator

func Coordinator(r *rand.Rand, address string) profile.Coordinator

Coordinator returns a sample Coordinator

func CoordinatorDescription

func CoordinatorDescription(r *rand.Rand) profile.CoordinatorDescription

CoordinatorDescription returns a sample CoordinatorDescription

func CustomShareVestingOptions added in v0.2.0

func CustomShareVestingOptions(r *rand.Rand, shares campaign.Shares) campaign.ShareVestingOptions

CustomShareVestingOptions returns a sample ShareVestingOptions with shares

func Delegation added in v0.2.0

func Delegation(t testing.TB, r *rand.Rand, addr string) stakingtypes.Delegation

Delegation returns staking delegation with the given address

func Duration added in v0.2.0

func Duration(r *rand.Rand) time.Duration

Duration returns a sample time.Duration between a second and 21 days

func DurationFromRange added in v0.2.0

func DurationFromRange(r *rand.Rand, min, max time.Duration) time.Duration

DurationFromRange returns a sample time.Duration between the min and max values provided

func GenesisAccount

func GenesisAccount(r *rand.Rand, launchID uint64, address string) launch.GenesisAccount

GenesisAccount returns a sample GenesisAccount

func GenesisAccountContent

func GenesisAccountContent(r *rand.Rand, launchID uint64, address string) launch.RequestContent

GenesisAccountContent returns a sample GenesisAccount request content

func GenesisChainID

func GenesisChainID(r *rand.Rand) string

GenesisChainID returns a sample chain id

func GenesisHash

func GenesisHash(r *rand.Rand) string

GenesisHash returns a sample sha256 hash of custom genesis for GenesisURL

func GenesisValidator

func GenesisValidator(r *rand.Rand, launchID uint64, address string) launch.GenesisValidator

GenesisValidator returns a sample GenesisValidator

func GenesisValidatorPeer added in v0.2.0

func GenesisValidatorPeer(r *rand.Rand) launch.Peer

func LaunchGenesisState

func LaunchGenesisState(r *rand.Rand, addresses ...string) launch.GenesisState

LaunchGenesisState returns a sample genesis state for the launch module

func LaunchParams

func LaunchParams(r *rand.Rand) launch.Params

LaunchParams returns a sample of params for the launch module

func MainnetAccount added in v0.2.0

func MainnetAccount(r *rand.Rand, campaignID uint64, address string) campaign.MainnetAccount

MainnetAccount returns a sample MainnetAccount

func MainnetVestingAccount added in v0.2.0

func MainnetVestingAccount(r *rand.Rand, campaignID uint64, address string) campaign.MainnetVestingAccount

MainnetVestingAccount returns a sample MainnetVestingAccount

func MainnetVestingAccountWithShares added in v0.2.0

func MainnetVestingAccountWithShares(
	r *rand.Rand,
	campaignID uint64,
	address string,
	shares campaign.Shares,
) campaign.MainnetVestingAccount

MainnetVestingAccountWithShares returns a sample MainnetVestingAccount with custom shares

func Metadata added in v0.2.0

func Metadata(r *rand.Rand, len int) []byte

Metadata returns sample metadata bytes

func MonitoringcParams added in v0.2.0

func MonitoringcParams() monitoringc.Params

MonitoringcParams returns a sample of params for the monitoring consumer module

func MonitoringpParams added in v0.2.0

func MonitoringpParams(r *rand.Rand) monitoringp.Params

MonitoringpParams returns a sample of params for the monitoring provider module

func MsgCreateCampaign added in v0.2.0

func MsgCreateCampaign(r *rand.Rand, coordAddr string) campaign.MsgCreateCampaign

MsgCreateCampaign returns a sample MsgCreateCampaign

func MsgCreateChain

func MsgCreateChain(r *rand.Rand, coordAddress, genesisURL string, hasCampaign bool, campaignID uint64) launch.MsgCreateChain

MsgCreateChain returns a sample MsgCreateChain

func MsgCreateCoordinator

func MsgCreateCoordinator(coordAddress string) profile.MsgCreateCoordinator

MsgCreateCoordinator returns a sample MsgCreateCoordinator

func MsgCreateFixedAuction added in v0.2.0

func MsgCreateFixedAuction(
	r *rand.Rand,
	auctioneer string,
	sellingCoin sdk.Coin,
	startTime,
	endTime time.Time,
) *fundraisingtypes.MsgCreateFixedPriceAuction

MsgCreateFixedAuction create a sample MsgCreateFixedAuction message

func MsgDisableCoordinator added in v0.2.0

func MsgDisableCoordinator(coordAddress string) profile.MsgDisableCoordinator

MsgDisableCoordinator returns a sample MsgDisableCoordinator

func MsgEditChain

func MsgEditChain(
	r *rand.Rand,
	coordAddress string,
	launchID uint64,
	setCampaignID bool,
	campaignID uint64,
	modifyMetadata bool,
) launch.MsgEditChain

MsgEditChain returns a sample MsgEditChain

func MsgRequestAddAccount added in v0.2.0

func MsgRequestAddAccount(r *rand.Rand, creator, address string, launchID uint64) launch.MsgRequestAddAccount

MsgRequestAddAccount returns a sample MsgRequestAddAccount

func MsgRequestAddValidator

func MsgRequestAddValidator(r *rand.Rand, creator, address string, launchID uint64) launch.MsgRequestAddValidator

MsgRequestAddValidator returns a sample MsgRequestAddValidator

func MsgRequestAddVestingAccount added in v0.2.0

func MsgRequestAddVestingAccount(r *rand.Rand, creator, address string, launchID uint64) launch.MsgRequestAddVestingAccount

MsgRequestAddVestingAccount returns a sample MsgRequestAddVestingAccount

func MsgRequestRemoveAccount added in v0.2.0

func MsgRequestRemoveAccount(creator, address string, launchID uint64) launch.MsgRequestRemoveAccount

MsgRequestRemoveAccount returns a sample MsgRequestRemoveAccount

func MsgRequestRemoveValidator added in v0.2.0

func MsgRequestRemoveValidator(creator, validatorAddr string, launchID uint64) launch.MsgRequestRemoveValidator

MsgRequestRemoveValidator returns a sample MsgRequestRemoveValidator

func MsgRevertLaunch added in v0.2.0

func MsgRevertLaunch(coordinator string, launchID uint64) launch.MsgRevertLaunch

MsgRevertLaunch returns a sample MsgRevertLaunch

func MsgSettleRequest added in v0.2.0

func MsgSettleRequest(coordinator string, launchID, requestID uint64, approve bool) launch.MsgSettleRequest

MsgSettleRequest returns a sample MsgSettleRequest

func MsgTriggerLaunch added in v0.2.0

func MsgTriggerLaunch(r *rand.Rand, coordinator string, launchID uint64) launch.MsgTriggerLaunch

MsgTriggerLaunch returns a sample MsgTriggerLaunch

func MsgUpdateCoordinatorDescription added in v0.2.0

func MsgUpdateCoordinatorDescription(coordAddress string) profile.MsgUpdateCoordinatorDescription

MsgUpdateCoordinatorDescription returns a sample MsgUpdateCoordinatorDescription

func MsgUpdateLaunchInformation added in v0.2.0

func MsgUpdateLaunchInformation(
	r *rand.Rand,
	coordAddress string,
	launchID uint64,
	modifyGenesisChainID,
	modifySource,
	modifyInitialGenesis,
	genesisURL bool,
) launch.MsgUpdateLaunchInformation

MsgUpdateLaunchInformation returns a sample MsgUpdateLaunchInformation

func OperatorAddress added in v0.2.0

func OperatorAddress(r *rand.Rand) string

OperatorAddress returns a sample string validator operator address

func ParticipationGenesisState added in v0.2.0

func ParticipationGenesisState(r *rand.Rand) participation.GenesisState

ParticipationGenesisState returns a sample genesis state for the participation module

func ParticipationGenesisStateWithAllocations added in v0.2.0

func ParticipationGenesisStateWithAllocations(r *rand.Rand) participation.GenesisState

ParticipationGenesisStateWithAllocations returns a sample genesis state for the participation module with some sample allocations

func ParticipationParams added in v0.2.0

func ParticipationParams(r *rand.Rand) participation.Params

ParticipationParams returns a sample of params for the participation module

func ProfileGenesisState

func ProfileGenesisState(r *rand.Rand, addresses ...string) profile.GenesisState

ProfileGenesisState returns a sample genesis state for the profile module

func PubKey added in v0.2.0

func PubKey(r *rand.Rand) crypto.PubKey

PubKey returns a sample account PubKey

func Rand added in v0.2.0

func Rand() *rand.Rand

Rand returns a sample Rand object for randomness

func Request

func Request(r *rand.Rand, launchID uint64, address string) launch.Request

Request returns a sample Request

func RequestWithContent

func RequestWithContent(r *rand.Rand, launchID uint64, content launch.RequestContent) launch.Request

RequestWithContent creates a launch request object with launch id and content

func RequestWithContentAndCreator added in v0.2.0

func RequestWithContentAndCreator(r *rand.Rand, launchID uint64, content launch.RequestContent, creator string) launch.Request

RequestWithContentAndCreator creates a launch request object with launch id and content and creator

func RewardPool added in v0.2.0

func RewardPool(r *rand.Rand, launchID uint64) reward.RewardPool

RewardPool returns a sample RewardPool

func RewardPoolWithCoinsRangeAmount added in v0.2.0

func RewardPoolWithCoinsRangeAmount(r *rand.Rand, launchID uint64, denom1, denom2, denom3 string, min, max int64) reward.RewardPool

RewardPoolWithCoinsRangeAmount returns a sample RewardPool where the amount of remaining coins is a random number between provided min and max values with a set of given denoms. Initial coins will be in an amount between max and 2*max

func ShareVestingOptions added in v0.2.0

func ShareVestingOptions(r *rand.Rand) campaign.ShareVestingOptions

ShareVestingOptions returns a sample ShareVestingOptions

func Shares added in v0.2.0

func Shares(r *rand.Rand) campaign.Shares

Shares returns a sample shares

func SimAccounts added in v0.2.0

func SimAccounts() (accounts []simtypes.Account)

SimAccounts returns a sample array of account for simulation

func String

func String(r *rand.Rand, n int) string

String returns a random string of length n

func TotalSupply added in v0.2.0

func TotalSupply(r *rand.Rand) sdk.Coins

TotalSupply returns a sample coins structure where each denom's total supply is within the default allowed supply range

func Uint64

func Uint64(r *rand.Rand) uint64

Uint64 returns a random uint64

func ValAddress added in v0.2.0

func ValAddress(r *rand.Rand) sdk.ValAddress

ValAddress returns a sample validator operator address

func Validator added in v0.2.0

func Validator(t testing.TB, r *rand.Rand) stakingtypes.Validator

Validator returns a sample staking validator

func ValidatorDescription

func ValidatorDescription(desc string) profile.ValidatorDescription

ValidatorDescription returns a sample ValidatorDescription

func ValidatorRemoval

func ValidatorRemoval(address string) launch.ValidatorRemoval

ValidatorRemoval returns a sample ValidatorRemoval

func ValidatorSet added in v0.2.0

func ValidatorSet(nb int) types.ValidatorSet

ValidatorSet returns a sample ValidatorSet nb allows to select a consensus state with a matching validator set consensus state 0 match with validator set 0 nb is 0 if above max value

func VestingAccount

func VestingAccount(r *rand.Rand, launchID uint64, address string) launch.VestingAccount

VestingAccount returns a sample VestingAccount

func VestingOptions

func VestingOptions(r *rand.Rand) launch.VestingOptions

VestingOptions returns a sample VestingOptions

func Voucher added in v0.2.0

func Voucher(r *rand.Rand, campaignID uint64) sdk.Coin

Voucher returns a sample voucher structure

func Vouchers added in v0.2.0

func Vouchers(r *rand.Rand, campaignID uint64) sdk.Coins

Vouchers returns a sample vouchers structure

Types

This section is empty.

Jump to

Keyboard shortcuts

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