func (k Keeper) CreatePool(
	ctx sdk.Context,
	name string,
	description string,
	lpTokenDenom string,
	startHeight int64,
	rewardPerBlock sdk.Coins,
	totalReward sdk.Coins,
	editable bool,
	creator sdk.AccAddress,
) error {
	if err := k.bk.SendCoinsFromAccountToModule(ctx,
		creator, types.ModuleName, totalReward); err != nil {
		return err
	}
	if err := k.bk.SendCoinsFromAccountToModule(ctx,
		creator, k.feeCollectorName, sdk.NewCoins(k.CreatePoolFee(ctx))); err != nil {
		return err
	}
	pool := types.FarmPool{
		Name:           name,
		Creator:        creator.String(),
		Description:    description,
		StartHeight:    startHeight,
		Editable:       editable,
		TotalLptLocked: sdk.NewCoin(lpTokenDenom, sdk.ZeroInt()),
		Rules:          []types.RewardRule{},
	}
	for _, total := range totalReward {
		rewardRule := types.RewardRule{
			Reward:          total.Denom,
			TotalReward:     total.Amount,
			RemainingReward: total.Amount,
			RewardPerBlock:  rewardPerBlock.AmountOf(total.Denom),
			RewardPerShare:  sdk.ZeroDec(),
		}
		k.SetRewardRule(ctx, name, rewardRule)
		pool.Rules = append(pool.Rules, rewardRule)
	}
	endHeight, err := pool.ExpiredHeight()
	if err != nil {
		return err
	}
	pool.EndHeight = endHeight
	k.SetPool(ctx, pool)
	k.EnqueueActivePool(ctx, name, pool.EndHeight)
	return nil
}
CreatePool creates an new farm pool
package keeper
import (
	sdk "github.com/cosmos/cosmos-sdk/types"
	sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
	"github.com/irisnet/irismod/modules/farm/types"
)