func New(
	ctx context.Context,
	alert *alerts.Alerter,
	mc *multicall.Multicall,
	db *database.Database,
	bc *bclient.Client,
	auther *utils.Authorizer,
	logger *zap.Logger,
	pools []config.Pool,
	gasConfig config.GasPrice) (*Service, error) {
	ctx, cancel := context.WithCancel(ctx)
	minimumGwei, ok := new(big.Int).SetString(gasConfig.MinimumGwei, 10)
	if !ok {
		cancel()
		return nil, errors.New("failed to parse minimum gwei config")
	}
	gasMultiplier, ok := new(big.Int).SetString(gasConfig.Multiplier, 10)
	if !ok {
		cancel()
		return nil, errors.New("failed to parse gas multiplier")
	}
	return &Service{
		db:            db,
		ew:            eventwatcher.New(bc.EthClient()),
		logger:        logger.Named("service"),
		mc:            mc,
		at:            alert,
		auther:        auther,
		ctx:           ctx,
		cancel:        cancel,
		pools:         pools,
		namedLock:     locker.NewLocker(),
		minimumGwei:   minimumGwei,
		gasMultiplier: gasMultiplier,
	}, nil
}
// New intializes all needed modules and returns a ready to consume service
New intializes all needed modules and returns a ready to consume service
// New intializes all needed modules and returns a ready to consume service
func New(
	ctx context.Context,
	alert *alerts.Alerter,
	mc *multicall.Multicall,
	db *database.Database,
	bc *bclient.Client,
	auther *utils.Authorizer,
	logger *zap.Logger,
	pools []config.Pool,
	gasConfig config.GasPrice) (*Service, error) {
	ctx, cancel := context.WithCancel(ctx)
	minimumGwei, ok := new(big.Int).SetString(gasConfig.MinimumGwei, 10)
	if !ok {
		cancel()
		return nil, errors.New("failed to parse minimum gwei config")
	}
	gasMultiplier, ok := new(big.Int).SetString(gasConfig.Multiplier, 10)
	if !ok {
		cancel()
		return nil, errors.New("failed to parse gas multiplier")
	}
	return &Service{
		db:            db,
		ew:            eventwatcher.New(bc.EthClient()),
		logger:        logger.Named("service"),
		mc:            mc,
		at:            alert,
		auther:        auther,
		ctx:           ctx,
		cancel:        cancel,
		pools:         pools,
		namedLock:     locker.NewLocker(),
		minimumGwei:   minimumGwei,
		gasMultiplier: gasMultiplier,
	}, nil
}
func New ( ctx context . Context , alert * alerts . Alerter , mc * multicall . Multicall , db * database . Database , bc * bclient . Client , auther * utils . Authorizer , logger * zap . Logger , pools [ ] config . Pool , gasConfig config . GasPrice ) ( * Service , error ) { ctx , cancel := context . WithCancel ( ctx ) minimumGwei , ok := new ( big . Int ) . SetString ( gasConfig . MinimumGwei , 10 ) if ! ok { cancel ( ) return nil , errors . New ( " " ) } gasMultiplier , ok := new ( big . Int ) . SetString ( gasConfig . Multiplier , 10 ) if ! ok { cancel ( ) return nil , errors . New ( " " ) } return & Service { db : db , ew : eventwatcher . New ( bc . EthClient ( ) ) , logger : logger . Named ( " " ) , mc : mc , at : alert , auther : auther , ctx : ctx , cancel : cancel , pools : pools , namedLock : locker . NewLocker ( ) , minimumGwei : minimumGwei , gasMultiplier : gasMultiplier , } , nil }
New intializes all needed modules and returns a ready to consume service
New intializes all needed modules and returns a ready to consume service