Skip to content

Commit

Permalink
Add Uniswap V3 Oracle
Browse files Browse the repository at this point in the history
- Add Uniswap V3 ABIs
- Add Uniswap V3 to a new file (other oracles should be refactored to 1 oracle per file)
- Remove unlimited caches for Oracles
- Refactor cache and cached_property decorator logic
  • Loading branch information
Uxio0 committed Aug 31, 2022
1 parent c3d2aa0 commit 34463e0
Show file tree
Hide file tree
Showing 14 changed files with 1,603 additions and 51 deletions.
7 changes: 1 addition & 6 deletions gnosis/eth/contracts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,7 @@
from web3 import Web3
from web3.contract import Contract

try:
from functools import cache
except ImportError:
from functools import lru_cache

cache = lru_cache(maxsize=None)
from gnosis.util import cache


def load_contract_interface(file_name):
Expand Down
16 changes: 1 addition & 15 deletions gnosis/eth/ethereum_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
fast_to_checksum_address,
mk_contract_address,
)
from gnosis.util import chunks
from gnosis.util import cache, cached_property, chunks

from .constants import (
ERC20_721_TRANSFER_TOPIC,
Expand Down Expand Up @@ -91,20 +91,6 @@
from .typing import BalanceDict, EthereumData, EthereumHash
from .utils import decode_string_or_bytes32

try:
from functools import cached_property
except ImportError:
from cached_property import cached_property


try:
from functools import cache
except ImportError:
from functools import lru_cache

cache = lru_cache(maxsize=None)


logger = getLogger(__name__)


Expand Down
2 changes: 2 additions & 0 deletions gnosis/eth/oracles/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
YearnOracle,
ZerionComposedOracle,
)
from .uniswap_v3 import UniswapV3Oracle

__all__ = [
"AaveOracle",
Expand All @@ -42,6 +43,7 @@
"UnderlyingToken",
"UniswapOracle",
"UniswapV2Oracle",
"UniswapV3Oracle",
"UsdPricePoolOracle",
"YearnOracle",
"ZerionComposedOracle",
Expand Down
Loading

0 comments on commit 34463e0

Please sign in to comment.