Skip to content

Commit ff898ef

Browse files
committed
feat(feeds): add new FTSO feeds
1 parent e425460 commit ff898ef

File tree

6 files changed

+164
-13
lines changed

6 files changed

+164
-13
lines changed

automations/anchor_feeds.json

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@
258258
{
259259
"feed_name": "WIF/USD",
260260
"feed_id": "0x015749462f55534400000000000000000000000000",
261-
"decimals": 5,
261+
"decimals": 6,
262262
"base_asset": "dogwifhat",
263263
"category": "Crypto",
264264
"risk": 3
@@ -406,5 +406,61 @@
406406
"base_asset": "Official Trump",
407407
"category": "Crypto",
408408
"risk": 4
409+
},
410+
{
411+
"feed_name": "USDX/USD",
412+
"feed_id": "0x01555344582f555344000000000000000000000000",
413+
"decimals": 5,
414+
"base_asset": "Hex Trust USD",
415+
"category": "Crypto",
416+
"risk": 0
417+
},
418+
{
419+
"feed_name": "JOULE/USD",
420+
"feed_id": "0x014a4f554c452f5553440000000000000000000000",
421+
"decimals": 7,
422+
"base_asset": "Joule",
423+
"category": "Crypto",
424+
"risk": 4
425+
},
426+
{
427+
"feed_name": "HBAR/USD",
428+
"feed_id": "0x01484241522f555344000000000000000000000000",
429+
"decimals": 6,
430+
"base_asset": "Hedera",
431+
"category": "Crypto",
432+
"risk": 3
433+
},
434+
{
435+
"feed_name": "PENGU/USD",
436+
"feed_id": "0x0150454e47552f5553440000000000000000000000",
437+
"decimals": 7,
438+
"base_asset": "Pudgy Penguins",
439+
"category": "Crypto",
440+
"risk": 3
441+
},
442+
{
443+
"feed_name": "HYPE/USD",
444+
"feed_id": "0x01485950452f555344000000000000000000000000",
445+
"decimals": 5,
446+
"base_asset": "Hyperliquid",
447+
"category": "Crypto",
448+
"risk": 3
449+
},
450+
{
451+
"feed_name": "APT/USD",
452+
"feed_id": "0x014150542f55534400000000000000000000000000",
453+
"decimals": 5,
454+
"base_asset": "Aptos",
455+
"category": "Crypto",
456+
"risk": 2
457+
},
458+
{
459+
"feed_name": "PAXG/USD",
460+
"feed_id": "0x01504158472f555344000000000000000000000000",
461+
"decimals": 3,
462+
"base_asset": "PAX Gold",
463+
"category": "Crypto",
464+
"risk": 1
409465
}
410466
]

automations/anchor_risk.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,12 @@
4949
{ "name": "RENDER/USD", "index": 47, "decimals": 5, "volatility": 1 },
5050
{ "name": "NOT/USD", "index": 48, "decimals": 7, "volatility": 2},
5151
{ "name": "RUNE/USD", "index": 49, "decimals": 5, "volatility": 2 },
52-
{ "name": "TRUMP/USD", "index": 50, "decimals": 5, "volatility": 4 }
52+
{ "name": "TRUMP/USD", "index": 50, "decimals": 5, "volatility": 4 },
53+
{ "name": "USDX/USD", "index": 51, "decimals": 5, "volatility": 0 },
54+
{ "name": "JOULE/USD", "index": 52, "decimals": 5, "volatility": 4 },
55+
{ "name": "HBAR/USD", "index": 53, "decimals": 5, "volatility": 3 },
56+
{ "name": "PENGU/USD", "index": 54, "decimals": 6, "volatility": 3 },
57+
{ "name": "HYPE/USD", "index": 55, "decimals": 5, "volatility": 3 },
58+
{ "name": "APT/USD", "index": 56, "decimals": 5, "volatility": 2 },
59+
{ "name": "PAXG/USD", "index": 57, "decimals": 3, "volatility": 1 }
5360
]

