Skip to content

Commit

Permalink
Fix superfluid oracle
Browse files Browse the repository at this point in the history
- `is_available` implementation was not ok
- Related to #381
  • Loading branch information
Uxio0 committed Oct 31, 2022
1 parent 1c596fa commit 3309d93
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
10 changes: 5 additions & 5 deletions gnosis/eth/oracles/superfluid.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ def is_available(
:param ethereum_client:
:return: `True` if Oracle is available for the EthereumClient provided, `False` otherwise
"""
return (
ethereum_client.get_network() == EthereumNetwork.MATIC
or EthereumNetwork.XDAI
or EthereumNetwork.ARBITRUM
or EthereumNetwork.OPTIMISTIC
return ethereum_client.get_network() in (
EthereumNetwork.MATIC,
EthereumNetwork.XDAI,
EthereumNetwork.ARBITRUM,
EthereumNetwork.OPTIMISTIC,
)

def get_price(self, token_address: str) -> float:
Expand Down
6 changes: 4 additions & 2 deletions gnosis/eth/tests/oracles/test_superfluid.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
from ... import EthereumClient
from ...oracles import CannotGetPriceFromOracle, SuperfluidOracle, SushiswapOracle
from ..ethereum_test_case import EthereumTestCaseMixin
from ..test_oracles import gno_token_mainnet_address
from ..utils import just_test_if_polygon_node

gno_token_mainnet_address = "0x6810e776880C02933D47DB1b9fc05908e5386b96"


class TestSuperfluidOracle(EthereumTestCaseMixin, TestCase):
def test_get_price(self):
polygon_node = just_test_if_polygon_node()

self.assertFalse(SuperfluidOracle.is_available(self.ethereum_client))

ethereum_client_polygon = EthereumClient(polygon_node)

self.assertTrue(SuperfluidOracle.is_available(ethereum_client_polygon))
Expand Down

0 comments on commit 3309d93

Please sign in to comment.