diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index c2a69ffbe16..2f2aa090055 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -13,12 +13,12 @@ repos:
language: system
entry: sh -c 'npm run stylelint:fix'
files: .css$
-# - repo: git://github.com/pre-commit/mirrors-isort
-# sha: 'v4.3.4'
-# hooks:
-# - id: isort
-# args:
-# - --recursive
-# - --settings-path
-# - ./setup.cfg
-# - .
+- repo: git://github.com/pre-commit/mirrors-isort
+ sha: 'v4.3.4'
+ hooks:
+ - id: isort
+ args:
+ - --recursive
+ - --settings-path
+ - ./setup.cfg
+ - .
diff --git a/app/app/local.env b/app/app/local.env
index a65a28c6e53..130b9e42ce0 100644
--- a/app/app/local.env
+++ b/app/app/local.env
@@ -65,6 +65,7 @@ GIPHY_KEY=
YOUTUBE_API_KEY=
VIEW_BLOCK_API_KEY=
ETHERSCAN_API_KEY=
+POLYGON_API_KEY=
FORTMATIC_LIVE_KEY=
FORTMATIC_TEST_KEY=
XINFIN_API_KEY=
diff --git a/app/app/settings.py b/app/app/settings.py
index f0f7fdb9851..eb24a801cf3 100644
--- a/app/app/settings.py
+++ b/app/app/settings.py
@@ -52,6 +52,7 @@
GIPHY_KEY = env('GIPHY_KEY', default='LtaY19ToaBSckiLU4QjW0kV9nIP75NFy')
YOUTUBE_API_KEY = env('YOUTUBE_API_KEY', default='YOUR-SupEr-SecRet-YOUTUBE-KeY')
ETHERSCAN_API_KEY = env('ETHERSCAN_API_KEY', default='YOUR-ETHERSCAN-KEY')
+POLYGON_API_KEY = env('POLYGON_API_KEY', default='YOUR-POLYGON-KEY')
VIEW_BLOCK_API_KEY = env('VIEW_BLOCK_API_KEY', default='YOUR-VIEW-BLOCK-KEY')
FORTMATIC_LIVE_KEY = env('FORTMATIC_LIVE_KEY', default='YOUR-SupEr-SecRet-LiVe-FoRtMaTiC-KeY')
FORTMATIC_TEST_KEY = env('FORTMATIC_TEST_KEY', default='YOUR-SupEr-SecRet-TeSt-FoRtMaTiC-KeY')
diff --git a/app/assets/v2/js/cart-ethereum-polygon.js b/app/assets/v2/js/cart-ethereum-polygon.js
index faf41bd425e..7f933b6997b 100644
--- a/app/assets/v2/js/cart-ethereum-polygon.js
+++ b/app/assets/v2/js/cart-ethereum-polygon.js
@@ -19,8 +19,7 @@ Vue.component('grantsCartEthereumPolygon', {
polygon: {
showModal: false, // true to show modal to user, false to hide
checkoutStatus: 'not-started', // options are 'not-started', 'pending', and 'complete'
- estimatedGasCost: 65000,
- gasPrices: null
+ estimatedGasCost: 65000
},
cart: {
@@ -382,14 +381,6 @@ Vue.component('grantsCartEthereumPolygon', {
let gasLimit = 0;
- // fetch gas prices from polygon gas tracker
- if (!this.polygon.gasPrices) {
- const priceUrl = 'https://api.polygonscan.com/api?module=gastracker&action=gasoracle&apikey=I28K1DVQAWAISBSI146I71YQDBK6N1C9GJ';
- const priceResponse = await fetch(priceUrl);
-
- this.polygon.gasPrices = (await priceResponse.json()).result;
- }
-
// If user has enough balance within Polygon, cost equals the minimum amount
let { isBalanceSufficient, requiredAmounts } = await this.hasEnoughBalanceInPolygon();
@@ -494,7 +485,7 @@ Vue.component('grantsCartEthereumPolygon', {
// Check if user has enough MATIC to cover gas costs
if (this.polygon.estimatedGasCost) {
const gasFeeInWei = web3.utils.toWei(
- (this.polygon.estimatedGasCost * Number(this.polygon.gasPrices.SafeGasPrice)).toString(), 'gwei' // using safe gas price
+ (this.polygon.estimatedGasCost * Number(document.polygonGasPrice)).toString(), 'gwei' // using safe gas price
);
if (userMaticBalance.lt(gasFeeInWei)) {
diff --git a/app/grants/management/commands/fetch_gas_prices.py b/app/grants/management/commands/fetch_gas_prices.py
new file mode 100644
index 00000000000..bc09e4f0a5a
--- /dev/null
+++ b/app/grants/management/commands/fetch_gas_prices.py
@@ -0,0 +1,56 @@
+"""
+ Copyright (C) 2021 Gitcoin Core
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see