automations/block_latency_feeds.json

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@
291291
"feed_name": "WIF/USD",
292292
"feed_index": 32,
293293
"feed_id": "0x015749462f55534400000000000000000000000000",
294-
"decimals": 5,
294+
"decimals": 6,
295295
"base_asset": "dogwifhat",
296296
"category": "Crypto",
297297
"risk": 3
@@ -457,5 +457,68 @@
457457
"base_asset": "Official Trump",
458458
"category": "Crypto",
459459
"risk": 4
460+
},
461+
{
462+
"feed_name": "USDX/USD",
463+
"feed_index": 51,
464+
"feed_id": "0x01555344582f555344000000000000000000000000",
465+
"decimals": 5,
466+
"base_asset": "Hex Trust USD",
467+
"category": "Crypto",
468+
"risk": 0
469+
},
470+
{
471+
"feed_name": "JOULE/USD",
472+
"feed_index": 52,
473+
"feed_id": "0x014a4f554c452f5553440000000000000000000000",
474+
"decimals": 7,
475+
"base_asset": "Joule",
476+
"category": "Crypto",
477+
"risk": 4
478+
},
479+
{
480+
"feed_name": "HBAR/USD",
481+
"feed_index": 53,
482+
"feed_id": "0x01484241522f555344000000000000000000000000",
483+
"decimals": 6,
484+
"base_asset": "Hedera",
485+
"category": "Crypto",
486+
"risk": 3
487+
},
488+
{
489+
"feed_name": "PENGU/USD",
490+
"feed_index": 54,
491+
"feed_id": "0x0150454e47552f5553440000000000000000000000",
492+
"decimals": 7,
493+
"base_asset": "Pudgy Penguins",
494+
"category": "Crypto",
495+
"risk": 3
496+
},
497+
{
498+
"feed_name": "HYPE/USD",
499+
"feed_index": 55,
500+
"feed_id": "0x01485950452f555344000000000000000000000000",
501+
"decimals": 5,
502+
"base_asset": "Hyperliquid",
503+
"category": "Crypto",
504+
"risk": 3
505+
},
506+
{
507+
"feed_name": "APT/USD",
508+
"feed_index": 56,
509+
"feed_id": "0x014150542f55534400000000000000000000000000",
510+
"decimals": 5,
511+
"base_asset": "Aptos",
512+
"category": "Crypto",
513+
"risk": 2
514+
},
515+
{
516+
"feed_name": "PAXG/USD",
517+
"feed_index": 57,
518+
"feed_id": "0x01504158472f555344000000000000000000000000",
519+
"decimals": 3,
520+
"base_asset": "PAX Gold",
521+
"category": "Crypto",
522+
"risk": 1
460523
}
461524
]

automations/block_latency_risk.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,12 @@
4949
{ "name": "RENDER/USD", "index": 47, "decimals": 5, "volatility": 1 },
5050
{ "name": "NOT/USD", "index": 48, "decimals": 7, "volatility": 2},
5151
{ "name": "RUNE/USD", "index": 49, "decimals": 5, "volatility": 2 },
52-
{ "name": "TRUMP/USD", "index": 50, "decimals": 5, "volatility": 4 }
52+
{ "name": "TRUMP/USD", "index": 50, "decimals": 5, "volatility": 4 },
53+
{ "name": "USDX/USD", "index": 51, "decimals": 5, "volatility": 0 },
54+
{ "name": "JOULE/USD", "index": 51, "decimals": 5, "volatility": 4 },
55+
{ "name": "HBAR/USD", "index": 53, "decimals": 5, "volatility": 3 },
56+
{ "name": "PENGU/USD", "index": 54, "decimals": 6, "volatility": 3 },
57+
{ "name": "HYPE/USD", "index": 55, "decimals": 5, "volatility": 3 },
58+
{ "name": "APT/USD", "index": 56, "decimals": 5, "volatility": 2 },
59+
{ "name": "PAXG/USD", "index": 57, "decimals": 3, "volatility": 1 }
5360
]

automations/feed_table_generator.py

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import json
22
import logging
33
import sys
4+
import time
45
from pathlib import Path
56

