diff --git a/internal/server/config.go b/internal/server/config.go index 8b151b3..1326b0d 100644 --- a/internal/server/config.go +++ b/internal/server/config.go @@ -9,6 +9,7 @@ type Config struct { httpPort int interval int payout *big.Int + payoutNano *big.Int proxyCount int queueCap int } @@ -19,6 +20,7 @@ func NewConfig(network string, httpPort, interval, payout, proxyCount, queueCap httpPort: httpPort, interval: interval, payout: big.NewInt(int64(payout)), + payoutNano: big.NewInt(int64(payout * 1e9)), proxyCount: proxyCount, queueCap: queueCap, } diff --git a/internal/server/server.go b/internal/server/server.go index 869ed6f..89be610 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -63,7 +63,7 @@ func (s *Server) consumeQueue() { defer s.mutex.Unlock() for len(s.queue) != 0 { address := <-s.queue - txHash, err := s.Transfer(context.Background(), address, s.cfg.payout) + txHash, err := s.Transfer(context.Background(), address, s.cfg.payoutNano) if err != nil { log.WithError(err).Error("Failed to handle transaction in the queue") } else { @@ -102,7 +102,7 @@ func (s *Server) handleClaim() http.HandlerFunc { ctx, cancel := context.WithTimeout(r.Context(), 5*time.Second) defer cancel() - txHash, err := s.Transfer(ctx, address, s.cfg.payout) + txHash, err := s.Transfer(ctx, address, s.cfg.payoutNano) s.mutex.Unlock() if err != nil { log.WithError(err).Error("Failed to send transaction")