MCPcopy Create free account
hub / github.com/Sifchain/sifnode / GenerateRandomPool

Function GenerateRandomPool

x/clp/test/test_common.go:120–132  ·  view source on GitHub ↗
(numberOfPools int)

Source from the content-addressed store, hash-verified

118}
119
120func GenerateRandomPool(numberOfPools int) []types.Pool {
121 var poolList []types.Pool
122 tokens := []string{"ceth", "cbtc", "ceos", "cbch", "cbnb", "cusdt", "cada", "ctrx"}
123 rand.Seed(time.Now().Unix())
124 for i := 0; i < numberOfPools; i++ {
125 // initialize global pseudo random generator
126 externalToken := tokens[rand.Intn(len(tokens))]
127 externalAsset := types.NewAsset(TrimFirstRune(externalToken))
128 pool := types.NewPool(&externalAsset, sdk.NewUint(1000), sdk.NewUint(100), sdk.NewUint(1))
129 poolList = append(poolList, pool)
130 }
131 return poolList
132}
133
134func GenerateRandomLPWithUnitsAndAsset(poolUnitss []uint64, asset types.Asset) []*types.LiquidityProvider {
135 lpList := make([]*types.LiquidityProvider, len(poolUnitss))

Callers 6

CreateStateFunction · 0.92
SetDataFunction · 0.92
TestKeeper_ErrorsFunction · 0.92
TestKeeper_GetPoolsFunction · 0.92
TestKeeper_DestroyPoolFunction · 0.92

Calls 3

NewAssetFunction · 0.92
NewPoolFunction · 0.92
TrimFirstRuneFunction · 0.85

Tested by 6

CreateStateFunction · 0.74
SetDataFunction · 0.74
TestKeeper_ErrorsFunction · 0.74
TestKeeper_GetPoolsFunction · 0.74
TestKeeper_DestroyPoolFunction · 0.74