From ef97e21db5d77a94ec90041a6f2e1d5095233e45 Mon Sep 17 00:00:00 2001 From: Jordan Oroshiba Date: Tue, 9 Apr 2024 15:18:09 -0700 Subject: [PATCH 1/2] chore: update to submit nria amount --- internal/server/config.go | 2 ++ internal/server/server.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/server/config.go b/internal/server/config.go index 8b151b3..0ec76d2 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") From 7953bef0aecf16fad06e892afb3057dc43114c88 Mon Sep 17 00:00:00 2001 From: Jordan Oroshiba Date: Tue, 9 Apr 2024 15:51:13 -0700 Subject: [PATCH 2/2] format --- internal/server/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/server/config.go b/internal/server/config.go index 0ec76d2..1326b0d 100644 --- a/internal/server/config.go +++ b/internal/server/config.go @@ -20,7 +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)), + payoutNano: big.NewInt(int64(payout * 1e9)), proxyCount: proxyCount, queueCap: queueCap, }