Skip to content

Commit 6548763

Browse files
committed
Removed default gas price
1 parent 8bec6d6 commit 6548763

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

dkg/constants.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@
4545
"mainnet": {},
4646
}
4747

48-
DEFAULT_GAS_PRICE_GWEI = {
49-
"otp": 1,
50-
"gnosis": 20,
51-
"base": 20,
52-
}
53-
5448
DEFAULT_HASH_FUNCTION_ID = 1
5549
DEFAULT_PROXIMITY_SCORE_FUNCTIONS_PAIR_IDS = {
5650
"development": {

dkg/providers/blockchain.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from typing import Any, Type
2424

2525
import requests
26-
from dkg.constants import BLOCKCHAINS, DEFAULT_GAS_PRICE_GWEI
26+
from dkg.constants import BLOCKCHAINS
2727
from dkg.exceptions import (
2828
AccountMissing,
2929
EnvironmentNotSupported,
@@ -181,13 +181,15 @@ def call_function(
181181
"account."
182182
)
183183

184-
gas_price = self.gas_price or gas_price or self._get_network_gas_price()
185-
186184
options = {
187-
"gasPrice": gas_price,
188185
"gas": gas_limit or contract_function(**args).estimate_gas(),
189186
}
190187

188+
gas_price = self.gas_price or gas_price or self._get_network_gas_price()
189+
190+
if gas_price is not None:
191+
options["gasPrice"] = gas_price
192+
191193
tx_hash = contract_function(**args).transact(options)
192194
tx_receipt = self.w3.eth.wait_for_transaction_receipt(tx_hash)
193195

@@ -213,12 +215,6 @@ def _get_network_gas_price(self) -> Wei | None:
213215
if self.environment == "development":
214216
return None
215217

216-
blockchain_name, _ = self.blockchain_id.split(":")
217-
218-
default_gas_price = self.w3.to_wei(
219-
DEFAULT_GAS_PRICE_GWEI[blockchain_name], "gwei"
220-
)
221-
222218
def fetch_gas_price(oracle_url: str) -> Wei | None:
223219
try:
224220
response = requests.get(oracle_url)
@@ -244,7 +240,7 @@ def fetch_gas_price(oracle_url: str) -> Wei | None:
244240
if gas_price is not None:
245241
return gas_price
246242

247-
return default_gas_price
243+
return None
248244

249245
def _init_contracts(self):
250246
for contract in self.abi.keys():

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "dkg"
3-
version = "8.0.0a0"
3+
version = "8.0.0a1"
44
description = "Python library for interacting with the OriginTrail Decentralized Knowledge Graph"
55
authors = ["Uladzislau Hubar <hubar.uladzislau@gmail.com>"]
66
license = "Apache-2.0"

0 commit comments

Comments
 (0)