πŸ’²Token Prices

This guide explains how to fetch the USD price of any token from the Dozer Pool Manager using the public Hathor mainnet node.

Contract IDs

  • Mainnet: 000080350ca5ef204bc29b3232bb197e12bec6b473f5e6bdb749a6921197e83c

  • Testnet: 00000eecf6a990576c12bfa9e12ee089a5b1ea65e6de1456687ba1f4dc7fd463

1. Fetching HTR Price (Example)

Fetching the price of HTR (Token UID 00) using the Mainnet contract ID.

Note: The argument "00" must be in double quotes because the Node API parses arguments as JSON.

curl -s -G "https://node1.mainnet.hathor.network/v1a/nano_contract/state" \
  --data-urlencode "id=000080350ca5ef204bc29b3232bb197e12bec6b473f5e6bdb749a6921197e83c" \
  --data-urlencode 'calls[]=get_token_price_in_usd("00")' \
  | jq '.calls["get_token_price_in_usd(\"00\")"].value / 100000000'

2. Fetching Other Token Prices

You can fetch the price of any token by replacing "00" with the token's UID (hex string).

Command Template

Replace TOKEN_UID with the actual token ID (e.g., 00000000...).

# Define the Token UID you want to check
TOKEN_UID="YOUR_TOKEN_UID_HERE"

curl -s -G "https://node1.mainnet.hathor.network/v1a/nano_contract/state" \
  --data-urlencode "id=000080350ca5ef204bc29b3232bb197e12bec6b473f5e6bdb749a6921197e83c" \
  --data-urlencode "calls[]=get_token_price_in_usd(\"$TOKEN_UID\")" \
  | jq --arg uid "$TOKEN_UID" '.calls["get_token_price_in_usd(\"" + $uid + "\")"].value / 100000000'

Example: Fetching specific Token Value

If you wanted to fetch the price for a token with UID 00002b66...:

Last updated