Skip to content

Commit

Permalink
feat: add RSK Mainnet and Testnet support
Browse files Browse the repository at this point in the history
  • Loading branch information
nick8319 authored and ElvisKrop committed Oct 9, 2023
1 parent 56a37ce commit 2ef8985
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ psycogreen==1.0.2
psycopg2==2.9.7
redis==5.0.0
requests==2.31.0
safe-eth-py[django]==5.8.0
git+https://github.com/protofire/safe-eth-py.git@rsk#egg=safe-eth-py
#safe-eth-py[django]==5.8.0
web3==6.9.0
3 changes: 3 additions & 0 deletions safe_transaction_service/tokens/clients/coingecko_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,8 @@ def get_kcs_usd_price(self) -> float:
def get_metis_usd_price(self) -> float:
return self.get_price("metis-token")

def get_btc_usd_price(self) -> float:
return self.get_price("bitcoin")

def get_mtr_usd_price(self) -> float:
return self.get_price("meter-stable")
8 changes: 8 additions & 0 deletions safe_transaction_service/tokens/services/price_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ def get_kcs_usd_price(self) -> float:
except CannotGetPrice:
return self.coingecko_client.get_kcs_usd_price()

def get_btc_usd_price(self) -> float:
return self.coingecko_client.get_btc_usd_price()

def get_mtr_usd_price(self) -> float:
return self.coingecko_client.get_mtr_usd_price()

Expand Down Expand Up @@ -305,6 +308,11 @@ def get_native_coin_usd_price(self) -> float:
EthereumNetwork.FANTOM_TESTNET,
):
return self.get_ftm_usd_price()
elif self.ethereum_network in (
EthereumNetwork.RSK_MAINNET,
EthereumNetwork.RSK_TESTNET,
):
return self.get_btc_usd_price()
else:
return self.get_ether_usd_price()

Expand Down

0 comments on commit 2ef8985

Please sign in to comment.