-
Notifications
You must be signed in to change notification settings - Fork 95
Kodiak integration #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Kodiak integration #119
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for Kodiak Finance integration on Berachain, enabling tracking of USDe and sUSDe token balances across Kodiak's liquidity pools. The integration fetches balance data from Kodiak's API and filters by specific island addresses and v3 positions.
Key changes:
- Implements
KodiakIntegrationclass that extends the baseIntegrationinterface - Adds support for two token types: USDe and sUSDe with their respective island addresses
- Fetches and aggregates user balances from Kodiak's API at specified block numbers
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| utils/kodiak.py | Core integration logic for fetching and processing Kodiak balance data from API |
| integrations/kodiak_usde_integration.py | Entry point script for testing/running USDe integration |
| integrations/kodiak_susde_integration.py | Entry point script for testing/running sUSDe integration |
| integrations/integration_ids.py | Adds KODIAK_USDE and KODIAK_SUSDE integration identifiers |
| constants/summary_columns.py | Adds summary column definitions for Kodiak points tracking |
| constants/kodiak.py | Defines Kodiak API URL and token/island address constants |
Comments suppressed due to low confidence (1)
utils/kodiak.py:2
- Import of 'json' is not used.
import json
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
utils/kodiak.py
Outdated
| @@ -0,0 +1,73 @@ | |||
| from copy import deepcopy | |||
| import json | |||
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The json import is unused. It should be removed as response.json() is a method call on the response object and doesn't require importing the json module.
| import json |
utils/kodiak.py
Outdated
| if integration_id is IntegrationID.KODIAK_USDE: | ||
| self.island = KodiakIslandAddress.USDE | ||
| self.token = Tokens.USDE | ||
| elif integration_id is IntegrationID.KODIAK_SUSDE: |
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use == instead of is for enum comparison. While is may work due to Python's identity caching for some enum values, == is the correct and reliable way to compare enum members.
| if integration_id is IntegrationID.KODIAK_USDE: | |
| self.island = KodiakIslandAddress.USDE | |
| self.token = Tokens.USDE | |
| elif integration_id is IntegrationID.KODIAK_SUSDE: | |
| if integration_id == IntegrationID.KODIAK_USDE: | |
| self.island = KodiakIslandAddress.USDE | |
| self.token = Tokens.USDE | |
| elif integration_id == IntegrationID.KODIAK_SUSDE: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utils/kodiak.py
Outdated
| if integration_id is IntegrationID.KODIAK_USDE: | ||
| self.island = KodiakIslandAddress.USDE | ||
| self.token = Tokens.USDE | ||
| elif integration_id is IntegrationID.KODIAK_SUSDE: |
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use == instead of is for enum comparison. While is may work due to Python's identity caching for some enum values, == is the correct and reliable way to compare enum members.
| elif integration_id is IntegrationID.KODIAK_SUSDE: | |
| elif integration_id == IntegrationID.KODIAK_SUSDE: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| response = requests.get(base_url, params=params) | ||
| data = response.json() |
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing error handling for API request failures. If the API returns an error status code or the request fails, response.json() could raise an exception, causing the entire batch processing to fail. Consider adding try-except blocks with appropriate error handling (similar to other integrations in the codebase), checking response status with response.raise_for_status(), and setting an empty dict for failed blocks to allow processing of other blocks to continue.
| response = requests.get(base_url, params=params) | |
| data = response.json() | |
| try: | |
| response = requests.get(base_url, params=params) | |
| response.raise_for_status() | |
| data = response.json() | |
| except Exception as e: | |
| # Optionally, log the error here | |
| result[block] = {} | |
| continue |
| continue | ||
|
|
||
| params = {"excludeSources": "balance", "blockNumber": block} | ||
| response = requests.get(base_url, params=params) |
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing timeout parameter for HTTP request. Following the pattern in other integrations (e.g., zerolend_integration.py, echelon_integration.py), add a timeout parameter (e.g., timeout=10) to prevent the request from hanging indefinitely.
| response = requests.get(base_url, params=params) | |
| response = requests.get(base_url, params=params, timeout=10) |
No description provided.