diff --git a/src/agent0/chainsync/db/hyperdrive/convert_data.py b/src/agent0/chainsync/db/hyperdrive/convert_data.py index 48c1bae7c1..0151be6ce0 100644 --- a/src/agent0/chainsync/db/hyperdrive/convert_data.py +++ b/src/agent0/chainsync/db/hyperdrive/convert_data.py @@ -386,6 +386,7 @@ def convert_trade_events(events: list[dict[str, Any]], wallet_addr: str | None) "vault_share_delta": "vault_share_delta", "asBase": "as_base", "vaultSharePrice": "vault_share_price", + "extraData": "extra_data", } events_df = events_df[list(rename_dict.keys())].rename(columns=rename_dict) diff --git a/src/agent0/chainsync/db/hyperdrive/schema.py b/src/agent0/chainsync/db/hyperdrive/schema.py index 50a087dc50..2b5e3ec669 100644 --- a/src/agent0/chainsync/db/hyperdrive/schema.py +++ b/src/agent0/chainsync/db/hyperdrive/schema.py @@ -4,7 +4,7 @@ from decimal import Decimal from typing import Union -from sqlalchemy import BigInteger, Boolean, DateTime, Integer, Numeric, String +from sqlalchemy import BigInteger, Boolean, DateTime, Integer, LargeBinary, Numeric, String from sqlalchemy.orm import Mapped, mapped_column from agent0.chainsync.db.base import DBBase @@ -204,6 +204,7 @@ class DBTradeEvent(DBBase): """ The vault share price at the time of the emitted event. """ + extra_data: Mapped[Union[bytes, None]] = mapped_column(LargeBinary, default=None) ## Analysis schemas diff --git a/src/agent0/ethpy/hyperdrive/interface/read_interface.py b/src/agent0/ethpy/hyperdrive/interface/read_interface.py index 66e0577b18..844659be26 100644 --- a/src/agent0/ethpy/hyperdrive/interface/read_interface.py +++ b/src/agent0/ethpy/hyperdrive/interface/read_interface.py @@ -17,6 +17,7 @@ MockERC4626Contract, MockLidoContract, ) +from packaging.version import Version from web3 import Web3 from web3.constants import ADDRESS_ZERO from web3.types import BlockData, BlockIdentifier, Timestamp @@ -168,10 +169,10 @@ def __init__( ) # Check version here to ensure the contract is the correct version - hyperdrive_version = self.hyperdrive_contract.functions.version().call() - if not check_hyperdrive_version(hyperdrive_version): + self.hyperdrive_version = self.hyperdrive_contract.functions.version().call() + if not check_hyperdrive_version(self.hyperdrive_version): raise ValueError( - f"Hyperdrive address {self.hyperdrive_address} is version {hyperdrive_version}, " + f"Hyperdrive address {self.hyperdrive_address} is version {self.hyperdrive_version}, " f"does not meet minimum versions {get_minimum_hyperdrive_version()}" ) @@ -262,7 +263,8 @@ def __init__( # TODO There's a known issue fixed in Hyperdrive v1.0.17 that causes issues with # extra data passed to morpho. Remove this when minimum hyperdrive version supported # >= 1.0.17 - self.txn_signature = bytes(0) + if Version(self.hyperdrive_version) < Version("1.0.17"): + self.txn_signature = bytes(0) else: # TODO Although the underlying function might not be a MockERC4626Contract,