Skip to content

Commit

Permalink
feat: Interest rate and Bearing mint models
Browse files Browse the repository at this point in the history
  • Loading branch information
MooreTheAnalyst committed Nov 25, 2024
1 parent 55df78d commit 9de2da7
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
30 changes: 30 additions & 0 deletions apps/data_handler/db/models/nostra_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,33 @@ class DebtBurnEventModel(EventBaseModel):

user: Mapped[str] = mapped_column(String, nullable=False)
amount: Mapped[Decimal] = mapped_column(Numeric(38, 18), nullable=False)


class InterestRateModelEventModel(EventBaseModel):
"""
Database model for InterestRate event, inheriting from EventBaseModel.
This model stores the
debt_token (str): The address of the debt token.
lending_index (Decimal): The lending index in hexadecimal.
borrow_index (Decimal): The borrow index in hexadecimal.
"""

__tablename__ = "interest_rate_event"

debt_token: Mapped[str] = mapped_column(String, nullable=False)
lending_index: Mapped[Decimal] = mapped_column(Numeric(38, 18), nullable=False)
borrow_index: Mapped[Decimal] = mapped_column(Numeric(38, 18), nullable=False)


class BearingCollateralMintEventModel(EventBaseModel):
"""
Database model for BearingCollateral mint event, inheriting from EventBaseModel.
This model stores the user address and the amount minted.
"""

__tablename__ = "bearing_collateral_mint_event"

user: Mapped[str] = mapped_column(String, nullable=False)
amount: Mapped[Decimal] = mapped_column(Numeric(38, 18), nullable=False)
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""interest rate and bearing models
Revision ID: a422113f0e33
Revises: d3691f6e8c5a
Create Date: 2024-11-25 19:41:09.842644
"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = 'a422113f0e33'
down_revision: Union[str, None] = 'd3691f6e8c5a'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###

0 comments on commit 9de2da7

Please sign in to comment.