Merge pull request #192 from flashbots/liquidations-error-crud

Pass error through to liquidation
This commit is contained in:
Luke Van Seters 2021-12-23 14:41:37 -05:00 committed by GitHub
commit 2982ff700f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 1 deletions

View File

@ -0,0 +1,23 @@
"""Add error column to liquidations
Revision ID: 4b9d289f2d74
Revises: 99d376cb93cc
Create Date: 2021-12-23 14:54:28.406159
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "4b9d289f2d74"
down_revision = "99d376cb93cc"
branch_labels = None
depends_on = None
def upgrade():
op.add_column("liquidations", sa.Column("error", sa.String(256), nullable=True))
def downgrade():
op.drop_column("liquidations", "error")

View File

@ -70,6 +70,7 @@ def get_aave_liquidations(
transaction_hash=trace.transaction_hash,
trace_address=trace.trace_address,
block_number=trace.block_number,
error=trace.error,
)
)

View File

@ -48,6 +48,7 @@ def get_compound_liquidations(
transaction_hash=trace.transaction_hash,
trace_address=trace.trace_address,
block_number=trace.block_number,
error=trace.error,
)
)
elif (
@ -65,6 +66,7 @@ def get_compound_liquidations(
transaction_hash=trace.transaction_hash,
trace_address=trace.trace_address,
block_number=trace.block_number,
error=trace.error,
)
)
return liquidations

View File

@ -75,8 +75,9 @@ class MEVInspector:
except CancelledError:
logger.info("Requested to exit, cleaning up...")
except Exception as e:
logger.error(f"Existed due to {type(e)}")
logger.error(f"Exited due to {type(e)}")
traceback.print_exc()
raise
async def safe_inspect_many_blocks(
self,

View File

@ -16,3 +16,4 @@ class LiquidationModel(Base):
transaction_hash = Column(String, primary_key=True)
trace_address = Column(ARRAY(Integer), primary_key=True)
block_number = Column(Numeric, nullable=False)
error = Column(String, nullable=True)

View File

@ -16,3 +16,4 @@ class Liquidation(BaseModel):
transaction_hash: str
trace_address: List[int]
block_number: str
error: Optional[str]