Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: create new rest dlt factory #2663

Merged
merged 10 commits into from
Dec 21, 2024
375 changes: 375 additions & 0 deletions warehouse/oso_dagster/assets/defillama.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,375 @@
from dlt.sources.rest_api.typing import RESTAPIConfig

from ..factories.rest import create_rest_factory_asset

# Chains supported by DeFi Llama (https://defillama.com/chains)
DEFI_LLAMA_CHAINS = [
"ethereum",
"solana",
"tron",
"bitcoin",
"bsc",
"base",
"arbitrum",
"hyperliquid",
"sui",
"avalanche",
"aptos",
"polygon",
"core",
"optimism",
"pulsechain",
"cronos",
"blast",
"bitlayer",
"cardano",
"mantle",
"linea",
"thorchain",
"taiko",
"dydx",
"bsquared",
"gnosis",
"zircuit",
"near",
"starknet",
"ton",
"rootstock",
"scroll",
"sei",
"ailayer",
"kaia",
"bob",
"eos",
"kava",
"hedera",
"merlin",
"algorand",
"ronin",
"mode",
"multiversx",
"osmosis",
"celo",
"fantom",
"mixin",
"stacks",
"zksync era",
"filecoin",
"iota evm",
"wemix3.0",
"xrpl",
"bouncebit",
"hydration",
"fuel ignition",
"fraxtal",
"neutron",
"tezos",
"metis",
"icp",
"telos",
"injective",
"stellar",
"manta",
"flow",
"cronos zkevm",
"radix",
"conflux",
"bifrost network",
"flare",
"kujira",
"apechain",
"aurora",
"mayachain",
"astar",
"xdc",
"moonbeam",
"k2",
"map protocol",
"iotex",
"reya network",
"rollux",
"zklink nova",
"opbnb",
"icon",
"chainflip",
"secret",
"defichain",
"waves",
"bitcoincash",
"bifrost",
"neo",
"immutable zkevm",
"chiliz",
"zetachain",
"alephium",
"fsc",
"polygon zkevm",
"eos evm",
"ontology",
"canto",
"doge",
"ergo",
"x layer",
"terra2",
"onus",
"eclipse",
"venom",
"polynomial",
"dogechain",
"proton",
"morph",
"litecoin",
"dexalot",
"moonriver",
"wanchain",
"beam",
"dymension",
"oraichain",
"nuls",
"godwokenv1",
"vite",
"dfs network",
"dfk",
"carbon",
"vision",
"shibarium",
"oasys",
"acala",
"renec",
"harmony",
"interlay",
"horizen eon",
"lisk",
"gravity",
"ux",
"functionx",
"hydra",
"bevm",
"smartbch",
"aelf",
"oasis sapphire",
"re.al",
"thundercore",
"meter",
"archway",
"zilliqa",
"airdao",
"boba",
"oktchain",
"defiverse",
"theta",
"world chain",
"songbird",
"wax",
"kadena",
"velas",
"etherlink",
"kcc",
"xai",
"persistence one",
"elastos",
"astar zkevm",
"cosmoshub",
"xpla",
"arbitrum nova",
"terra classic",
"milkomeda c1",
"fuse",
"everscale",
"haqq",
"idex",
"genesys",
"rangers",
"degen",
"equilibrium",
"bitrock",
"oasis emerald",
"neon",
"elysium",
"rss3",
"vechain",
"taraxa",
"heco",
"ink",
"satoshivm",
"skale europa",
"bahamut",
"sanko",
"shimmerevm",
"lachain network",
"obyte",
"energi",
"csc",
"evmos",
"ultron",
"starcoin",
"saakuru",
"naka",
"ethereumclassic",
"viction",
"bittorrent",
"nos",
"chihuahua",
"bostrom",
"karura",
"juno",
"kroma",
"boba_bnb",
"hela",
"enuls",
"migaloo",
"unit0",
"crab",
"mint",
"tombchain",
"nolus",
"ancient8",
"lightlink",
"massa",
"kintsugi",
"dash",
"energyweb",
"defichain evm",
"zora",
"nibiru",
"step",
"shape",
"inevm",
"kardia",
"ethereumpow",
"sora",
"loop",
"zkfair",
"meer",
"matchain",
"libre",
"alv",
"godwoken",
"stargaze",
"endurance",
"q protocol",
"corn",
"rari",
"newton",
"nahmii",
"electroneum",
"shiden",
"aura network",
"bitkub chain",
"polkadex",
"comdex",
"sxnetwork",
"findora",
"neo x mainnet",
"crescent",
"grove",
"areon network",
"jbc",
"cyber",
"concordium",
"ethf",
"syscoin",
"callisto",
"rei",
"planq",
"ham",
"multivac",
"cube",
"mvc",
"hpb",
"shido",
"lachain",
"manta atlantic",
"vinuchain",
"darwinia",
"gochain",
"sifchain",
"ontologyevm",
"bitgert",
"reichain",
"tenet",
"zeniq",
"bitnet",
"aeternity",
"milkomeda a1",
"joltify",
"palm",
"asset chain",
"redbelly",
"pego",
"sonic",
"exsat",
"goerli",
"dexit",
"omax",
"celestia",
"bandchain",
"sommelier",
"stride",
"polkadot",
"kusama",
"fusion",
"boba_avax",
"stafi",
"oxfun",
"empire",
"hoo",
"echelon",
"quicksilver",
"clv",
"pokt",
"dsc",
"zksync lite",
"nova network",
"cmp",
"genshiro",
"lamden",
"polis",
"zyx",
"ubiq",
"heiko",
"parallel",
"coti",
"kekchain",
"muuchain",
"tlchain",
"bitindi",
"lung",
"bone",
"lukso",
]


config: RESTAPIConfig = {
"client": {
"base_url": "https://api.llama.fi/",
},
"resource_defaults": {
"endpoint": {
"params": {
"excludeTotalDataChart": False,
"excludeTotalDataChartBreakdown": True,
"fullChart": True,
},
},
},
"resources": list(
map(
lambda chain: {
"name": chain.replace(" ", "_"),
"endpoint": {
"path": f"overview/dexs/{chain.replace(' ', '%20')}",
},
},
DEFI_LLAMA_CHAINS,
)
),
}

dlt_assets = create_rest_factory_asset(
config=config,
)

tvl_assets = dlt_assets(
key_prefix="tvl",
)
6 changes: 6 additions & 0 deletions warehouse/oso_dagster/factories/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,10 @@ def load_assets_factories_from_modules(
dag.add(obj)
elif isinstance(obj, AssetFactoryResponse):
all = all + obj
elif isinstance(obj, list):
Jabolol marked this conversation as resolved.
Show resolved Hide resolved
for item in obj:
if isinstance(item, EarlyResourcesAssetFactory):
dag.add(item)
elif isinstance(item, AssetFactoryResponse):
all = all + item
return all
Loading
Loading