Skip to content

Commit

Permalink
Move DefaultGasPrice variable to config file
Browse files Browse the repository at this point in the history
  • Loading branch information
m-Peter committed Feb 6, 2024
1 parent a3510c3 commit 7a979d0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
)

const EthNamespace = "eth"
const DefaultGasPrice = 8049999872

// TODO: Fetch these from flow-go/fvm/evm/emulator/config.go
var (
Expand Down
2 changes: 2 additions & 0 deletions api/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"github.com/ethereum/go-ethereum/common"
)

var DefaultGasPrice = big.NewInt(8049999872)

// TODO(m-Peter) Add more config options, such as:
// - host
// - port
Expand Down
5 changes: 2 additions & 3 deletions api/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
_ "embed"
"encoding/hex"
"io"
"math/big"
"net/http"
"strings"
"testing"
Expand Down Expand Up @@ -41,7 +40,7 @@ func TestServerJSONRPCOveHTTPHandler(t *testing.T) {
config := &api.Config{
ChainID: api.FlowEVMTestnetChainID,
Coinbase: common.HexToAddress("0xf02c1c8e6114b1dbe8937a39260b5b0a374432bb"),
GasPrice: big.NewInt(api.DefaultGasPrice),
GasPrice: api.DefaultGasPrice,
}
blockchainAPI := api.NewBlockChainAPI(config, store, mockFlowClient)
supportedAPIs := api.SupportedAPIs(blockchainAPI)
Expand Down Expand Up @@ -232,7 +231,7 @@ func TestServerJSONRPCOveWebSocketHandler(t *testing.T) {
config := &api.Config{
ChainID: api.FlowEVMTestnetChainID,
Coinbase: common.HexToAddress("0xf02c1c8e6114b1dbe8937a39260b5b0a374432bb"),
GasPrice: big.NewInt(api.DefaultGasPrice),
GasPrice: api.DefaultGasPrice,
}
flowClient, err := api.NewFlowClient(grpc.EmulatorHost)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func main() {

flag.StringVar(&network, "network", "testnet", "network to connect the gateway to")
flag.StringVar(&coinbase, "coinbase", coinbaseAddr, "coinbase address to use for fee collection")
flag.Int64Var(&gasPrice, "gasPrice", api.DefaultGasPrice, "gas price for transactions")
flag.Int64Var(&gasPrice, "gasPrice", api.DefaultGasPrice.Int64(), "gas price for transactions")
flag.Parse()

config := &api.Config{
Expand Down

0 comments on commit 7a979d0

Please sign in to comment.