Skip to content

Commit

Permalink
update demo
Browse files Browse the repository at this point in the history
  • Loading branch information
droserasprout committed Dec 22, 2024
1 parent e88469c commit 130bdbe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
9 changes: 3 additions & 6 deletions src/demo_substrate_events/handlers/on_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ async def sql_update(
)


# NOTE: Not used, just for demonstration purposes
async def orm_update(
ctx: HandlerContext,
address: str,
Expand All @@ -47,9 +48,5 @@ async def on_transfer(
if not amount:
return

if ctx.is_finalized:
await sql_update(ctx, event.payload['from'], -amount, event.data.level)
await sql_update(ctx, event.payload['to'], amount, event.data.level)
else:
await orm_update(ctx, event.payload['from'], -amount, event.data.level)
await orm_update(ctx, event.payload['to'], amount, event.data.level)
await sql_update(ctx, event.payload['from'], -amount, event.data.level)
await sql_update(ctx, event.payload['to'], amount, event.data.level)
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ async def sql_update(
)


# NOTE: Not used, just for demonstration purposes
async def orm_update(
ctx: HandlerContext,
address: str,
Expand All @@ -47,9 +48,5 @@ async def on_transfer(
if not amount:
return

if ctx.is_finalized:
await sql_update(ctx, event.payload['from'], -amount, event.data.level)
await sql_update(ctx, event.payload['to'], amount, event.data.level)
else:
await orm_update(ctx, event.payload['from'], -amount, event.data.level)
await orm_update(ctx, event.payload['to'], amount, event.data.level)
await sql_update(ctx, event.payload['from'], -amount, event.data.level)
await sql_update(ctx, event.payload['to'], amount, event.data.level)

0 comments on commit 130bdbe

Please sign in to comment.