Skip to content

Commit

Permalink
Add Tron prices tokens (#6978)
Browse files Browse the repository at this point in the history
* add tron prices

* add to overall model
  • Loading branch information
0xRobin authored Oct 18, 2024
1 parent 27ad439 commit 82c4f74
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 3 deletions.
4 changes: 1 addition & 3 deletions dbt_subprojects/tokens/models/prices/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ models:
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- blockchain
- contract_address
- symbol
columns:
- *token_id
Expand All @@ -67,4 +65,4 @@ models:
combination_of_columns:
- blockchain
- contract_address
- minute
- minute
1 change: 1 addition & 0 deletions dbt_subprojects/tokens/models/prices/prices_tokens.sql
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ ref('prices_native_tokens')
,ref('prices_sei_tokens')
,ref('prices_nova_tokens')
,ref('prices_worldchain_tokens')
,ref('prices_tron_tokens')
] %}


Expand Down
29 changes: 29 additions & 0 deletions dbt_subprojects/tokens/models/prices/tron/_schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: 2

models:
- name: prices_tron_tokens
meta:
blockchain: tron
sector: prices
contributors: hosuke
config:
tags: ['prices', 'tokens', 'usd', 'tron']
description: "Price tokens on TRON chain"
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- contract_address
columns:
- name: token_id
description: "Id of the token at coinpaprika. This id is required to pull the price feed data. NOTE: Not all tokens are listed at coinpaprika - consider using price data from DEX sources in this case or submit a listing request at coinpaprika."
- name: blockchain
description: "Native blockchain of the token, if any"
tests:
- accepted_values:
values: [ "tron" ]
- name: contract_address
description: "Contract address of the token, if any"
- name: symbol
description: "Token symbol"
- name: decimals
description: "Number of decimals for the token contract"
35 changes: 35 additions & 0 deletions dbt_subprojects/tokens/models/prices/tron/prices_tron_tokens.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{% set blockchain = 'tron' %}

{{ config(
schema = 'prices_' + blockchain,
alias = 'tokens',
materialized = 'table',
file_format = 'delta',
tags = ['static']
)
}}

SELECT
token_id
, '{{ blockchain }}' as blockchain
, symbol
, from_tron_address(contract_address) as contract_address
, decimals
FROM
(
VALUES
('trx-tron', 'WTRX', 'TNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR', 6)
, ('usdt-tether', 'USDT', 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t', 6)
, ('weth-weth', 'ETHB', 'TRFe3hT5oYhjSZ6f3ji5FJ7YCfrkWnHRvh', 18)
, ('usdc-usdc', 'USDCOLD', 'TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8', 6)
, ('doge-dogecoin', 'DOGE', 'THbVQp8kMjStKNnf2iCY6NEzThKMK5aBHg', 8)
, ('weth-weth', 'WETH', 'TXWkP3jLBqRGojUih1ShzNyDaN5Csnebok', 18)
, ('ltc-litecoin', 'LTC', 'TR3DLthpnDdCGabhVDbD3VMsiJoCXY3bZd', 8)
, ('wbtc-wrapped-bitcoin', 'WBTC', 'TXpw8XeWYeTUd4quDskoUqeQPowRh4jY65', 8)
, ('tusd-trueusd', 'TUSD', 'TUpMhErZL2fhh4sVNULAbNKLokS4GjC1F4', 18)
, ('htx-htx', 'HTX', 'TUPM7K8REVzD2UdV4R5fe5M8XbnR2DdoJ6', 18)
, ('jst-just', 'JST', 'TCFLL5dx5ZJdKnWuesXxi1VPwjLVmWZZy9', 18)
, ('wbt-whitebit-coin', 'WBT', 'TFptbWaARrWTX5Yvy3gNG5Lm8BmhPx82Bt', 8)
, ('btt-bittorrent', 'BTT', 'TAFjULxiVgT4qWk6UZwjqwZXTSaGaqnVp4', 18)
, ('usdd-usdd', 'USDD', 'TPYmHEhy5n8TCEfYGqW2rPxsghSfzghPDn', 18)
) as temp (token_id, symbol, contract_address, decimals)

0 comments on commit 82c4f74

Please sign in to comment.