Skip to content

Commit

Permalink
refactor: use ZERO_ADDRESS instead of hardcoded addr
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeshultz authored and fubuloubu committed May 31, 2024
1 parent 1dbf118 commit 899b341
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from ape import chain
from ape.api import BlockAPI
from ape.types import ContractLog
from ape.utils import ZERO_ADDRESS
from ape_tokens import tokens # type: ignore[import]
from taskiq import Context, TaskiqDepends, TaskiqState

Expand Down Expand Up @@ -61,14 +62,13 @@ def exec_event1(log):


# You can apply filters to your event handlers using a kwargs syntax...
@app.on_(USDC.Transfer, receiver="0x0000000000000000000000000000000000000000")
def handle_burn(log):
return {"burned": log.value}


# ...or via `filter_args` dictionary for arg names that are protected keywords (like `from`)
# NOTE: You can have multiple handlers for the same event if you want
@app.on_(USDC.Transfer, filter_args={"sender": "0x0000000000000000000000000000000000000000"})
@app.on_(USDC.Transfer, filter_args={"sender": ZERO_ADDRESS})
def handle_mint(log):
return {"minted": log.value}

Expand Down

0 comments on commit 899b341

Please sign in to comment.