Save errors on swaps in the database
This commit is contained in:
parent
d677e0b6ed
commit
24e682c9d7
24
alembic/versions/92f28a2b4f52_add_error_column_to_swaps.py
Normal file
24
alembic/versions/92f28a2b4f52_add_error_column_to_swaps.py
Normal file
@ -0,0 +1,24 @@
|
||||
"""Add error column to swaps
|
||||
|
||||
Revision ID: 92f28a2b4f52
|
||||
Revises: 9b8ae51c5d56
|
||||
Create Date: 2021-08-17 03:46:21.498821
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "92f28a2b4f52"
|
||||
down_revision = "9b8ae51c5d56"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column("swaps", sa.Column("error", sa.String(256), nullable=True))
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_column("swaps", "error")
|
@ -18,3 +18,4 @@ class SwapModel(Base):
|
||||
token_in_amount = Column(Numeric, nullable=False)
|
||||
token_out_address = Column(String, nullable=False)
|
||||
token_out_amount = Column(Numeric, nullable=False)
|
||||
error = Column(String, nullable=True)
|
||||
|
@ -18,3 +18,4 @@ class Swap(BaseModel):
|
||||
token_in_amount: int
|
||||
token_out_address: str
|
||||
token_out_amount: int
|
||||
error: Optional[str]
|
||||
|
@ -103,6 +103,7 @@ def _parse_swap(
|
||||
token_in_amount=transfer_in.amount,
|
||||
token_out_address=transfer_out.token_address,
|
||||
token_out_amount=transfer_out.amount,
|
||||
error=trace.error,
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user