From 82294b96f859262edec9ec34889fdc340350c567 Mon Sep 17 00:00:00 2001 From: Mohammed Sohail Date: Thu, 6 Apr 2023 06:31:07 +0000 Subject: [PATCH] refactor: pgx supports big.Int type conversion internally --- internal/store/store.go | 3 ++- internal/tasker/task/account_refill_gas.go | 2 +- internal/tasker/task/account_register.go | 2 +- internal/tasker/task/sign_transfer.go | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/store/store.go b/internal/store/store.go index 1260f16..fe1e50a 100644 --- a/internal/store/store.go +++ b/internal/store/store.go @@ -2,6 +2,7 @@ package store import ( "context" + "math/big" "github.com/grassrootseconomics/cic-custodial/pkg/enum" ) @@ -26,7 +27,7 @@ type ( Data string GasLimit uint64 TransferValue uint64 - GasPrice uint64 + GasPrice *big.Int Nonce uint64 } diff --git a/internal/tasker/task/account_refill_gas.go b/internal/tasker/task/account_refill_gas.go index 5538100..7beeeb7 100644 --- a/internal/tasker/task/account_refill_gas.go +++ b/internal/tasker/task/account_refill_gas.go @@ -149,7 +149,7 @@ func AccountRefillGasProcessor(cu *custodial.Custodial) func(context.Context, *a TxHash: builtTx.Hash().Hex(), From: cu.SystemPublicKey, Data: hexutil.Encode(builtTx.Data()), - GasPrice: builtTx.GasPrice().Uint64(), + GasPrice: builtTx.GasPrice(), GasLimit: builtTx.Gas(), Nonce: builtTx.Nonce(), }) diff --git a/internal/tasker/task/account_register.go b/internal/tasker/task/account_register.go index b626e2a..5756806 100644 --- a/internal/tasker/task/account_register.go +++ b/internal/tasker/task/account_register.go @@ -89,7 +89,7 @@ func AccountRegisterOnChainProcessor(cu *custodial.Custodial) func(context.Conte TxHash: builtTx.Hash().Hex(), From: cu.SystemPublicKey, Data: hexutil.Encode(builtTx.Data()), - GasPrice: builtTx.GasPrice().Uint64(), + GasPrice: builtTx.GasPrice(), GasLimit: builtTx.Gas(), Nonce: builtTx.Nonce(), }) diff --git a/internal/tasker/task/sign_transfer.go b/internal/tasker/task/sign_transfer.go index 41680fb..463a726 100644 --- a/internal/tasker/task/sign_transfer.go +++ b/internal/tasker/task/sign_transfer.go @@ -96,7 +96,7 @@ func SignTransfer(cu *custodial.Custodial) func(context.Context, *asynq.Task) er TxHash: builtTx.Hash().Hex(), From: payload.From, Data: hexutil.Encode(builtTx.Data()), - GasPrice: builtTx.GasPrice().Uint64(), + GasPrice: builtTx.GasPrice(), GasLimit: builtTx.Gas(), TransferValue: payload.Amount, Nonce: builtTx.Nonce(),