-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
189 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
/.git | ||
/.idea | ||
/.github | ||
venv | ||
/venv | ||
/dist | ||
.mypy_cache | ||
Dockerfile | ||
.dockerignore | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
__pycache__/ | ||
venv | ||
dist | ||
.mypy_cache | ||
.idea | ||
local.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import logging | ||
from typing import Dict | ||
|
||
import backoff | ||
from gql import Client | ||
from gql.transport.aiohttp import AIOHTTPTransport | ||
from graphql import DocumentNode | ||
|
||
from oracle.settings import STAKEWISE_SUBGRAPH_URL, UNISWAP_V3_SUBGRAPH_URL | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
@backoff.on_exception(backoff.expo, Exception, max_time=300) | ||
async def execute_sw_gql_query(query: DocumentNode, variables: Dict) -> Dict: | ||
"""Executes GraphQL query.""" | ||
transport = AIOHTTPTransport(url=STAKEWISE_SUBGRAPH_URL) | ||
async with Client(transport=transport, fetch_schema_from_transport=True) as session: | ||
return await session.execute(query, variable_values=variables) | ||
|
||
|
||
@backoff.on_exception(backoff.expo, Exception, max_time=300) | ||
async def execute_uniswap_v3_gql_query(query: DocumentNode, variables: Dict) -> Dict: | ||
"""Executes GraphQL query.""" | ||
transport = AIOHTTPTransport(url=UNISWAP_V3_SUBGRAPH_URL) | ||
async with Client(transport=transport, fetch_schema_from_transport=True) as session: | ||
return await session.execute(query, variable_values=variables) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.