67
import requests
@@ -24,10 +25,19 @@
2425
"name": "Fantom",
2526
"decimals": 6,
2627
"category": "Crypto",
28+
},
29+
"USDX/USD": {
30+
"name": "Hex Trust USD",
31+
"decimals": 5,
32+
"category": "Crypto",
2733
}
2834
}
2935

3036

37+
class FeedRiskNotFoundError(Exception):
38+
pass
39+
40+
3141
def get_contract_abi(contract_address: str) -> dict:
3242
"""Get the ABI for a contract from the Chain Explorer API."""
3343
params = {"module": "contract", "action": "getabi", "address": contract_address}
@@ -76,13 +86,15 @@ def read_data_from_file(file_path: Path) -> list[dict]:
7686
return data
7787

7888

79-
def get_coins_list(pages: list) -> list[dict]:
89+
def get_coins_list(num_pages: int) -> list[dict]:
8090
"""Get the top 500 coins from CoinGecko."""
8191
cg = CoinGeckoAPI()
8292
coins = []
93+
logger.info("Querying %i pages on CoinGecko...", num_pages)
8394
try:
84-
for page in pages:
95+
for page in range(1, num_pages + 1):
8596
coins += cg.get_coins_markets(vs_currency="usd", per_page=250, page=page)
97+
time.sleep(0.5)
8698
except Exception:
8799
logger.exception("Error fetching coins from CoinGecko")
88100
sys.exit(1)
@@ -118,6 +130,12 @@ def generate_feed_data(
118130
logger.warning("Coin %s not found in CoinGecko data", name)
119131
continue
120132

133+
try:
134+
risk = feed_risk[idx].get("volatility", -1)
135+
except IndexError as e:
136+
msg = f"Unable to find risk for {name}"
137+
raise FeedRiskNotFoundError(msg) from e
138+
121139
if include_index:
122140
feed_data = {
123141
"feed_name": name,
@@ -126,16 +144,16 @@ def generate_feed_data(
126144
"decimals": decimal,
127145
"base_asset": coin.get("name"),
128146
"category": coin.get("category", "Crypto"),
129-
"risk": feed_risk[idx].get("volatility", -1),
147+
"risk": risk,
130148
}
131149
else:
132150
feed_data = {
133151
"feed_name": name,
134152
"feed_id": feed_id,
135153
"decimals": decimal,
136-
"base_asset": coin["name"],
154+
"base_asset": coin.get("name"),
137155
"category": "Crypto",
138-
"risk": feed_risk[idx].get("volatility", -1),
156+
"risk": risk,
139157
}
140158
data.append(feed_data)
141159
return data
@@ -171,8 +189,8 @@ def generate_feed_data(
171189
decimals = block_latency_feeds[2]
172190
logger.debug("Found %d block-latency feeds", len(feed_names))
173191

174-
# Query CoinGecko for top 750 coins
175-
coins_list = get_coins_list(pages=[1, 2, 3])
192+
# Query CoinGecko for top N pages, where each page has 250 coins
193+
coins_list = get_coins_list(num_pages=8)
176194

177195
# Write block-latency feeds to file
178196
block_latency_risk = read_data_from_file(BLOCK_LATENCY_RISK_PATH)

automations/solidity_reference.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@
638638
},
639639
{
640640
"name": "FtsoFeedDecimals",
641-
"address": "0x681C1Bc09b64e8e0EEa9d40E480B08Ab6c3FeCE3"
641+
"address": "0x9391f16c2034CCe3cC139e9eE30E080EF524D4a9"
642642
},
643643
{
644644
"name": "FtsoFeedPublisher",
@@ -832,7 +832,7 @@
832832
},
833833
{
834834
"name": "FtsoFeedDecimals",
835-
"address": "0x7Ec85276c1b9d53b9ca46A6f307FB8C68f6E7921"
835+
"address": "0xC24bca265667CD2ABC412554FD39722cbaf78a4f"
836836
},
837837
{
838838
"name": "FtsoFeedPublisher",

0 commit comments

Comments
 (0)