-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
auto skip history for balances index
- Loading branch information
Vladimir Bobrikov
committed
Oct 17, 2023
1 parent
e927b28
commit a5557d4
Showing
17 changed files
with
39 additions
and
20 deletions.
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/dipdup/projects/demo_token_balances/handlers/on_balance_update.py.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from decimal import Decimal | ||
from {{ project.package }} import models as models | ||
from dipdup.context import HandlerContext | ||
from dipdup.models.tezos_tzkt import TzktTokenBalanceData | ||
|
||
|
||
async def on_balance_update( | ||
ctx: HandlerContext, | ||
token_balance: TzktTokenBalanceData, | ||
) -> None: | ||
holder, _ = await models.Holder.get_or_create(address=token_balance.contract_address) | ||
holder.balance = Decimal(token_balance.balance_value or 0) / (10**8) | ||
await holder.save() |