proc/looper/offering.go
func AutoOfferingPopUp(logger log.Logger, abi abi.ABI, db *reform.DB,
	ethBack eth.Backend, timeNowFunc func() time.Time,
	period uint) []*data.Job {
	logger = logger.Add("method", "AutoOfferingPopUp")

	do, err := data.ReadBoolSetting(
		db.Querier, data.SettingOfferingAutoPopUp)
	if err != nil {
		logger.Warn(err.Error())
	}

	var jobs []*data.Job

	if do {
		jobs = autoOfferingPopUp(logger, abi, db, ethBack,
			timeNowFunc, period)
		logger.Debug(fmt.Sprintf("found %d offerings to pop upped",
			len(jobs)))
	}

	return jobs
}
func AutoOfferingPopUp(logger log.Logger, abi abi.ABI, db *reform.DB,
	ethBack eth.Backend, timeNowFunc func() time.Time,
	period uint) []*data.Job {
	logger = logger.Add("method", "AutoOfferingPopUp")

	do, err := data.ReadBoolSetting(
		db.Querier, data.SettingOfferingAutoPopUp)
	if err != nil {
		logger.Warn(err.Error())
	}

	var jobs []*data.Job

	if do {
		jobs = autoOfferingPopUp(logger, abi, db, ethBack,
			timeNowFunc, period)
		logger.Debug(fmt.Sprintf("found %d offerings to pop upped",
			len(jobs)))
	}

	return jobs
}
// AutoOfferingPopUp creates AgentPreOfferingPopUp jobs for active offerings.
// Taken into account a current balance of agent ETH. If ETH is not enough to
// pop up all offerings, then no one of them is popped up. Function calculates
// the pop up time.