@merkl/api 0.9.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +90 -0
- package/dist/database/api/.generated/default.d.ts +1 -0
- package/dist/database/api/.generated/default.js +1 -0
- package/dist/database/api/.generated/drizzle/schema.d.ts +3029 -0
- package/dist/database/api/.generated/drizzle/schema.js +868 -0
- package/dist/database/api/.generated/drizzle/schema.ts +929 -0
- package/dist/database/api/.generated/edge.d.ts +1 -0
- package/dist/database/api/.generated/edge.js +691 -0
- package/dist/database/api/.generated/index-browser.js +650 -0
- package/dist/database/api/.generated/index.d.ts +46187 -0
- package/dist/database/api/.generated/index.js +720 -0
- package/dist/database/api/.generated/libquery_engine-debian-openssl-3.0.x.so.node +0 -0
- package/dist/database/api/.generated/libquery_engine-linux-arm64-openssl-1.1.x.so.node +0 -0
- package/dist/database/api/.generated/libquery_engine-linux-musl-arm64-openssl-3.0.x.so.node +0 -0
- package/dist/database/api/.generated/package.json +97 -0
- package/dist/database/api/.generated/runtime/edge-esm.js +31 -0
- package/dist/database/api/.generated/runtime/edge.js +31 -0
- package/dist/database/api/.generated/runtime/index-browser.d.ts +365 -0
- package/dist/database/api/.generated/runtime/index-browser.js +13 -0
- package/dist/database/api/.generated/runtime/library.d.ts +3447 -0
- package/dist/database/api/.generated/runtime/library.js +143 -0
- package/dist/database/api/.generated/runtime/react-native.js +80 -0
- package/dist/database/api/.generated/runtime/wasm.js +32 -0
- package/dist/database/api/.generated/schema.prisma +457 -0
- package/dist/database/api/.generated/wasm.d.ts +1 -0
- package/dist/database/api/.generated/wasm.js +650 -0
- package/dist/database/api/seeder/resources/protocol.d.ts +373 -0
- package/dist/database/api/seeder/resources/protocol.js +344 -0
- package/dist/database/engine/.generated/default.d.ts +1 -0
- package/dist/database/engine/.generated/default.js +1 -0
- package/dist/database/engine/.generated/edge.d.ts +1 -0
- package/dist/database/engine/.generated/edge.js +436 -0
- package/dist/database/engine/.generated/index-browser.js +411 -0
- package/dist/database/engine/.generated/index.d.ts +18906 -0
- package/dist/database/engine/.generated/index.js +465 -0
- package/dist/database/engine/.generated/libquery_engine-debian-openssl-3.0.x.so.node +0 -0
- package/dist/database/engine/.generated/libquery_engine-linux-arm64-openssl-1.1.x.so.node +0 -0
- package/dist/database/engine/.generated/libquery_engine-linux-musl-arm64-openssl-3.0.x.so.node +0 -0
- package/dist/database/engine/.generated/package.json +97 -0
- package/dist/database/engine/.generated/runtime/edge-esm.js +31 -0
- package/dist/database/engine/.generated/runtime/edge.js +31 -0
- package/dist/database/engine/.generated/runtime/index-browser.d.ts +365 -0
- package/dist/database/engine/.generated/runtime/index-browser.js +13 -0
- package/dist/database/engine/.generated/runtime/library.d.ts +3447 -0
- package/dist/database/engine/.generated/runtime/library.js +143 -0
- package/dist/database/engine/.generated/runtime/react-native.js +80 -0
- package/dist/database/engine/.generated/runtime/wasm.js +32 -0
- package/dist/database/engine/.generated/schema.prisma +207 -0
- package/dist/database/engine/.generated/wasm.d.ts +1 -0
- package/dist/database/engine/.generated/wasm.js +411 -0
- package/dist/database/index.d.ts +29 -0
- package/dist/database/index.js +13 -0
- package/dist/src/backgroundJobs/index.d.ts +1 -0
- package/dist/src/backgroundJobs/index.js +57 -0
- package/dist/src/backgroundJobs/jobs/campaignsCacheUpdater.d.ts +50 -0
- package/dist/src/backgroundJobs/jobs/campaignsCacheUpdater.js +173 -0
- package/dist/src/backgroundJobs/jobs/health.d.ts +41 -0
- package/dist/src/backgroundJobs/jobs/health.js +15 -0
- package/dist/src/backgroundJobs/jobs/opportunityUpdater.d.ts +36 -0
- package/dist/src/backgroundJobs/jobs/opportunityUpdater.js +19 -0
- package/dist/src/cache/declaration.d.ts +133 -0
- package/dist/src/cache/declaration.js +121 -0
- package/dist/src/cache/index.d.ts +61 -0
- package/dist/src/cache/index.js +161 -0
- package/dist/src/cache/redis.d.ts +312 -0
- package/dist/src/cache/redis.js +56 -0
- package/dist/src/constants.d.ts +108 -0
- package/dist/src/constants.js +128 -0
- package/dist/src/eden/index.d.ts +20952 -0
- package/dist/src/eden/index.js +4 -0
- package/dist/src/engine/dynamicData/factory.d.ts +3 -0
- package/dist/src/engine/dynamicData/factory.js +54 -0
- package/dist/src/engine/dynamicData/implementations/Ajna.d.ts +7 -0
- package/dist/src/engine/dynamicData/implementations/Ajna.js +101 -0
- package/dist/src/engine/dynamicData/implementations/Ambiant.d.ts +7 -0
- package/dist/src/engine/dynamicData/implementations/Ambiant.js +227 -0
- package/dist/src/engine/dynamicData/implementations/Badger.d.ts +7 -0
- package/dist/src/engine/dynamicData/implementations/Badger.js +84 -0
- package/dist/src/engine/dynamicData/implementations/Clamm.d.ts +7 -0
- package/dist/src/engine/dynamicData/implementations/Clamm.js +970 -0
- package/dist/src/engine/dynamicData/implementations/Compound.d.ts +7 -0
- package/dist/src/engine/dynamicData/implementations/Compound.js +136 -0
- package/dist/src/engine/dynamicData/implementations/Dolomite.d.ts +7 -0
- package/dist/src/engine/dynamicData/implementations/Dolomite.js +53 -0
- package/dist/src/engine/dynamicData/implementations/EigenLayer.d.ts +7 -0
- package/dist/src/engine/dynamicData/implementations/EigenLayer.js +64 -0
- package/dist/src/engine/dynamicData/implementations/Encompassing.d.ts +7 -0
- package/dist/src/engine/dynamicData/implementations/Encompassing.js +26 -0
- package/dist/src/engine/dynamicData/implementations/Erc20.d.ts +6 -0
- package/dist/src/engine/dynamicData/implementations/Erc20.js +159 -0
- package/dist/src/engine/dynamicData/implementations/Erc20Snapshot.d.ts +7 -0
- package/dist/src/engine/dynamicData/implementations/Erc20Snapshot.js +32 -0
- package/dist/src/engine/dynamicData/implementations/EventBased.d.ts +7 -0
- package/dist/src/engine/dynamicData/implementations/EventBased.js +104 -0
- package/dist/src/engine/dynamicData/implementations/Hyperdrive.d.ts +7 -0
- package/dist/src/engine/dynamicData/implementations/Hyperdrive.js +106 -0
- package/dist/src/engine/dynamicData/implementations/Morpho.d.ts +7 -0
- package/dist/src/engine/dynamicData/implementations/Morpho.js +109 -0
- package/dist/src/engine/dynamicData/implementations/Radiant.d.ts +7 -0
- package/dist/src/engine/dynamicData/implementations/Radiant.js +117 -0
- package/dist/src/engine/dynamicData/implementations/Silo.d.ts +9 -0
- package/dist/src/engine/dynamicData/implementations/Silo.js +109 -0
- package/dist/src/engine/dynamicData/implementations/UniswapV4.d.ts +7 -0
- package/dist/src/engine/dynamicData/implementations/UniswapV4.js +249 -0
- package/dist/src/engine/dynamicData/implementations/Vest.d.ts +9 -0
- package/dist/src/engine/dynamicData/implementations/Vest.js +58 -0
- package/dist/src/engine/dynamicData/implementations/default.d.ts +5 -0
- package/dist/src/engine/dynamicData/implementations/default.js +5 -0
- package/dist/src/engine/dynamicData/utils/fetchA51Strategies.d.ts +18 -0
- package/dist/src/engine/dynamicData/utils/fetchA51Strategies.js +44 -0
- package/dist/src/engine/dynamicData/utils/fetchAmbientInfo.d.ts +12 -0
- package/dist/src/engine/dynamicData/utils/fetchAmbientInfo.js +59 -0
- package/dist/src/engine/dynamicData/utils/fetchClamInfo.d.ts +2 -0
- package/dist/src/engine/dynamicData/utils/fetchClamInfo.js +27 -0
- package/dist/src/engine/dynamicData/utils/fetchLogs.d.ts +10 -0
- package/dist/src/engine/dynamicData/utils/fetchLogs.js +149 -0
- package/dist/src/engine/dynamicData/utils/getCompV2ForksVaults.d.ts +19 -0
- package/dist/src/engine/dynamicData/utils/getCompV2ForksVaults.js +134 -0
- package/dist/src/engine/dynamicData/utils/getContractCreationBlock.d.ts +2 -0
- package/dist/src/engine/dynamicData/utils/getContractCreationBlock.js +44 -0
- package/dist/src/engine/dynamicData/utils/getDolomiteMarkets.d.ts +8 -0
- package/dist/src/engine/dynamicData/utils/getDolomiteMarkets.js +53 -0
- package/dist/src/engine/dynamicData/utils/getEulerV2Vaults.d.ts +8 -0
- package/dist/src/engine/dynamicData/utils/getEulerV2Vaults.js +209 -0
- package/dist/src/engine/dynamicData/utils/getUniswapV4Pools.d.ts +8 -0
- package/dist/src/engine/dynamicData/utils/getUniswapV4Pools.js +183 -0
- package/dist/src/engine/erc20SubTypeProcessors/GenericProcessor.d.ts +99 -0
- package/dist/src/engine/erc20SubTypeProcessors/GenericProcessor.js +329 -0
- package/dist/src/engine/erc20SubTypeProcessors/helpers/eulerVaultNames.d.ts +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/helpers/eulerVaultNames.js +13 -0
- package/dist/src/engine/erc20SubTypeProcessors/helpers/factoryFinder.d.ts +5 -0
- package/dist/src/engine/erc20SubTypeProcessors/helpers/factoryFinder.js +41 -0
- package/dist/src/engine/erc20SubTypeProcessors/helpers/getBlacklistedSupply.d.ts +2 -0
- package/dist/src/engine/erc20SubTypeProcessors/helpers/getBlacklistedSupply.js +22 -0
- package/dist/src/engine/erc20SubTypeProcessors/helpers/hardcoded.d.ts +3 -0
- package/dist/src/engine/erc20SubTypeProcessors/helpers/hardcoded.js +30 -0
- package/dist/src/engine/erc20SubTypeProcessors/helpers/metamorphoTvl.d.ts +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/helpers/metamorphoTvl.js +35 -0
- package/dist/src/engine/erc20SubTypeProcessors/helpers/ownerFinder.d.ts +2 -0
- package/dist/src/engine/erc20SubTypeProcessors/helpers/ownerFinder.js +12 -0
- package/dist/src/engine/erc20SubTypeProcessors/helpers/spliceTVL.d.ts +7 -0
- package/dist/src/engine/erc20SubTypeProcessors/helpers/spliceTVL.js +21 -0
- package/dist/src/engine/erc20SubTypeProcessors/helpers/tokenType.d.ts +107 -0
- package/dist/src/engine/erc20SubTypeProcessors/helpers/tokenType.js +193 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/AaveProcessor.d.ts +30 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/AaveProcessor.js +25 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/AnglesLiquid.d.ts +35 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/AnglesLiquid.js +50 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/AssetProcessor.d.ts +35 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/AssetProcessor.js +47 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/AuraProcessor.d.ts +70 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/AuraProcessor.js +110 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BEXRewardGaugeProcessor.d.ts +51 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BEXRewardGaugeProcessor.js +102 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerGaugeProcessor.d.ts +49 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerGaugeProcessor.js +83 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerPoolProcessor.d.ts +60 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerPoolProcessor.js +95 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerV3PoolProcessor.d.ts +44 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerV3PoolProcessor.js +75 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BeefyProcessor.d.ts +48 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BeefyProcessor.js +50 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BunniV2Processor.d.ts +45 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BunniV2Processor.js +87 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/CompoundProcessor.d.ts +44 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/CompoundProcessor.js +36 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/ERC4626Processor.d.ts +34 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/ERC4626Processor.js +36 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/EnzymeProcessor.d.ts +40 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/EnzymeProcessor.js +51 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/EqualizerGaugeProcessor.d.ts +28 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/EqualizerGaugeProcessor.js +53 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/EulerBorrowProcessor.d.ts +36 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/EulerBorrowProcessor.js +51 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/EulerLendProcessor.d.ts +36 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/EulerLendProcessor.js +47 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/FluidProcessor.d.ts +39 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/FluidProcessor.js +36 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/FraxProcessor.d.ts +33 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/FraxProcessor.js +41 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/GammaProcessor.d.ts +43 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/GammaProcessor.js +63 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/GearboxProcessor.d.ts +44 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/GearboxProcessor.js +57 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/HanjiVaultProcessor.d.ts +43 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/HanjiVaultProcessor.js +58 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/HoldStationProcessor.d.ts +29 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/HoldStationProcessor.js +34 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/HourglassProcessor.d.ts +36 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/HourglassProcessor.js +34 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/MaverickBPProcessor.d.ts +50 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/MaverickBPProcessor.js +74 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/MetamorphoProcessor.d.ts +33 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/MetamorphoProcessor.js +47 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/NoLinkVaultProcessor.d.ts +38 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/NoLinkVaultProcessor.js +81 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/PendleProcessor.d.ts +29 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/PendleProcessor.js +29 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/PendleYTProcessor.d.ts +29 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/PendleYTProcessor.js +29 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/RadiantProcessor.d.ts +32 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/RadiantProcessor.js +58 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/RfxProcessor.d.ts +40 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/RfxProcessor.js +67 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/Satlayer.d.ts +34 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/Satlayer.js +27 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/SpectraProcessor.d.ts +31 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/SpectraProcessor.js +41 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/SpectraYTProcessor.d.ts +31 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/SpectraYTProcessor.js +39 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/SpliceProcessor.d.ts +16 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/SpliceProcessor.js +36 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/SturdySiloProcessor.d.ts +39 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/SturdySiloProcessor.js +37 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/TempestVaultProcessor.d.ts +52 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/TempestVaultProcessor.js +79 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/TemplateProcessor.d.ts +32 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/TemplateProcessor.js +40 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/TorosProcessor.d.ts +30 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/TorosProcessor.js +33 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/UniswapProcessor.d.ts +44 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/UniswapProcessor.js +68 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/VicunaProcessor.d.ts +28 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/VicunaProcessor.js +35 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/WoofiProcessor.d.ts +32 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/WoofiProcessor.js +40 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/ZkSwapThreePoolProcessor.d.ts +53 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/ZkSwapThreePoolProcessor.js +55 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/curveNPoolProcessor.d.ts +39 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/curveNPoolProcessor.js +95 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/curveProcessor.d.ts +49 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/curveProcessor.js +70 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/processorMapping.d.ts +6 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/processorMapping.js +142 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/stakedCurveProcessor.d.ts +54 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/stakedCurveProcessor.js +77 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/xU308Processor.d.ts +37 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/xU308Processor.js +49 -0
- package/dist/src/engine/erc20SubTypeProcessors/subtypesPrices.d.ts +4 -0
- package/dist/src/engine/erc20SubTypeProcessors/subtypesPrices.js +24 -0
- package/dist/src/engine/erc20SubTypeProcessors/subtypesRound1.d.ts +3 -0
- package/dist/src/engine/erc20SubTypeProcessors/subtypesRound1.js +336 -0
- package/dist/src/engine/erc20SubTypeProcessors/subtypesRound2.d.ts +4 -0
- package/dist/src/engine/erc20SubTypeProcessors/subtypesRound2.js +22 -0
- package/dist/src/engine/erc20SubTypeProcessors/subtypesRound3.d.ts +3 -0
- package/dist/src/engine/erc20SubTypeProcessors/subtypesRound3.js +22 -0
- package/dist/src/engine/erc20SubTypeProcessors/subtypesRound4.d.ts +3 -0
- package/dist/src/engine/erc20SubTypeProcessors/subtypesRound4.js +22 -0
- package/dist/src/engine/opportunityMetadata/factory.d.ts +3 -0
- package/dist/src/engine/opportunityMetadata/factory.js +57 -0
- package/dist/src/engine/opportunityMetadata/implementations/Ajna.d.ts +15 -0
- package/dist/src/engine/opportunityMetadata/implementations/Ajna.js +52 -0
- package/dist/src/engine/opportunityMetadata/implementations/Ambiant.d.ts +15 -0
- package/dist/src/engine/opportunityMetadata/implementations/Ambiant.js +31 -0
- package/dist/src/engine/opportunityMetadata/implementations/Badger.d.ts +15 -0
- package/dist/src/engine/opportunityMetadata/implementations/Badger.js +25 -0
- package/dist/src/engine/opportunityMetadata/implementations/Clamm.d.ts +15 -0
- package/dist/src/engine/opportunityMetadata/implementations/Clamm.js +50 -0
- package/dist/src/engine/opportunityMetadata/implementations/Compound.d.ts +16 -0
- package/dist/src/engine/opportunityMetadata/implementations/Compound.js +20 -0
- package/dist/src/engine/opportunityMetadata/implementations/Default.d.ts +13 -0
- package/dist/src/engine/opportunityMetadata/implementations/Default.js +11 -0
- package/dist/src/engine/opportunityMetadata/implementations/Dolomite.d.ts +15 -0
- package/dist/src/engine/opportunityMetadata/implementations/Dolomite.js +17 -0
- package/dist/src/engine/opportunityMetadata/implementations/EigenLayer.d.ts +15 -0
- package/dist/src/engine/opportunityMetadata/implementations/EigenLayer.js +11 -0
- package/dist/src/engine/opportunityMetadata/implementations/Encompassing.d.ts +15 -0
- package/dist/src/engine/opportunityMetadata/implementations/Encompassing.js +37 -0
- package/dist/src/engine/opportunityMetadata/implementations/Erc20.d.ts +15 -0
- package/dist/src/engine/opportunityMetadata/implementations/Erc20.js +71 -0
- package/dist/src/engine/opportunityMetadata/implementations/Erc20Snapshot.d.ts +14 -0
- package/dist/src/engine/opportunityMetadata/implementations/Erc20Snapshot.js +10 -0
- package/dist/src/engine/opportunityMetadata/implementations/Euler.d.ts +15 -0
- package/dist/src/engine/opportunityMetadata/implementations/Euler.js +34 -0
- package/dist/src/engine/opportunityMetadata/implementations/EventBased.d.ts +20 -0
- package/dist/src/engine/opportunityMetadata/implementations/EventBased.js +45 -0
- package/dist/src/engine/opportunityMetadata/implementations/Hyperdrive.d.ts +15 -0
- package/dist/src/engine/opportunityMetadata/implementations/Hyperdrive.js +21 -0
- package/dist/src/engine/opportunityMetadata/implementations/Invalid.d.ts +11 -0
- package/dist/src/engine/opportunityMetadata/implementations/Invalid.js +10 -0
- package/dist/src/engine/opportunityMetadata/implementations/Ion.d.ts +16 -0
- package/dist/src/engine/opportunityMetadata/implementations/Ion.js +15 -0
- package/dist/src/engine/opportunityMetadata/implementations/JsonAirdrop.d.ts +15 -0
- package/dist/src/engine/opportunityMetadata/implementations/JsonAirdrop.js +38 -0
- package/dist/src/engine/opportunityMetadata/implementations/Morpho.d.ts +15 -0
- package/dist/src/engine/opportunityMetadata/implementations/Morpho.js +21 -0
- package/dist/src/engine/opportunityMetadata/implementations/Radiant.d.ts +15 -0
- package/dist/src/engine/opportunityMetadata/implementations/Radiant.js +11 -0
- package/dist/src/engine/opportunityMetadata/implementations/Silo.d.ts +15 -0
- package/dist/src/engine/opportunityMetadata/implementations/Silo.js +15 -0
- package/dist/src/engine/opportunityMetadata/implementations/UniswapV4.d.ts +15 -0
- package/dist/src/engine/opportunityMetadata/implementations/UniswapV4.js +28 -0
- package/dist/src/engine/opportunityMetadata/implementations/Vest.d.ts +15 -0
- package/dist/src/engine/opportunityMetadata/implementations/Vest.js +12 -0
- package/dist/src/entities/campaign.d.ts +58 -0
- package/dist/src/entities/campaign.js +136 -0
- package/dist/src/errors/BadRequest.error.d.ts +4 -0
- package/dist/src/errors/BadRequest.error.js +7 -0
- package/dist/src/errors/Conflict.error.d.ts +4 -0
- package/dist/src/errors/Conflict.error.js +7 -0
- package/dist/src/errors/HttpError.d.ts +11 -0
- package/dist/src/errors/HttpError.js +17 -0
- package/dist/src/errors/NotFound.error.d.ts +8 -0
- package/dist/src/errors/NotFound.error.js +12 -0
- package/dist/src/errors/Opportunity.error.d.ts +6 -0
- package/dist/src/errors/Opportunity.error.js +11 -0
- package/dist/src/errors/Unauthorized.error.d.ts +4 -0
- package/dist/src/errors/Unauthorized.error.js +7 -0
- package/dist/src/errors/VoidString.error.d.ts +4 -0
- package/dist/src/errors/VoidString.error.js +7 -0
- package/dist/src/errors/index.d.ts +5 -0
- package/dist/src/errors/index.js +5 -0
- package/dist/src/guards/BackOffice.guard.d.ts +7 -0
- package/dist/src/guards/BackOffice.guard.js +10 -0
- package/dist/src/guards/Engine.guard.d.ts +7 -0
- package/dist/src/guards/Engine.guard.js +10 -0
- package/dist/src/guards/TokenAuth.guard.d.ts +7 -0
- package/dist/src/guards/TokenAuth.guard.js +10 -0
- package/dist/src/hooks/checkQueryAddressValidity.d.ts +22 -0
- package/dist/src/hooks/checkQueryAddressValidity.js +7 -0
- package/dist/src/hooks/checkQueryChainIdValidity.d.ts +22 -0
- package/dist/src/hooks/checkQueryChainIdValidity.js +7 -0
- package/dist/src/index.d.ts +5237 -0
- package/dist/src/index.js +111 -0
- package/dist/src/jobs/dynamic-data.d.ts +9 -0
- package/dist/src/jobs/dynamic-data.js +24 -0
- package/dist/src/jobs/pendings.d.ts +1 -0
- package/dist/src/jobs/pendings.js +236 -0
- package/dist/src/jobs/prices.d.ts +1 -0
- package/dist/src/jobs/prices.js +10 -0
- package/dist/src/jobs/reward-breakdowns.d.ts +1 -0
- package/dist/src/jobs/reward-breakdowns.js +152 -0
- package/dist/src/jobs/rewards.d.ts +1 -0
- package/dist/src/jobs/rewards.js +112 -0
- package/dist/src/jobs/set-dungeon-keeper.d.ts +1 -0
- package/dist/src/jobs/set-dungeon-keeper.js +82 -0
- package/dist/src/jobs/update-dynamic-data.d.ts +1 -0
- package/dist/src/jobs/update-dynamic-data.js +62 -0
- package/dist/src/jobs/update-euler-vaults.d.ts +1 -0
- package/dist/src/jobs/update-euler-vaults.js +122 -0
- package/dist/src/jobs/update-uniswap-v4-pools.d.ts +1 -0
- package/dist/src/jobs/update-uniswap-v4-pools.js +14 -0
- package/dist/src/libs/computeFee.d.ts +4 -0
- package/dist/src/libs/computeFee.js +34 -0
- package/dist/src/libs/deprecated-merklv3/index.d.ts +5 -0
- package/dist/src/libs/deprecated-merklv3/index.js +184 -0
- package/dist/src/libs/getTokensList.d.ts +23 -0
- package/dist/src/libs/getTokensList.js +19 -0
- package/dist/src/libs/merklChainData.d.ts +4 -0
- package/dist/src/libs/merklChainData.js +115 -0
- package/dist/src/libs/parse/marketsWithCache.d.ts +4 -0
- package/dist/src/libs/parse/marketsWithCache.js +8 -0
- package/dist/src/libs/positions/EigenLayer/index.d.ts +6 -0
- package/dist/src/libs/positions/EigenLayer/index.js +54 -0
- package/dist/src/libs/positions/ajna/index.d.ts +6 -0
- package/dist/src/libs/positions/ajna/index.js +107 -0
- package/dist/src/libs/positions/badger/index.d.ts +6 -0
- package/dist/src/libs/positions/badger/index.js +80 -0
- package/dist/src/libs/positions/clamm/index.d.ts +7 -0
- package/dist/src/libs/positions/clamm/index.js +412 -0
- package/dist/src/libs/positions/clamm/thegraph/fetchAlmPositions.d.ts +5 -0
- package/dist/src/libs/positions/clamm/thegraph/fetchAlmPositions.js +36 -0
- package/dist/src/libs/positions/clamm/thegraph/fetchAmmPositions.d.ts +8 -0
- package/dist/src/libs/positions/clamm/thegraph/fetchAmmPositions.js +36 -0
- package/dist/src/libs/positions/clamm/thegraph/fetchFarmedPositions.d.ts +10 -0
- package/dist/src/libs/positions/clamm/thegraph/fetchFarmedPositions.js +42 -0
- package/dist/src/libs/positions/clamm/thegraph/index.d.ts +40 -0
- package/dist/src/libs/positions/clamm/thegraph/index.js +163 -0
- package/dist/src/libs/positions/compound/index.d.ts +24 -0
- package/dist/src/libs/positions/compound/index.js +91 -0
- package/dist/src/libs/positions/dolomite/index.d.ts +17 -0
- package/dist/src/libs/positions/dolomite/index.js +51 -0
- package/dist/src/libs/positions/erc20/index.d.ts +5 -0
- package/dist/src/libs/positions/erc20/index.js +56 -0
- package/dist/src/libs/positions/euler/index.d.ts +5 -0
- package/dist/src/libs/positions/euler/index.js +57 -0
- package/dist/src/libs/positions/index.d.ts +3 -0
- package/dist/src/libs/positions/index.js +53 -0
- package/dist/src/libs/positions/morpho/index.d.ts +6 -0
- package/dist/src/libs/positions/morpho/index.js +177 -0
- package/dist/src/libs/positions/prepareFetch.d.ts +22 -0
- package/dist/src/libs/positions/prepareFetch.js +392 -0
- package/dist/src/libs/positions/silo/index.d.ts +5 -0
- package/dist/src/libs/positions/silo/index.js +68 -0
- package/dist/src/libs/positions/types.d.ts +75 -0
- package/dist/src/libs/positions/types.js +1 -0
- package/dist/src/libs/staticCampaigns.d.ts +7 -0
- package/dist/src/libs/staticCampaigns.js +15 -0
- package/dist/src/libs/tokens/allowances.d.ts +1 -0
- package/dist/src/libs/tokens/allowances.js +18 -0
- package/dist/src/libs/tokens/balances.d.ts +11 -0
- package/dist/src/libs/tokens/balances.js +127 -0
- package/dist/src/libs/tokens/tokenInfo.d.ts +8 -0
- package/dist/src/libs/tokens/tokenInfo.js +22 -0
- package/dist/src/modules/v4/accounting/accounting.controller.d.ts +219 -0
- package/dist/src/modules/v4/accounting/accounting.controller.js +66 -0
- package/dist/src/modules/v4/accounting/accounting.model.d.ts +32 -0
- package/dist/src/modules/v4/accounting/accounting.model.js +32 -0
- package/dist/src/modules/v4/accounting/accounting.repository.d.ts +99 -0
- package/dist/src/modules/v4/accounting/accounting.repository.js +100 -0
- package/dist/src/modules/v4/accounting/accounting.service.d.ts +59 -0
- package/dist/src/modules/v4/accounting/accounting.service.js +107 -0
- package/dist/src/modules/v4/accounting/index.d.ts +3 -0
- package/dist/src/modules/v4/accounting/index.js +3 -0
- package/dist/src/modules/v4/airflow/airflow.service.d.ts +3 -0
- package/dist/src/modules/v4/airflow/airflow.service.js +20 -0
- package/dist/src/modules/v4/apr/apr.model.d.ts +41 -0
- package/dist/src/modules/v4/apr/apr.model.js +15 -0
- package/dist/src/modules/v4/apr/apr.service.d.ts +6 -0
- package/dist/src/modules/v4/apr/apr.service.js +49 -0
- package/dist/src/modules/v4/apr/index.d.ts +2 -0
- package/dist/src/modules/v4/apr/index.js +2 -0
- package/dist/src/modules/v4/blacklist/blacklist.controller.d.ts +123 -0
- package/dist/src/modules/v4/blacklist/blacklist.controller.js +42 -0
- package/dist/src/modules/v4/blacklist/blacklist.model.d.ts +15 -0
- package/dist/src/modules/v4/blacklist/blacklist.model.js +13 -0
- package/dist/src/modules/v4/blacklist/blacklist.repository.d.ts +21 -0
- package/dist/src/modules/v4/blacklist/blacklist.repository.js +50 -0
- package/dist/src/modules/v4/blacklist/blacklist.service.d.ts +24 -0
- package/dist/src/modules/v4/blacklist/blacklist.service.js +31 -0
- package/dist/src/modules/v4/blacklist/index.d.ts +3 -0
- package/dist/src/modules/v4/blacklist/index.js +3 -0
- package/dist/src/modules/v4/boost/boost.controller.d.ts +88 -0
- package/dist/src/modules/v4/boost/boost.controller.js +15 -0
- package/dist/src/modules/v4/boost/boost.model.d.ts +12 -0
- package/dist/src/modules/v4/boost/boost.model.js +14 -0
- package/dist/src/modules/v4/boost/boost.service.d.ts +11 -0
- package/dist/src/modules/v4/boost/boost.service.js +20 -0
- package/dist/src/modules/v4/boost/index.d.ts +2 -0
- package/dist/src/modules/v4/boost/index.js +2 -0
- package/dist/src/modules/v4/bucket/bucket.model.d.ts +10 -0
- package/dist/src/modules/v4/bucket/bucket.model.js +85 -0
- package/dist/src/modules/v4/bucket/bucket.service.d.ts +11 -0
- package/dist/src/modules/v4/bucket/bucket.service.js +170 -0
- package/dist/src/modules/v4/cache/cache.model.d.ts +13 -0
- package/dist/src/modules/v4/cache/cache.model.js +14 -0
- package/dist/src/modules/v4/cache/cache.repository.d.ts +5 -0
- package/dist/src/modules/v4/cache/cache.repository.js +62 -0
- package/dist/src/modules/v4/cache/cache.service.d.ts +9 -0
- package/dist/src/modules/v4/cache/cache.service.js +50 -0
- package/dist/src/modules/v4/cache/index.d.ts +1 -0
- package/dist/src/modules/v4/cache/index.js +1 -0
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +632 -0
- package/dist/src/modules/v4/campaign/campaign.controller.js +149 -0
- package/dist/src/modules/v4/campaign/campaign.model.d.ts +165 -0
- package/dist/src/modules/v4/campaign/campaign.model.js +113 -0
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +735 -0
- package/dist/src/modules/v4/campaign/campaign.repository.js +448 -0
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +728 -0
- package/dist/src/modules/v4/campaign/campaign.service.js +309 -0
- package/dist/src/modules/v4/campaign/index.d.ts +2 -0
- package/dist/src/modules/v4/campaign/index.js +2 -0
- package/dist/src/modules/v4/chain/chain.controller.d.ts +145 -0
- package/dist/src/modules/v4/chain/chain.controller.js +44 -0
- package/dist/src/modules/v4/chain/chain.model.d.ts +43 -0
- package/dist/src/modules/v4/chain/chain.model.js +38 -0
- package/dist/src/modules/v4/chain/chain.repository.d.ts +75 -0
- package/dist/src/modules/v4/chain/chain.repository.js +70 -0
- package/dist/src/modules/v4/chain/chain.service.d.ts +55 -0
- package/dist/src/modules/v4/chain/chain.service.js +48 -0
- package/dist/src/modules/v4/chainInteraction/chainInteraction.service.d.ts +2 -0
- package/dist/src/modules/v4/chainInteraction/chainInteraction.service.js +4 -0
- package/dist/src/modules/v4/claims/claims.controller.d.ts +42 -0
- package/dist/src/modules/v4/claims/claims.controller.js +18 -0
- package/dist/src/modules/v4/claims/claims.model.d.ts +9 -0
- package/dist/src/modules/v4/claims/claims.model.js +1 -0
- package/dist/src/modules/v4/claims/claims.repository.d.ts +5 -0
- package/dist/src/modules/v4/claims/claims.repository.js +39 -0
- package/dist/src/modules/v4/claims/claims.service.d.ts +9 -0
- package/dist/src/modules/v4/claims/claims.service.js +40 -0
- package/dist/src/modules/v4/computedValue/computedValue.controller.d.ts +119 -0
- package/dist/src/modules/v4/computedValue/computedValue.controller.js +45 -0
- package/dist/src/modules/v4/computedValue/computedValue.model.d.ts +27 -0
- package/dist/src/modules/v4/computedValue/computedValue.model.js +30 -0
- package/dist/src/modules/v4/computedValue/computedValue.repository.d.ts +16 -0
- package/dist/src/modules/v4/computedValue/computedValue.repository.js +48 -0
- package/dist/src/modules/v4/computedValue/computedValue.service.d.ts +16 -0
- package/dist/src/modules/v4/computedValue/computedValue.service.js +25 -0
- package/dist/src/modules/v4/computedValue/index.d.ts +2 -0
- package/dist/src/modules/v4/computedValue/index.js +2 -0
- package/dist/src/modules/v4/creator/creator.controller.d.ts +118 -0
- package/dist/src/modules/v4/creator/creator.controller.js +30 -0
- package/dist/src/modules/v4/creator/creator.model.d.ts +29 -0
- package/dist/src/modules/v4/creator/creator.model.js +18 -0
- package/dist/src/modules/v4/creator/creator.repository.d.ts +40 -0
- package/dist/src/modules/v4/creator/creator.repository.js +63 -0
- package/dist/src/modules/v4/creator/creator.service.d.ts +61 -0
- package/dist/src/modules/v4/creator/creator.service.js +44 -0
- package/dist/src/modules/v4/creator/index.d.ts +3 -0
- package/dist/src/modules/v4/creator/index.js +3 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.d.ts +49 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.js +19 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.model.d.ts +60 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.model.js +54 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.repository.d.ts +0 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.repository.js +1 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.service.d.ts +14 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.service.js +131 -0
- package/dist/src/modules/v4/enso/enso.model.d.ts +166 -0
- package/dist/src/modules/v4/enso/enso.model.js +147 -0
- package/dist/src/modules/v4/enso/enso.service.d.ts +69 -0
- package/dist/src/modules/v4/enso/enso.service.js +116 -0
- package/dist/src/modules/v4/explorer/explorer.controller.d.ts +45 -0
- package/dist/src/modules/v4/explorer/explorer.controller.js +13 -0
- package/dist/src/modules/v4/explorer/explorer.model.d.ts +16 -0
- package/dist/src/modules/v4/explorer/explorer.model.js +8 -0
- package/dist/src/modules/v4/explorer/explorer.repository.d.ts +21 -0
- package/dist/src/modules/v4/explorer/explorer.repository.js +23 -0
- package/dist/src/modules/v4/explorer/explorer.service.d.ts +28 -0
- package/dist/src/modules/v4/explorer/explorer.service.js +24 -0
- package/dist/src/modules/v4/interaction/interaction.controller.d.ts +97 -0
- package/dist/src/modules/v4/interaction/interaction.controller.js +40 -0
- package/dist/src/modules/v4/interaction/interaction.model.d.ts +110 -0
- package/dist/src/modules/v4/interaction/interaction.model.js +25 -0
- package/dist/src/modules/v4/interaction/interaction.service.d.ts +38 -0
- package/dist/src/modules/v4/interaction/interaction.service.js +95 -0
- package/dist/src/modules/v4/kyberzap/kyberzap.model.d.ts +114 -0
- package/dist/src/modules/v4/kyberzap/kyberzap.model.js +83 -0
- package/dist/src/modules/v4/kyberzap/kyberzap.service.d.ts +34 -0
- package/dist/src/modules/v4/kyberzap/kyberzap.service.js +176 -0
- package/dist/src/modules/v4/liquidity/implementations/AjnaPositionFetcher.d.ts +6 -0
- package/dist/src/modules/v4/liquidity/implementations/AjnaPositionFetcher.js +90 -0
- package/dist/src/modules/v4/liquidity/implementations/BadgerPositionFetcher.d.ts +6 -0
- package/dist/src/modules/v4/liquidity/implementations/BadgerPositionFetcher.js +69 -0
- package/dist/src/modules/v4/liquidity/implementations/ClammPositionFetcher.d.ts +6 -0
- package/dist/src/modules/v4/liquidity/implementations/ClammPositionFetcher.js +61 -0
- package/dist/src/modules/v4/liquidity/implementations/DolomitePositionFetcher.d.ts +6 -0
- package/dist/src/modules/v4/liquidity/implementations/DolomitePositionFetcher.js +45 -0
- package/dist/src/modules/v4/liquidity/implementations/ERC20PositionFetcher.d.ts +6 -0
- package/dist/src/modules/v4/liquidity/implementations/ERC20PositionFetcher.js +47 -0
- package/dist/src/modules/v4/liquidity/implementations/EulerPositionFetcher.d.ts +6 -0
- package/dist/src/modules/v4/liquidity/implementations/EulerPositionFetcher.js +40 -0
- package/dist/src/modules/v4/liquidity/liquidity.controller.d.ts +39 -0
- package/dist/src/modules/v4/liquidity/liquidity.controller.js +16 -0
- package/dist/src/modules/v4/liquidity/liquidity.model.d.ts +25 -0
- package/dist/src/modules/v4/liquidity/liquidity.model.js +5 -0
- package/dist/src/modules/v4/liquidity/liquidity.repository.d.ts +14 -0
- package/dist/src/modules/v4/liquidity/liquidity.repository.js +6 -0
- package/dist/src/modules/v4/liquidity/liquidity.service.d.ts +5 -0
- package/dist/src/modules/v4/liquidity/liquidity.service.js +34 -0
- package/dist/src/modules/v4/merklRoot/index.d.ts +3 -0
- package/dist/src/modules/v4/merklRoot/index.js +3 -0
- package/dist/src/modules/v4/merklRoot/merklRoot.controller.d.ts +93 -0
- package/dist/src/modules/v4/merklRoot/merklRoot.controller.js +31 -0
- package/dist/src/modules/v4/merklRoot/merklRoot.model.d.ts +13 -0
- package/dist/src/modules/v4/merklRoot/merklRoot.model.js +12 -0
- package/dist/src/modules/v4/merklRoot/merklRoot.repository.d.ts +29 -0
- package/dist/src/modules/v4/merklRoot/merklRoot.repository.js +35 -0
- package/dist/src/modules/v4/merklRoot/merklRoot.service.d.ts +46 -0
- package/dist/src/modules/v4/merklRoot/merklRoot.service.js +44 -0
- package/dist/src/modules/v4/opportunity/index.d.ts +3 -0
- package/dist/src/modules/v4/opportunity/index.js +3 -0
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +958 -0
- package/dist/src/modules/v4/opportunity/opportunity.controller.js +155 -0
- package/dist/src/modules/v4/opportunity/opportunity.converter.d.ts +10 -0
- package/dist/src/modules/v4/opportunity/opportunity.converter.js +174 -0
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +357 -0
- package/dist/src/modules/v4/opportunity/opportunity.model.js +112 -0
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +985 -0
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +430 -0
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +982 -0
- package/dist/src/modules/v4/opportunity/opportunity.service.js +302 -0
- package/dist/src/modules/v4/opportunity/transform-id.pipe.d.ts +5 -0
- package/dist/src/modules/v4/opportunity/transform-id.pipe.js +6 -0
- package/dist/src/modules/v4/opportunity/validate-id.pipe.d.ts +5 -0
- package/dist/src/modules/v4/opportunity/validate-id.pipe.js +12 -0
- package/dist/src/modules/v4/price/index.d.ts +3 -0
- package/dist/src/modules/v4/price/index.js +3 -0
- package/dist/src/modules/v4/price/price.controller.d.ts +185 -0
- package/dist/src/modules/v4/price/price.controller.js +55 -0
- package/dist/src/modules/v4/price/price.model.d.ts +32 -0
- package/dist/src/modules/v4/price/price.model.js +12 -0
- package/dist/src/modules/v4/price/price.repository.d.ts +36 -0
- package/dist/src/modules/v4/price/price.repository.js +22 -0
- package/dist/src/modules/v4/price/price.service.d.ts +40 -0
- package/dist/src/modules/v4/price/price.service.js +44 -0
- package/dist/src/modules/v4/prisma/index.d.ts +32 -0
- package/dist/src/modules/v4/prisma/index.js +1 -0
- package/dist/src/modules/v4/programPayload/programPayload.controller.d.ts +281 -0
- package/dist/src/modules/v4/programPayload/programPayload.controller.js +85 -0
- package/dist/src/modules/v4/programPayload/programPayload.model.d.ts +262 -0
- package/dist/src/modules/v4/programPayload/programPayload.model.js +176 -0
- package/dist/src/modules/v4/programPayload/programPayload.repository.d.ts +926 -0
- package/dist/src/modules/v4/programPayload/programPayload.repository.js +5418 -0
- package/dist/src/modules/v4/programPayload/programPayload.service.d.ts +26 -0
- package/dist/src/modules/v4/programPayload/programPayload.service.js +218 -0
- package/dist/src/modules/v4/protocol/protocol.controller.d.ts +155 -0
- package/dist/src/modules/v4/protocol/protocol.controller.js +38 -0
- package/dist/src/modules/v4/protocol/protocol.model.d.ts +55 -0
- package/dist/src/modules/v4/protocol/protocol.model.js +115 -0
- package/dist/src/modules/v4/protocol/protocol.repository.d.ts +79 -0
- package/dist/src/modules/v4/protocol/protocol.repository.js +81 -0
- package/dist/src/modules/v4/protocol/protocol.service.d.ts +24 -0
- package/dist/src/modules/v4/protocol/protocol.service.js +62 -0
- package/dist/src/modules/v4/referral/referral.controller.d.ts +82 -0
- package/dist/src/modules/v4/referral/referral.controller.js +25 -0
- package/dist/src/modules/v4/referral/referral.model.d.ts +10 -0
- package/dist/src/modules/v4/referral/referral.model.js +12 -0
- package/dist/src/modules/v4/referral/referral.service.d.ts +216 -0
- package/dist/src/modules/v4/referral/referral.service.js +171 -0
- package/dist/src/modules/v4/reward/index.d.ts +2 -0
- package/dist/src/modules/v4/reward/index.js +2 -0
- package/dist/src/modules/v4/reward/reward.controller.d.ts +338 -0
- package/dist/src/modules/v4/reward/reward.controller.js +124 -0
- package/dist/src/modules/v4/reward/reward.converter.d.ts +14 -0
- package/dist/src/modules/v4/reward/reward.converter.js +124 -0
- package/dist/src/modules/v4/reward/reward.model.d.ts +240 -0
- package/dist/src/modules/v4/reward/reward.model.js +159 -0
- package/dist/src/modules/v4/reward/reward.repository.d.ts +156 -0
- package/dist/src/modules/v4/reward/reward.repository.js +305 -0
- package/dist/src/modules/v4/reward/reward.service.d.ts +595 -0
- package/dist/src/modules/v4/reward/reward.service.js +347 -0
- package/dist/src/modules/v4/router.d.ts +4375 -0
- package/dist/src/modules/v4/router.js +76 -0
- package/dist/src/modules/v4/status/status.controller.d.ts +239 -0
- package/dist/src/modules/v4/status/status.controller.js +68 -0
- package/dist/src/modules/v4/status/status.model.d.ts +63 -0
- package/dist/src/modules/v4/status/status.model.js +34 -0
- package/dist/src/modules/v4/status/status.repository.d.ts +104 -0
- package/dist/src/modules/v4/status/status.repository.js +146 -0
- package/dist/src/modules/v4/status/status.service.d.ts +88 -0
- package/dist/src/modules/v4/status/status.service.js +144 -0
- package/dist/src/modules/v4/token/token.controller.d.ts +360 -0
- package/dist/src/modules/v4/token/token.controller.js +108 -0
- package/dist/src/modules/v4/token/token.model.d.ts +113 -0
- package/dist/src/modules/v4/token/token.model.js +74 -0
- package/dist/src/modules/v4/token/token.repository.d.ts +114 -0
- package/dist/src/modules/v4/token/token.repository.js +169 -0
- package/dist/src/modules/v4/token/token.service.d.ts +266 -0
- package/dist/src/modules/v4/token/token.service.js +422 -0
- package/dist/src/modules/v4/tracer/index.d.ts +1 -0
- package/dist/src/modules/v4/tracer/index.js +1 -0
- package/dist/src/modules/v4/tracer/tracer.service.d.ts +3 -0
- package/dist/src/modules/v4/tracer/tracer.service.js +30 -0
- package/dist/src/modules/v4/tvl/index.d.ts +2 -0
- package/dist/src/modules/v4/tvl/index.js +2 -0
- package/dist/src/modules/v4/tvl/tvl.model.d.ts +39 -0
- package/dist/src/modules/v4/tvl/tvl.model.js +15 -0
- package/dist/src/modules/v4/tvl/tvl.service.d.ts +6 -0
- package/dist/src/modules/v4/tvl/tvl.service.js +49 -0
- package/dist/src/modules/v4/uniswapV4/index.d.ts +4 -0
- package/dist/src/modules/v4/uniswapV4/index.js +4 -0
- package/dist/src/modules/v4/uniswapV4/uniswapV4.controller.d.ts +53 -0
- package/dist/src/modules/v4/uniswapV4/uniswapV4.controller.js +12 -0
- package/dist/src/modules/v4/uniswapV4/uniswapV4.model.d.ts +24 -0
- package/dist/src/modules/v4/uniswapV4/uniswapV4.model.js +17 -0
- package/dist/src/modules/v4/uniswapV4/uniswapV4.repository.d.ts +13 -0
- package/dist/src/modules/v4/uniswapV4/uniswapV4.repository.js +12 -0
- package/dist/src/modules/v4/uniswapV4/uniswapV4.service.d.ts +22 -0
- package/dist/src/modules/v4/uniswapV4/uniswapV4.service.js +247 -0
- package/dist/src/modules/v4/user/user.controller.d.ts +408 -0
- package/dist/src/modules/v4/user/user.controller.js +89 -0
- package/dist/src/modules/v4/user/user.model.d.ts +70 -0
- package/dist/src/modules/v4/user/user.model.js +67 -0
- package/dist/src/modules/v4/user/user.repository.d.ts +29 -0
- package/dist/src/modules/v4/user/user.repository.js +38 -0
- package/dist/src/modules/v4/user/user.service.d.ts +31 -0
- package/dist/src/modules/v4/user/user.service.js +67 -0
- package/dist/src/plugins/error-handling.plugin.d.ts +29 -0
- package/dist/src/plugins/error-handling.plugin.js +34 -0
- package/dist/src/routes/v1/allowances.d.ts +67 -0
- package/dist/src/routes/v1/allowances.js +115 -0
- package/dist/src/routes/v1/balances.d.ts +50 -0
- package/dist/src/routes/v1/balances.js +25 -0
- package/dist/src/routes/v1/prices.d.ts +42 -0
- package/dist/src/routes/v1/prices.js +9 -0
- package/dist/src/routes/v1/router.d.ts +102 -0
- package/dist/src/routes/v1/router.js +6 -0
- package/dist/src/routes/v1/tokens.d.ts +45 -0
- package/dist/src/routes/v1/tokens.js +17 -0
- package/dist/src/routes/v2/merkl.d.ts +55 -0
- package/dist/src/routes/v2/merkl.js +13 -0
- package/dist/src/routes/v2/router.d.ts +46 -0
- package/dist/src/routes/v2/router.js +3 -0
- package/dist/src/routes/v3/app.d.ts +48 -0
- package/dist/src/routes/v3/app.js +38 -0
- package/dist/src/routes/v3/blacklist.d.ts +45 -0
- package/dist/src/routes/v3/blacklist.js +19 -0
- package/dist/src/routes/v3/campaign/delay.d.ts +49 -0
- package/dist/src/routes/v3/campaign/delay.js +81 -0
- package/dist/src/routes/v3/campaignClaims.d.ts +48 -0
- package/dist/src/routes/v3/campaignClaims.js +29 -0
- package/dist/src/routes/v3/campaignUnclaimed.d.ts +47 -0
- package/dist/src/routes/v3/campaignUnclaimed.js +28 -0
- package/dist/src/routes/v3/campaigns.d.ts +58 -0
- package/dist/src/routes/v3/campaigns.js +136 -0
- package/dist/src/routes/v3/campaignsForMainParameter.d.ts +54 -0
- package/dist/src/routes/v3/campaignsForMainParameter.js +33 -0
- package/dist/src/routes/v3/campaignsRewardsReport.d.ts +47 -0
- package/dist/src/routes/v3/campaignsRewardsReport.js +48 -0
- package/dist/src/routes/v3/claims.d.ts +48 -0
- package/dist/src/routes/v3/claims.js +16 -0
- package/dist/src/routes/v3/compoundV2.d.ts +42 -0
- package/dist/src/routes/v3/compoundV2.js +9 -0
- package/dist/src/routes/v3/createCampaign.d.ts +47 -0
- package/dist/src/routes/v3/createCampaign.js +66 -0
- package/dist/src/routes/v3/dolomite.d.ts +46 -0
- package/dist/src/routes/v3/dolomite.js +12 -0
- package/dist/src/routes/v3/euler.d.ts +53 -0
- package/dist/src/routes/v3/euler.js +17 -0
- package/dist/src/routes/v3/fetch.d.ts +46 -0
- package/dist/src/routes/v3/fetch.js +27 -0
- package/dist/src/routes/v3/health.d.ts +40 -0
- package/dist/src/routes/v3/health.js +13 -0
- package/dist/src/routes/v3/lostyield.d.ts +53 -0
- package/dist/src/routes/v3/lostyield.js +101 -0
- package/dist/src/routes/v3/merkl.d.ts +88 -0
- package/dist/src/routes/v3/merkl.js +119 -0
- package/dist/src/routes/v3/morphoMarkets.d.ts +62 -0
- package/dist/src/routes/v3/morphoMarkets.js +27 -0
- package/dist/src/routes/v3/morphoVaults.d.ts +52 -0
- package/dist/src/routes/v3/morphoVaults.js +22 -0
- package/dist/src/routes/v3/multiChainPositions.d.ts +45 -0
- package/dist/src/routes/v3/multiChainPositions.js +70 -0
- package/dist/src/routes/v3/opportunity.d.ts +52 -0
- package/dist/src/routes/v3/opportunity.js +28 -0
- package/dist/src/routes/v3/overview.d.ts +78 -0
- package/dist/src/routes/v3/overview.js +72 -0
- package/dist/src/routes/v3/parse.d.ts +47 -0
- package/dist/src/routes/v3/parse.js +23 -0
- package/dist/src/routes/v3/payload.d.ts +58 -0
- package/dist/src/routes/v3/payload.js +40 -0
- package/dist/src/routes/v3/poolInfo.d.ts +43 -0
- package/dist/src/routes/v3/poolInfo.js +88 -0
- package/dist/src/routes/v3/positions.d.ts +62 -0
- package/dist/src/routes/v3/positions.js +62 -0
- package/dist/src/routes/v3/radiant.d.ts +56 -0
- package/dist/src/routes/v3/radiant.js +26 -0
- package/dist/src/routes/v3/recipients.d.ts +46 -0
- package/dist/src/routes/v3/recipients.js +29 -0
- package/dist/src/routes/v3/rewards.d.ts +73 -0
- package/dist/src/routes/v3/rewards.js +36 -0
- package/dist/src/routes/v3/rewardsReport.d.ts +56 -0
- package/dist/src/routes/v3/rewardsReport.js +40 -0
- package/dist/src/routes/v3/router.d.ts +752 -0
- package/dist/src/routes/v3/router.js +70 -0
- package/dist/src/routes/v3/silo.d.ts +53 -0
- package/dist/src/routes/v3/silo.js +20 -0
- package/dist/src/routes/v3/token.d.ts +51 -0
- package/dist/src/routes/v3/token.js +24 -0
- package/dist/src/routes/v3/twt/participants.d.ts +41 -0
- package/dist/src/routes/v3/twt/participants.js +63 -0
- package/dist/src/routes/v3/uniswapv4.d.ts +42 -0
- package/dist/src/routes/v3/uniswapv4.js +9 -0
- package/dist/src/routes/v3/updates.d.ts +53 -0
- package/dist/src/routes/v3/updates.js +47 -0
- package/dist/src/routes/v3/userRewards.d.ts +69 -0
- package/dist/src/routes/v3/userRewards.js +62 -0
- package/dist/src/types/external/spectraAPI.d.ts +88 -0
- package/dist/src/types/external/spectraAPI.js +1 -0
- package/dist/src/types/index.d.ts +20 -0
- package/dist/src/types/index.js +1 -0
- package/dist/src/types/returnTypes.d.ts +19 -0
- package/dist/src/types/returnTypes.js +1 -0
- package/dist/src/types/utils.d.ts +5 -0
- package/dist/src/types/utils.js +1 -0
- package/dist/src/utils/bigintToString.d.ts +1 -0
- package/dist/src/utils/bigintToString.js +20 -0
- package/dist/src/utils/caseChanges.d.ts +3 -0
- package/dist/src/utils/caseChanges.js +12 -0
- package/dist/src/utils/decodeCalls.d.ts +3 -0
- package/dist/src/utils/decodeCalls.js +306 -0
- package/dist/src/utils/encodeCalls.d.ts +3 -0
- package/dist/src/utils/encodeCalls.js +490 -0
- package/dist/src/utils/error.d.ts +60 -0
- package/dist/src/utils/error.js +102 -0
- package/dist/src/utils/execute.d.ts +22 -0
- package/dist/src/utils/execute.js +117 -0
- package/dist/src/utils/generateCardName.d.ts +6 -0
- package/dist/src/utils/generateCardName.js +198 -0
- package/dist/src/utils/generateIcons.d.ts +3 -0
- package/dist/src/utils/generateIcons.js +65 -0
- package/dist/src/utils/generic.d.ts +7 -0
- package/dist/src/utils/generic.js +43 -0
- package/dist/src/utils/hashArray.d.ts +2 -0
- package/dist/src/utils/hashArray.js +7 -0
- package/dist/src/utils/lastBlockBefore.d.ts +3 -0
- package/dist/src/utils/lastBlockBefore.js +78 -0
- package/dist/src/utils/logger.d.ts +62 -0
- package/dist/src/utils/logger.js +52 -0
- package/dist/src/utils/pricer.d.ts +54 -0
- package/dist/src/utils/pricer.js +189 -0
- package/dist/src/utils/prices/chainlinkRead.d.ts +4 -0
- package/dist/src/utils/prices/chainlinkRead.js +8 -0
- package/dist/src/utils/prices/curveVirtualPrice.d.ts +4 -0
- package/dist/src/utils/prices/curveVirtualPrice.js +7 -0
- package/dist/src/utils/prices/getDQUICK.d.ts +4 -0
- package/dist/src/utils/prices/getDQUICK.js +8 -0
- package/dist/src/utils/prices/priceFetcherFactory.d.ts +10 -0
- package/dist/src/utils/prices/priceFetcherFactory.js +29 -0
- package/dist/src/utils/prices/priceService.d.ts +13 -0
- package/dist/src/utils/prices/priceService.js +308 -0
- package/dist/src/utils/prices/services/coinGeckoService.d.ts +12 -0
- package/dist/src/utils/prices/services/coinGeckoService.js +61 -0
- package/dist/src/utils/prices/services/defillamaService.d.ts +12 -0
- package/dist/src/utils/prices/services/defillamaService.js +53 -0
- package/dist/src/utils/prices/services/dexScreenerService.d.ts +12 -0
- package/dist/src/utils/prices/services/dexScreenerService.js +62 -0
- package/dist/src/utils/prices/services/erc4626Service.d.ts +9 -0
- package/dist/src/utils/prices/services/erc4626Service.js +38 -0
- package/dist/src/utils/prices/services/getERC4626.d.ts +4 -0
- package/dist/src/utils/prices/services/getERC4626.js +11 -0
- package/dist/src/utils/prices/services/indexCoopService.d.ts +12 -0
- package/dist/src/utils/prices/services/indexCoopService.js +55 -0
- package/dist/src/utils/prices/services/priceFetcher.d.ts +8 -0
- package/dist/src/utils/prices/services/priceFetcher.js +1 -0
- package/dist/src/utils/prices/uniV2Price.d.ts +7 -0
- package/dist/src/utils/prices/uniV2Price.js +40 -0
- package/dist/src/utils/providers.d.ts +13 -0
- package/dist/src/utils/providers.js +37 -0
- package/dist/src/utils/queries/allCampaigns.d.ts +2 -0
- package/dist/src/utils/queries/allCampaigns.js +12 -0
- package/dist/src/utils/stryke.d.ts +2 -0
- package/dist/src/utils/stryke.js +4 -0
- package/dist/src/utils/throw.d.ts +21 -0
- package/dist/src/utils/throw.js +44 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -0
- package/package.json +109 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ChainId } from "@sdk";
|
|
2
|
+
export type PricerDataType = {
|
|
3
|
+
prices: {
|
|
4
|
+
[token: string]: number;
|
|
5
|
+
};
|
|
6
|
+
extraPricesData: {
|
|
7
|
+
method: number;
|
|
8
|
+
symbol: string;
|
|
9
|
+
address: string;
|
|
10
|
+
chainId: ChainId;
|
|
11
|
+
}[];
|
|
12
|
+
};
|
|
13
|
+
export declare enum PRICING_METHODS {
|
|
14
|
+
defillama = 0,
|
|
15
|
+
quickswap = 1,
|
|
16
|
+
abandonned = -1
|
|
17
|
+
}
|
|
18
|
+
export declare class Pricer {
|
|
19
|
+
prices: PricerDataType["prices"];
|
|
20
|
+
extraPricesData: PricerDataType["extraPricesData"];
|
|
21
|
+
constructor(prices: PricerDataType["prices"], extraPricesData: PricerDataType["extraPricesData"]);
|
|
22
|
+
static load(): Promise<Pricer>;
|
|
23
|
+
getArray(): {
|
|
24
|
+
rate: number;
|
|
25
|
+
token: string;
|
|
26
|
+
}[];
|
|
27
|
+
/** Tries to fetch a given price sequentially using a given method */
|
|
28
|
+
fetchPerMethod(x: {
|
|
29
|
+
symbol?: string;
|
|
30
|
+
address?: string;
|
|
31
|
+
chainId?: ChainId;
|
|
32
|
+
}, method: PRICING_METHODS): Promise<number>;
|
|
33
|
+
/** Tries to fetch a given price sequentially using all available methods */
|
|
34
|
+
fetch(x: {
|
|
35
|
+
symbol?: string;
|
|
36
|
+
address?: string;
|
|
37
|
+
chainId?: ChainId;
|
|
38
|
+
}): Promise<{
|
|
39
|
+
price: number;
|
|
40
|
+
method: number;
|
|
41
|
+
}>;
|
|
42
|
+
/** Returns the price if possible, otherwise tries to fetch it */
|
|
43
|
+
get(x: {
|
|
44
|
+
symbol?: string;
|
|
45
|
+
address?: string;
|
|
46
|
+
chainId?: ChainId;
|
|
47
|
+
}): Promise<number | undefined>;
|
|
48
|
+
/** Saves the current price data in the cache */
|
|
49
|
+
save(): Promise<void>;
|
|
50
|
+
/** Recomputes all prices and saves them in the cache */
|
|
51
|
+
update(): Promise<{
|
|
52
|
+
[token: string]: number;
|
|
53
|
+
}>;
|
|
54
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { Redis } from "@/cache";
|
|
2
|
+
import { ChainId, NETWORK_LABELS } from "@sdk";
|
|
3
|
+
import axios from "axios";
|
|
4
|
+
import { log } from "./logger";
|
|
5
|
+
import PriceService from "./prices/priceService";
|
|
6
|
+
const defiLamaChains = {
|
|
7
|
+
[ChainId.MAINNET]: "ethereum",
|
|
8
|
+
[ChainId.POLYGON]: "polygon",
|
|
9
|
+
[ChainId.FANTOM]: "fantom",
|
|
10
|
+
[ChainId.AVALANCHE]: "avax",
|
|
11
|
+
[ChainId.BSC]: "bsc",
|
|
12
|
+
[ChainId.OPTIMISM]: "optimism",
|
|
13
|
+
[ChainId.ARBITRUM]: "arbitrum",
|
|
14
|
+
[ChainId.BASE]: "base",
|
|
15
|
+
[ChainId.GNOSIS]: "gnosis",
|
|
16
|
+
};
|
|
17
|
+
export var PRICING_METHODS;
|
|
18
|
+
(function (PRICING_METHODS) {
|
|
19
|
+
PRICING_METHODS[PRICING_METHODS["defillama"] = 0] = "defillama";
|
|
20
|
+
PRICING_METHODS[PRICING_METHODS["quickswap"] = 1] = "quickswap";
|
|
21
|
+
PRICING_METHODS[PRICING_METHODS["abandonned"] = -1] = "abandonned";
|
|
22
|
+
})(PRICING_METHODS || (PRICING_METHODS = {}));
|
|
23
|
+
export class Pricer {
|
|
24
|
+
prices;
|
|
25
|
+
extraPricesData;
|
|
26
|
+
constructor(prices, extraPricesData) {
|
|
27
|
+
this.prices = prices;
|
|
28
|
+
this.extraPricesData = extraPricesData;
|
|
29
|
+
}
|
|
30
|
+
static async load() {
|
|
31
|
+
try {
|
|
32
|
+
const { prices, extraPricesData } = await Redis.get("Prices");
|
|
33
|
+
const pricer = new Pricer(prices ?? {}, extraPricesData ?? []);
|
|
34
|
+
if (!prices) {
|
|
35
|
+
log.error("Pricer", "prices not found in cache when instanciating class");
|
|
36
|
+
await pricer.update();
|
|
37
|
+
}
|
|
38
|
+
return pricer;
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
log.error("Pricer", "Failed to load prices from cache");
|
|
42
|
+
const pricer = new Pricer({}, []);
|
|
43
|
+
await pricer.update();
|
|
44
|
+
return pricer;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
getArray() {
|
|
48
|
+
return Object.keys(this.prices)
|
|
49
|
+
.filter(t => this.prices[t] >= 0)
|
|
50
|
+
.map(t => {
|
|
51
|
+
return {
|
|
52
|
+
rate: this.prices[t],
|
|
53
|
+
token: t,
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/** Tries to fetch a given price sequentially using a given method */
|
|
58
|
+
async fetchPerMethod(x, method) {
|
|
59
|
+
switch (method) {
|
|
60
|
+
case PRICING_METHODS.abandonned:
|
|
61
|
+
return 0;
|
|
62
|
+
case PRICING_METHODS.defillama: {
|
|
63
|
+
let defillamaId;
|
|
64
|
+
if (!!x.chainId && !!x.address) {
|
|
65
|
+
defillamaId = `${defiLamaChains[x.chainId] ?? NETWORK_LABELS[x.chainId].toLowerCase()}:${x.address}`;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
defillamaId = `coingecko:${x.symbol}`;
|
|
69
|
+
}
|
|
70
|
+
const defillamaUrl = `https://coins.llama.fi/prices/current/${defillamaId}`;
|
|
71
|
+
try {
|
|
72
|
+
return (await axios.get(defillamaUrl, { timeout: 1000 })).data.coins[defillamaId].price;
|
|
73
|
+
}
|
|
74
|
+
catch { }
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
case PRICING_METHODS.quickswap:
|
|
78
|
+
if (!!x.chainId && !!x.address) {
|
|
79
|
+
const quickswapUrl = `https://leaderboard.quickswap.exchange/utils/token-prices/v3?chainId=${x.chainId}&addresses=${x.address}`;
|
|
80
|
+
try {
|
|
81
|
+
return (await axios.get(quickswapUrl, { timeout: 1000 })).data?.[0].price;
|
|
82
|
+
}
|
|
83
|
+
catch { }
|
|
84
|
+
}
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
return 0;
|
|
88
|
+
}
|
|
89
|
+
/** Tries to fetch a given price sequentially using all available methods */
|
|
90
|
+
async fetch(x) {
|
|
91
|
+
if (!!x.symbol && x.symbol?.toLowerCase().includes("test"))
|
|
92
|
+
return { method: PRICING_METHODS.abandonned, price: 0 };
|
|
93
|
+
for (const method of Object.values(PRICING_METHODS)) {
|
|
94
|
+
if (method === Number.parseInt(method.toString())) {
|
|
95
|
+
const price = await this.fetchPerMethod(x, method);
|
|
96
|
+
if (!!price)
|
|
97
|
+
return { method, price };
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return { method: PRICING_METHODS.abandonned, price: 0 };
|
|
101
|
+
}
|
|
102
|
+
/** Returns the price if possible, otherwise tries to fetch it */
|
|
103
|
+
async get(x) {
|
|
104
|
+
if (x.symbol === "test")
|
|
105
|
+
return 0; // FIXME
|
|
106
|
+
// Normalize address
|
|
107
|
+
x.address = x?.address?.toLowerCase();
|
|
108
|
+
if (!!x.address && !!this.prices[x.address]) {
|
|
109
|
+
if (this.prices[x.address] !== -1)
|
|
110
|
+
return this.prices[x.address];
|
|
111
|
+
}
|
|
112
|
+
if (!!x.symbol && !!this.prices[x.symbol]) {
|
|
113
|
+
if (this.prices[x.symbol] === -1)
|
|
114
|
+
return undefined;
|
|
115
|
+
return this.prices[x.symbol];
|
|
116
|
+
}
|
|
117
|
+
if (!!x.symbol && x.symbol.toLowerCase().startsWith("w")) {
|
|
118
|
+
const symbol = x.symbol.slice(1);
|
|
119
|
+
if (!!this.prices[symbol]) {
|
|
120
|
+
if (this.prices[symbol] === -1)
|
|
121
|
+
return undefined;
|
|
122
|
+
return this.prices[symbol];
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (!!x.symbol && x.symbol.toLowerCase().startsWith("r")) {
|
|
126
|
+
const symbol = x.symbol.slice(1);
|
|
127
|
+
if (!!this.prices[symbol]) {
|
|
128
|
+
if (this.prices[symbol] === -1)
|
|
129
|
+
return undefined;
|
|
130
|
+
return this.prices[symbol];
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (!!x.symbol && x.symbol.toLowerCase().startsWith("r") && x.symbol.toLowerCase().endsWith("n")) {
|
|
134
|
+
const symbol = x.symbol.slice(1, -1);
|
|
135
|
+
if (!!this.prices[symbol]) {
|
|
136
|
+
if (this.prices[symbol] === -1)
|
|
137
|
+
return undefined;
|
|
138
|
+
return this.prices[symbol];
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (!!x.symbol && x.symbol.toLowerCase().startsWith("variableDebt")) {
|
|
142
|
+
const symbol = x.symbol.slice(12);
|
|
143
|
+
if (!!this.prices[symbol]) {
|
|
144
|
+
if (this.prices[symbol] === -1)
|
|
145
|
+
return undefined;
|
|
146
|
+
return this.prices[symbol];
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (!!x.symbol && x.symbol.toLowerCase().startsWith("variableDebt") && x.symbol.toLowerCase().endsWith("n")) {
|
|
150
|
+
const symbol = x.symbol.slice(12, -1);
|
|
151
|
+
if (!!this.prices[symbol]) {
|
|
152
|
+
if (this.prices[symbol] === -1)
|
|
153
|
+
return undefined;
|
|
154
|
+
return this.prices[symbol];
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/** Saves the current price data in the cache */
|
|
159
|
+
async save() {
|
|
160
|
+
await Redis.safeSet("Prices", {
|
|
161
|
+
extraPricesData: this.extraPricesData,
|
|
162
|
+
prices: this.prices,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/** Recomputes all prices and saves them in the cache */
|
|
166
|
+
async update() {
|
|
167
|
+
// Update prices
|
|
168
|
+
this.prices = await PriceService.instance.fetchPrices();
|
|
169
|
+
// Update extra prices
|
|
170
|
+
this.extraPricesData = this.extraPricesData.filter(x => !!x.symbol && this.prices[x.symbol] === undefined && !!x.address && this.prices[x.address] === undefined);
|
|
171
|
+
for (const x of this.extraPricesData) {
|
|
172
|
+
try {
|
|
173
|
+
const price = await this.fetchPerMethod({ address: x.address, chainId: x.chainId, symbol: x.symbol }, x.method);
|
|
174
|
+
if (!!price) {
|
|
175
|
+
log.info(`price for ${x.symbol} - ${x.address} on ${NETWORK_LABELS[x.chainId ?? 1]}: ${price} added to cache`);
|
|
176
|
+
if (!!x.address && this.prices[x.address] === undefined)
|
|
177
|
+
this.prices[x.address] = price;
|
|
178
|
+
if (!!x.symbol && this.prices[x.symbol] === undefined)
|
|
179
|
+
this.prices[x.symbol] = price;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
catch (e) {
|
|
183
|
+
log.error("pricer update", e);
|
|
184
|
+
}
|
|
185
|
+
} // Update extraPricesData
|
|
186
|
+
await this.save();
|
|
187
|
+
return this.prices;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BN2Number } from "@sdk";
|
|
2
|
+
import { Contract, utils } from "ethers";
|
|
3
|
+
import { providers } from "../providers";
|
|
4
|
+
export async function getChainlinkLatestPrice(chainId, oracle) {
|
|
5
|
+
const abi = new utils.Interface(["function latestAnswer() external view returns(int256)"]);
|
|
6
|
+
const contract = new Contract(oracle, abi, providers[chainId]);
|
|
7
|
+
return BN2Number(await contract.latestAnswer(), 8);
|
|
8
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BN2Number } from "@sdk";
|
|
2
|
+
import { Contract } from "ethers";
|
|
3
|
+
import { providers } from "../providers";
|
|
4
|
+
export async function getVirtualPrice(chainId, pool) {
|
|
5
|
+
const contract = new Contract(pool, ["function get_virtual_price() external view returns(uint256)"], providers[chainId]);
|
|
6
|
+
return BN2Number(await contract.get_virtual_price());
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BN2Number } from "@sdk";
|
|
2
|
+
import { Contract, utils } from "ethers";
|
|
3
|
+
import { providers } from "../providers";
|
|
4
|
+
export async function getDQUICKPrice(chainId, contractAddress, assetDecimals = 18, vaultDecimals = 18) {
|
|
5
|
+
const contract = new Contract(contractAddress, ["function dQUICKForQUICK(uint256) external view returns(uint256)"], providers[chainId]);
|
|
6
|
+
const assetAmount = await contract.dQUICKForQUICK(utils.parseUnits("1", vaultDecimals));
|
|
7
|
+
return BN2Number(assetAmount, assetDecimals);
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PriceSourceMethod } from "@db/api";
|
|
2
|
+
import type PriceFetcher from "./services/priceFetcher";
|
|
3
|
+
/**
|
|
4
|
+
* @description Factory pattern to get the correct price fetcher
|
|
5
|
+
*/
|
|
6
|
+
export default class PriceFetcherFactory {
|
|
7
|
+
static readonly instance: PriceFetcherFactory;
|
|
8
|
+
private constructor();
|
|
9
|
+
get(type: PriceSourceMethod): PriceFetcher;
|
|
10
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PriceSourceMethod } from "@db/api";
|
|
2
|
+
import CoingeckoService from "./services/coinGeckoService";
|
|
3
|
+
import DefillamaService from "./services/defillamaService";
|
|
4
|
+
import DexScreenerService from "./services/dexScreenerService";
|
|
5
|
+
import ERC4626Service from "./services/erc4626Service";
|
|
6
|
+
import IndexCoop from "./services/indexCoopService";
|
|
7
|
+
/**
|
|
8
|
+
* @description Factory pattern to get the correct price fetcher
|
|
9
|
+
*/
|
|
10
|
+
export default class PriceFetcherFactory {
|
|
11
|
+
static instance = new PriceFetcherFactory();
|
|
12
|
+
constructor() { }
|
|
13
|
+
get(type) {
|
|
14
|
+
switch (type) {
|
|
15
|
+
case PriceSourceMethod.COINGECKO:
|
|
16
|
+
return CoingeckoService.instance;
|
|
17
|
+
case PriceSourceMethod.DEFILLAMA:
|
|
18
|
+
return DefillamaService.instance;
|
|
19
|
+
case PriceSourceMethod.ERC4626:
|
|
20
|
+
return ERC4626Service.instance;
|
|
21
|
+
case PriceSourceMethod.DEXSCREENER:
|
|
22
|
+
return DexScreenerService.instance;
|
|
23
|
+
case PriceSourceMethod.INDEXCOOP:
|
|
24
|
+
return IndexCoop.instance;
|
|
25
|
+
default:
|
|
26
|
+
throw new Error(`Price reader service not found for ${type}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type PriceType = {
|
|
2
|
+
[token: string]: number;
|
|
3
|
+
};
|
|
4
|
+
export default class PriceService {
|
|
5
|
+
static readonly instance: PriceService;
|
|
6
|
+
private _prices;
|
|
7
|
+
private constructor();
|
|
8
|
+
get prices(): PriceType;
|
|
9
|
+
private setPrices;
|
|
10
|
+
fetchPrices(): Promise<PriceType>;
|
|
11
|
+
private setConstantPrices;
|
|
12
|
+
private setEqualsToPrices;
|
|
13
|
+
}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { PriceService as PriceSourceService } from "@/modules/v4/price";
|
|
2
|
+
import { PriceSourceMethod } from "@db/api";
|
|
3
|
+
import { BN2Number, ChainId, Stable, registry } from "@sdk";
|
|
4
|
+
import axios from "axios";
|
|
5
|
+
import { Contract } from "ethers";
|
|
6
|
+
import { constantChain } from "../../constants";
|
|
7
|
+
import { getTokensListWithCache } from "../../libs/getTokensList";
|
|
8
|
+
import { log } from "../logger";
|
|
9
|
+
import { providers } from "../providers";
|
|
10
|
+
import { getChainlinkLatestPrice } from "./chainlinkRead";
|
|
11
|
+
import { getVirtualPrice } from "./curveVirtualPrice";
|
|
12
|
+
import { getDQUICKPrice } from "./getDQUICK";
|
|
13
|
+
import PriceFetcherFactory from "./priceFetcherFactory";
|
|
14
|
+
import { getERC4626Price } from "./services/getERC4626";
|
|
15
|
+
import { getCurveV2Price, getUniV2Price } from "./uniV2Price";
|
|
16
|
+
export default class PriceService {
|
|
17
|
+
static instance = new PriceService();
|
|
18
|
+
_prices = {};
|
|
19
|
+
constructor() { }
|
|
20
|
+
get prices() {
|
|
21
|
+
return this._prices;
|
|
22
|
+
}
|
|
23
|
+
setPrices = (res) => {
|
|
24
|
+
res.forEach(tokenPrice => {
|
|
25
|
+
this._prices[tokenPrice.token] = tokenPrice.rate;
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
async fetchPrices() {
|
|
29
|
+
const tokenPriceSources = await PriceSourceService.findManyPriceSources({});
|
|
30
|
+
/**
|
|
31
|
+
* @description Factory pricer's call to get prices from different sources
|
|
32
|
+
*/
|
|
33
|
+
try {
|
|
34
|
+
for (const method of Object.values(PriceSourceMethod)) {
|
|
35
|
+
if (method !== PriceSourceMethod.CONSTANT && method !== PriceSourceMethod.EQUAL_TO) {
|
|
36
|
+
await PriceFetcherFactory.instance
|
|
37
|
+
.get(PriceSourceMethod[method])
|
|
38
|
+
.getPrice(tokenPriceSources)
|
|
39
|
+
.then(this.setPrices);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
log.error("Error fetching prices", e);
|
|
45
|
+
}
|
|
46
|
+
/** San Token Prices */
|
|
47
|
+
this._prices["sanUSDC_EUR"] = 1.2120307 * this._prices["USDC"];
|
|
48
|
+
this._prices["sanDAI_EUR"] = 1.0926287 * this._prices["DAI"];
|
|
49
|
+
this._prices["sanFRAX_EUR"] = 1.077969 * this._prices["FRAX"];
|
|
50
|
+
this._prices["sanFEI_EUR"] = 1.02814 * this._prices["FEI"];
|
|
51
|
+
this._prices["sanWETH_EUR"] = 6.732341 * this._prices["ETH"];
|
|
52
|
+
const promises = [];
|
|
53
|
+
/** Sushiswap & UniV2 Prices */
|
|
54
|
+
promises.push(getUniV2Price(ChainId.MAINNET, this._prices[Stable.EUR], this._prices["ANGLE"], "0x1f4c763bde1d4832b3ea0640e66da00b98831355").then(sushiEURA_ANGLE => {
|
|
55
|
+
if (!!sushiEURA_ANGLE) {
|
|
56
|
+
this._prices["Sushi EURA-ANGLE LP"] = sushiEURA_ANGLE;
|
|
57
|
+
}
|
|
58
|
+
}));
|
|
59
|
+
promises.push(getUniV2Price(ChainId.MAINNET, this._prices["ANGLE"], this._prices["ETH"], "0xfb55af0ef0dcdec92bd3752e7a9237dfefb8acc0").then(sushiANGLE_ETH => {
|
|
60
|
+
if (!!sushiANGLE_ETH) {
|
|
61
|
+
this._prices["Sushi ANGLE-ETH LP"] = sushiANGLE_ETH;
|
|
62
|
+
}
|
|
63
|
+
}));
|
|
64
|
+
promises.push(getUniV2Price(ChainId.MAINNET, this._prices[Stable.EUR], this._prices["FEI"], "0xf89ce5ed65737da8440411544b0499c9fad323b2").then(uni_EURA_FEI => {
|
|
65
|
+
if (!!uni_EURA_FEI) {
|
|
66
|
+
this._prices["Uni-V2 EURA-FEI LP"] = uni_EURA_FEI;
|
|
67
|
+
}
|
|
68
|
+
}));
|
|
69
|
+
promises.push(getUniV2Price(ChainId.MAINNET, this._prices["stTAO"], this._prices["WETH"], "0xAe57eB8DD23C90769962d413A8802Ba68181aD0F").then(uni_stTAO_WETH => {
|
|
70
|
+
if (!!uni_stTAO_WETH) {
|
|
71
|
+
this._prices["0xAe57eB8DD23C90769962d413A8802Ba68181aD0F"] = uni_stTAO_WETH;
|
|
72
|
+
}
|
|
73
|
+
}));
|
|
74
|
+
promises.push(getUniV2Price(ChainId.BLAST, this._prices["WETH"], this._prices["YIELD"], "0x3Df8AAC90Eb2FeeA4378368D46a72AF47eBDc268").then(uni_WETH_YIELD => {
|
|
75
|
+
if (!!uni_WETH_YIELD) {
|
|
76
|
+
this._prices["0x3Df8AAC90Eb2FeeA4378368D46a72AF47eBDc268"] = uni_WETH_YIELD;
|
|
77
|
+
}
|
|
78
|
+
}));
|
|
79
|
+
this.setConstantPrices(tokenPriceSources);
|
|
80
|
+
this.setEqualsToPrices(tokenPriceSources);
|
|
81
|
+
/** Hardcoded prices */
|
|
82
|
+
this._prices["oICL"] = 0.5 * this._prices["ICL"];
|
|
83
|
+
this._prices["$ERA"] = 0.001;
|
|
84
|
+
this._prices["Bridged mstETH"] = this._prices["mstETH"];
|
|
85
|
+
// Mock collats
|
|
86
|
+
this._prices["MockCollat0"] = this._prices["EUR"];
|
|
87
|
+
this._prices["MockCollat1"] = this._prices["EUR"];
|
|
88
|
+
this._prices["MockCollat2"] = this._prices["EUR"];
|
|
89
|
+
// USDA price
|
|
90
|
+
this._prices[Stable.USD] = 1;
|
|
91
|
+
this._prices["agUSD"] = 1;
|
|
92
|
+
// veANGLE price
|
|
93
|
+
this._prices["veANGLE"] = this._prices["ANGLE"];
|
|
94
|
+
// Hardcoded prices
|
|
95
|
+
this._prices["KAI"] = 0.015;
|
|
96
|
+
this._prices["USSD"] = 1;
|
|
97
|
+
this._prices["crvUSD"] = 1;
|
|
98
|
+
for (const id in ChainId) {
|
|
99
|
+
const chainId = Number(id);
|
|
100
|
+
const savingsAddressUSD = registry(chainId)?.USD?.Savings;
|
|
101
|
+
const savingsAddressEUR = registry(chainId)?.EUR?.Savings;
|
|
102
|
+
if (!!savingsAddressUSD) {
|
|
103
|
+
promises.push(getERC4626Price(chainId, savingsAddressUSD).then(sharePrice => {
|
|
104
|
+
this._prices[`stUSD-${chainId}`] = sharePrice * this._prices[Stable.USD];
|
|
105
|
+
this._prices[`STUSD-${chainId}`] = this._prices[`stUSD-${chainId}`];
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
if (!!savingsAddressEUR) {
|
|
109
|
+
promises.push(getERC4626Price(chainId, savingsAddressEUR).then(sharePrice => {
|
|
110
|
+
this._prices[`stEUR-${chainId}`] = sharePrice * this._prices[Stable.EUR];
|
|
111
|
+
this._prices[`STEUR-${chainId}`] = this._prices[`stEUR-${chainId}`];
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
promises.push(getERC4626Price(ChainId.MAINNET, "0xBEEF01735c132Ada46AA9aA4c54623cAA92A64CB", 6, 18).then(sharePrice => {
|
|
116
|
+
this._prices["steakUSDC"] = sharePrice * this._prices["USDC"];
|
|
117
|
+
this._prices["STEAKUSDC"] = this._prices["steakUSDC"];
|
|
118
|
+
this._prices["Steakhouse USDC"] = this._prices["steakUSDC"];
|
|
119
|
+
}));
|
|
120
|
+
promises.push(getERC4626Price(ChainId.BASE, "0xbEEfa1aBfEbE621DF50ceaEF9f54FdB73648c92C", 18, 18).then(sharePrice => {
|
|
121
|
+
this._prices["steakUSDA"] = sharePrice * this._prices["USDA"];
|
|
122
|
+
this._prices["STEAKUSDA"] = this._prices["steakUSDA"];
|
|
123
|
+
this._prices["Steakhouse USDA"] = this._prices["steakUSDA"];
|
|
124
|
+
}));
|
|
125
|
+
promises.push(getERC4626Price(ChainId.BASE, "0xBEeFA28D5e56d41D35df760AB53B94D9FfD7051F", 18, 18).then(sharePrice => {
|
|
126
|
+
this._prices["steakEURA"] = sharePrice * this._prices["EURA"];
|
|
127
|
+
this._prices["STEAKEURA"] = this._prices["steakEURA"];
|
|
128
|
+
this._prices["Steakhouse EURA"] = this._prices["steakEURA"];
|
|
129
|
+
}));
|
|
130
|
+
promises.push(getERC4626Price(ChainId.MAINNET, "0x125D41A6e5dbf455cD9Df8F80BCC6fd172D52Cc6", 18, 18).then(sharePrice => {
|
|
131
|
+
this._prices["gtUSDAcore"] = sharePrice;
|
|
132
|
+
this._prices["Gauntlet USDA Core"] = sharePrice;
|
|
133
|
+
}));
|
|
134
|
+
promises.push(getERC4626Price(ChainId.MAINNET, "0x89D80f5e9BC88d8021b352064ae73F0eAf79EBd8", 18, 18).then(sharePrice => {
|
|
135
|
+
this._prices["Re7USDA"] = sharePrice;
|
|
136
|
+
this._prices["Re7 USDA"] = sharePrice;
|
|
137
|
+
}));
|
|
138
|
+
promises.push(getDQUICKPrice(ChainId.POLYGON, "0x958d208Cdf087843e9AD98d23823d32E17d723A1").then(sharePrice => {
|
|
139
|
+
this._prices["dQUICK"] = sharePrice * this._prices["QUICK"];
|
|
140
|
+
this._prices["DQUICK"] = this._prices["dQUICK"];
|
|
141
|
+
}));
|
|
142
|
+
promises.push(getVirtualPrice(ChainId.MAINNET, "0xb9446c4Ef5EBE66268dA6700D26f96273DE3d571").then(virtualPrice => {
|
|
143
|
+
this._prices["Curve 3EUR LP"] = virtualPrice * this._prices[Stable.EUR];
|
|
144
|
+
}));
|
|
145
|
+
promises.push(getVirtualPrice(ChainId.MAINNET, "0xB37D6c07482Bc11cd28a1f11f1a6ad7b66Dec933").then(virtualPrice => {
|
|
146
|
+
this._prices["Curve EURA-ibEUR LP"] = virtualPrice * this._prices[Stable.EUR];
|
|
147
|
+
}));
|
|
148
|
+
promises.push(getVirtualPrice(ChainId.MAINNET, constantChain[ChainId.MAINNET].crvANGLESDANGLE).then(virtualPrice => {
|
|
149
|
+
this._prices["Curve sdANGLE-ANGLE LP"] = virtualPrice * this._prices["ANGLE"];
|
|
150
|
+
}));
|
|
151
|
+
promises.push(getVirtualPrice(ChainId.MAINNET, constantChain[ChainId.MAINNET].crvEuropool).then(virtualPrice => {
|
|
152
|
+
this._prices["Curve Europool LP"] = virtualPrice * this._prices[Stable.EUR];
|
|
153
|
+
}));
|
|
154
|
+
promises.push(getVirtualPrice(ChainId.MAINNET, constantChain[ChainId.MAINNET].crvEURAEUROC).then(virtualPrice => {
|
|
155
|
+
this._prices["Curve EURA-EUROC LP"] = virtualPrice * this._prices[Stable.EUR];
|
|
156
|
+
}));
|
|
157
|
+
promises.push(getVirtualPrice(ChainId.MAINNET, constantChain[ChainId.MAINNET].crvEURAEURe).then(virtualPrice => {
|
|
158
|
+
this._prices["Curve EURA-EURe LP"] = virtualPrice * this._prices[Stable.EUR];
|
|
159
|
+
}));
|
|
160
|
+
promises.push(getChainlinkLatestPrice(ChainId.MAINNET, "0x32d1463EB53b73C095625719Afa544D5426354cB").then(chainlinkPrice => {
|
|
161
|
+
this._prices["bIB01"] = chainlinkPrice;
|
|
162
|
+
this._prices["IB01"] = chainlinkPrice;
|
|
163
|
+
}));
|
|
164
|
+
promises.push(getChainlinkLatestPrice(ChainId.ARBITRUM, "0x1940fEd49cDBC397941f2D336eb4994D599e568B").then(chainlinkPrice => {
|
|
165
|
+
this._prices["zZRO"] = chainlinkPrice;
|
|
166
|
+
}));
|
|
167
|
+
promises.push(getChainlinkLatestPrice(ChainId.MAINNET, "0x9E8E794ad6Ecdb6d5c7eaBE059D30E907F58859b").then(chainlinkPrice => {
|
|
168
|
+
this._prices["bHIGH"] = chainlinkPrice * this._prices["EUR"];
|
|
169
|
+
this._prices["HIGH"] = chainlinkPrice * this._prices["EUR"];
|
|
170
|
+
}));
|
|
171
|
+
promises.push(getChainlinkLatestPrice(ChainId.MAINNET, "0x6E27A25999B3C665E44D903B2139F5a4Be2B6C26").then(chainlinkPrice => {
|
|
172
|
+
this._prices["bC3M"] = chainlinkPrice * this._prices["EUR"];
|
|
173
|
+
this._prices["C3M"] = chainlinkPrice * this._prices["EUR"];
|
|
174
|
+
}));
|
|
175
|
+
promises.push(getChainlinkLatestPrice(ChainId.MAINNET, "0x475855DAe09af1e3f2d380d766b9E630926ad3CE").then(chainlinkPrice => {
|
|
176
|
+
this._prices["bERNX"] = chainlinkPrice * this._prices["EUR"];
|
|
177
|
+
this._prices["ERNX"] = chainlinkPrice * this._prices["EUR"];
|
|
178
|
+
}));
|
|
179
|
+
promises.push(getChainlinkLatestPrice(ChainId.MAINNET, "0x2674Cc47786740432b895a70D92CFDfB1d5BF798").then(chainlinkPrice => {
|
|
180
|
+
this._prices["bERNA"] = chainlinkPrice;
|
|
181
|
+
this._prices["ERNA"] = chainlinkPrice;
|
|
182
|
+
}));
|
|
183
|
+
promises.push(getChainlinkLatestPrice(ChainId.ARBITRUM, "0x395D5c5D552Df670dc4B2B1cef0c4EABfFba492f").then(chainlinkPrice => {
|
|
184
|
+
this._prices["gmBTC"] = chainlinkPrice;
|
|
185
|
+
}));
|
|
186
|
+
promises.push(getChainlinkLatestPrice(ChainId.ARBITRUM, "0xfB3264D1129824933a52374c2C1696F4470D041e").then(chainlinkPrice => {
|
|
187
|
+
this._prices["gmETH"] = chainlinkPrice;
|
|
188
|
+
}));
|
|
189
|
+
promises.push(getCurveV2Price(ChainId.MAINNET, this._prices, "0x58257e4291F95165184b4beA7793a1d6F8e7b627", constantChain[ChainId.MAINNET].crvFRAXEURA).then(virtualPrice => {
|
|
190
|
+
this._prices["Curve EURA-FRAXBP LP"] = virtualPrice * this._prices[Stable.EUR];
|
|
191
|
+
}));
|
|
192
|
+
await Promise.allSettled(promises);
|
|
193
|
+
/** Camelot API price completion */
|
|
194
|
+
try {
|
|
195
|
+
await axios
|
|
196
|
+
.get("https://api.camelot.exchange/tokens")
|
|
197
|
+
.then(res => {
|
|
198
|
+
if (!!res.data.data.tokens) {
|
|
199
|
+
for (const x of Object.values(res.data.data.tokens)) {
|
|
200
|
+
if (this._prices[x.symbol] === undefined || this._prices[x.symbol] === null) {
|
|
201
|
+
this._prices[x.symbol] = x.price;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
log.error("❌ call to fetch camelot api price failed", error);
|
|
209
|
+
}
|
|
210
|
+
/** Retro API price completion */
|
|
211
|
+
try {
|
|
212
|
+
await axios
|
|
213
|
+
.get("https://retro-backend.stabl.finance/api/v1/assets")
|
|
214
|
+
.then(res => {
|
|
215
|
+
if (res.data.success) {
|
|
216
|
+
for (const x of res.data.data) {
|
|
217
|
+
if (this._prices[x.symbol] === undefined || this._prices[x.symbol] === null) {
|
|
218
|
+
this._prices[x.symbol] = x.price;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
log.error("❌ call to fetch retro api price failed", error);
|
|
226
|
+
}
|
|
227
|
+
/** Blueprint API price completion */
|
|
228
|
+
try {
|
|
229
|
+
await axios
|
|
230
|
+
.get("https://blue-backend.stabl.finance/api/v1/assets")
|
|
231
|
+
.then(res => {
|
|
232
|
+
if (res.data.success) {
|
|
233
|
+
for (const x of res.data.data) {
|
|
234
|
+
if (this._prices[x.symbol] === undefined || this._prices[x.symbol] === null) {
|
|
235
|
+
this._prices[x.symbol] = x.price;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
catch (error) {
|
|
242
|
+
log.error("❌ call to fetch blueprint api price failed", error);
|
|
243
|
+
}
|
|
244
|
+
/** Flux price completion */
|
|
245
|
+
promises.push((async () => {
|
|
246
|
+
try {
|
|
247
|
+
const d = await new Contract("0x465a5a630482f3abD6d3b84B39B29b07214d19e5", ["function exchangeRateStored() external view returns(uint256)"], providers[ChainId.MAINNET]).exchangeRateStored();
|
|
248
|
+
this._prices["fUSDC"] = this._prices["USDC"] * BN2Number(d) * 100;
|
|
249
|
+
this._prices["FUSDC"] = this._prices["fUSDC"];
|
|
250
|
+
}
|
|
251
|
+
catch (e) { }
|
|
252
|
+
})());
|
|
253
|
+
// Radiant prices
|
|
254
|
+
this._prices["rUSDCn"] = this._prices["USDC"];
|
|
255
|
+
for (const x of ["USDC", "USDT", "wstETH", "ARB", "wBTC", "DAI", "ETH"]) {
|
|
256
|
+
this._prices[`r${x}n`] = this._prices[x];
|
|
257
|
+
this._prices[`variableDebt${x}n`] = this._prices[x];
|
|
258
|
+
this._prices[`r${x}`] = this._prices[x];
|
|
259
|
+
this._prices[`variableDebt${x}`] = this._prices[x];
|
|
260
|
+
const xUpper = x.toUpperCase();
|
|
261
|
+
this._prices[`r${xUpper}n`] = this._prices[x];
|
|
262
|
+
this._prices[`variableDebt${xUpper}n`] = this._prices[x];
|
|
263
|
+
this._prices[`r${xUpper}`] = this._prices[x];
|
|
264
|
+
this._prices[`variableDebt${xUpper}`] = this._prices[x];
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* @deprecated - Fill all BorrowStaker prices
|
|
268
|
+
*/
|
|
269
|
+
const tokens = await getTokensListWithCache();
|
|
270
|
+
for (const chainIdString of Object.keys(tokens)) {
|
|
271
|
+
const chainId = Number.parseInt(chainIdString);
|
|
272
|
+
for (const token of Object.values(tokens?.[chainId] ?? {})) {
|
|
273
|
+
if (token.wrappingMethod === "BorrowStaker" && !!token.underlyingTokens) {
|
|
274
|
+
this._prices[token.address] = this._prices[token.underlyingTokens[0]];
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return this._prices;
|
|
279
|
+
}
|
|
280
|
+
setConstantPrices(tokens) {
|
|
281
|
+
const filteredTokens = tokens.filter(token => token.method === PriceSourceMethod.CONSTANT);
|
|
282
|
+
if (filteredTokens.length === 0)
|
|
283
|
+
return [];
|
|
284
|
+
return filteredTokens.forEach(token => {
|
|
285
|
+
const args = token.args;
|
|
286
|
+
if (args.value !== null && args.value !== undefined) {
|
|
287
|
+
this._prices[token.symbol] = args.value;
|
|
288
|
+
}
|
|
289
|
+
else
|
|
290
|
+
log.warn(`❌ constant price ${token.symbol} has incorrect value in database`);
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
setEqualsToPrices(tokens) {
|
|
294
|
+
const filteredTokens = tokens.filter(tokenPriceSource => tokenPriceSource.method === PriceSourceMethod.EQUAL_TO);
|
|
295
|
+
if (filteredTokens.length === 0)
|
|
296
|
+
return [];
|
|
297
|
+
return filteredTokens
|
|
298
|
+
.filter(token => token.method === PriceSourceMethod.EQUAL_TO)
|
|
299
|
+
.forEach(token => {
|
|
300
|
+
const args = token.args;
|
|
301
|
+
if (args.token !== null && args.token !== undefined) {
|
|
302
|
+
this._prices[token.symbol] = this._prices[args.token];
|
|
303
|
+
}
|
|
304
|
+
else
|
|
305
|
+
log.warn(`❌ equalsTo price ${token.symbol} has incorrect value in database`);
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type PriceSource } from "@db/api";
|
|
2
|
+
import type PriceFetcher from "./priceFetcher";
|
|
3
|
+
import type { ResponsePriceType } from "./priceFetcher";
|
|
4
|
+
export default class CoingeckoService implements PriceFetcher {
|
|
5
|
+
static readonly instance: CoingeckoService;
|
|
6
|
+
private constructor();
|
|
7
|
+
private baseUrl;
|
|
8
|
+
getPrice(tickers: PriceSource[]): Promise<ResponsePriceType[]>;
|
|
9
|
+
private buildUrl;
|
|
10
|
+
private fetchPrices;
|
|
11
|
+
private formatResponse;
|
|
12
|
+
}
|