-
-
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.
balances datasource, demo, doc, changelog, models
- Loading branch information
Vladimir Bobrikov
committed
Oct 12, 2023
1 parent
4af8376
commit 7af510b
Showing
8 changed files
with
167 additions
and
1 deletion.
There are no files selected for viewing
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
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,19 @@ | ||
--- | ||
title: "Token balances" | ||
description: "This index allows indexing token balances of contracts compatible with FA1.2 or FA2 standards." | ||
network: "tezos" | ||
--- | ||
|
||
# `tezos.tzkt.token_balances` index | ||
|
||
This index allows indexing token balances of contracts compatible with [FA1.2](https://gitlab.com/tzip/tzip/-/blob/master/proposals/tzip-7/README.md) or [FA2](https://gitlab.com/tzip/tzip/-/blob/master/proposals/tzip-12/tzip-12.md) standards. | ||
|
||
```yaml [dipdup.yaml] | ||
{{ #include ../src/demo_token_balances/dipdup.yaml }} | ||
``` | ||
|
||
Callback receives `TzktTokenBalanceData` model that optionally contains the owner, token, and balance values | ||
|
||
```python | ||
{{ #include ../src/demo_token_balances/handlers/on_balance_update.py }} | ||
``` |
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
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,21 @@ | ||
spec_version: 2.0 | ||
package: {{ project.package }} | ||
|
||
contracts: | ||
tzbtc_mainnet: | ||
kind: tezos | ||
address: KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn | ||
typename: tzbtc | ||
|
||
datasources: | ||
tzkt: | ||
kind: tezos.tzkt | ||
url: https://api.tzkt.io | ||
|
||
indexes: | ||
tzbtc_holders_mainnet: | ||
kind: tezos.tzkt.token_balances | ||
datasource: tzkt | ||
handlers: | ||
- callback: on_balance_update | ||
contract: tzbtc_mainnet |
8 changes: 8 additions & 0 deletions
8
src/dipdup/projects/demo_token_balances/models/__init__.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,8 @@ | ||
from dipdup import fields | ||
|
||
from dipdup.models import Model | ||
|
||
|
||
class Holder(Model): | ||
address = fields.TextField(pk=True) | ||
balance = fields.DecimalField(decimal_places=8, max_digits=20, default=0) |
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,5 @@ | ||
spec_version: 2.0 | ||
replay: | ||
description: TzBTC FA1.2 token balances | ||
package: demo_token_balances | ||
template: demo_token_balances |