@merkl/api 0.21.47 → 1.0.0
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/dist/src/cache/index.d.ts +1 -1
- package/dist/src/constants.d.ts +8 -8
- package/dist/src/eden/index.d.ts +16937 -8167
- package/dist/src/eden/index.js +1 -1
- package/dist/src/engine/deprecated/dynamicData/implementations/Ajna.d.ts +1 -1
- package/dist/src/engine/deprecated/dynamicData/implementations/Badger.d.ts +1 -1
- package/dist/src/engine/deprecated/dynamicData/implementations/Clamm.d.ts +1 -1
- package/dist/src/engine/deprecated/dynamicData/implementations/Compound.d.ts +1 -1
- package/dist/src/engine/deprecated/dynamicData/implementations/CompoundV3.d.ts +1 -1
- package/dist/src/engine/deprecated/dynamicData/implementations/Dolomite.d.ts +1 -1
- package/dist/src/engine/deprecated/dynamicData/implementations/ERC721.d.ts +2 -2
- package/dist/src/engine/deprecated/dynamicData/implementations/ERCMultiToken.d.ts +2 -2
- package/dist/src/engine/deprecated/dynamicData/implementations/EigenLayer.d.ts +1 -1
- package/dist/src/engine/deprecated/dynamicData/implementations/Encompassing.d.ts +1 -1
- package/dist/src/engine/deprecated/dynamicData/implementations/Erc20.d.ts +105 -3
- package/dist/src/engine/deprecated/dynamicData/implementations/Erc20Snapshot.d.ts +1 -1
- package/dist/src/engine/deprecated/dynamicData/implementations/EventBased.d.ts +1 -1
- package/dist/src/engine/deprecated/dynamicData/implementations/Hyperdrive.d.ts +2 -2
- package/dist/src/engine/deprecated/dynamicData/implementations/Morpho.d.ts +1 -1
- package/dist/src/engine/deprecated/dynamicData/implementations/Radiant.d.ts +1 -1
- package/dist/src/engine/deprecated/dynamicData/implementations/Silo.d.ts +1 -1
- package/dist/src/engine/deprecated/dynamicData/implementations/UniswapV4.d.ts +1 -1
- package/dist/src/engine/deprecated/dynamicData/implementations/Vest.d.ts +1 -1
- package/dist/src/engine/deprecated/dynamicData/implementations/default.d.ts +2 -2
- package/dist/src/engine/deprecated/dynamicData/utils/fetchA51Strategies.d.ts +1 -1
- package/dist/src/engine/deprecated/dynamicData/utils/fetchClamInfo.d.ts +1 -1
- package/dist/src/engine/deprecated/dynamicData/utils/fetchLogs.d.ts +1 -1
- package/dist/src/engine/deprecated/dynamicData/utils/getCompV2ForksVaults.d.ts +1 -1
- package/dist/src/engine/deprecated/dynamicData/utils/getDolomiteMarkets.d.ts +1 -1
- package/dist/src/engine/deprecated/dynamicData/utils/getEulerV2Vaults.d.ts +1 -1
- package/dist/src/engine/deprecated/dynamicData/utils/getFixedApr.d.ts +1 -1
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/GenericProcessor.d.ts +6 -6
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/helpers/factoryFinder.d.ts +1 -1
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/helpers/hardcoded.d.ts +2 -2
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/helpers/ownerFinder.d.ts +1 -1
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/helpers/treasuryFinder.d.ts +1 -1
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/AaveProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/AnglesLiquid.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/AssetProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/AuraProcessor.d.ts +4 -4
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/BEXRewardGaugeProcessor.d.ts +4 -4
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/BalancerGaugeProcessor.d.ts +4 -4
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/BalancerPoolProcessor.d.ts +4 -4
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/BalancerV3PoolProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/BeefyProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/BunniV2Processor.d.ts +4 -4
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/CompoundProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/ERC4626Processor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/EnzymeProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/EqualizerGaugeProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/EulerBorrowProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/EulerLendProcessor.d.ts +2 -2
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/FluidProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/FraxProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/GammaALMProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/GammaProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/GearboxProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/HanjiVaultProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/HoldStationProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/HourglassProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/MaverickBPProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/MetamorphoProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/NoLinkVaultProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/PendleProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/PendleYTProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/RadiantProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/RfxProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/Satlayer.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/SpectraProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/SpectraYTProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/SpliceProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/StabilityProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/SturdySiloProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/TempestVaultProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/TemplateProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/TorosProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/UniswapProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/VicunaProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/WoofiProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/ZkSwapThreePoolProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/curveNPoolProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/curveProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/processorMapping.d.ts +1 -1
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/stakedCurveProcessor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/xU308Processor.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/subtypesPrices.d.ts +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/subtypesRound1.d.ts +1 -1
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/subtypesRound2.d.ts +2 -2
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/subtypesRound3.d.ts +2 -2
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/subtypesRound4.d.ts +2 -2
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/tokenTypeStruct.d.ts +2 -2
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/tokenTypeToProtocolAndAction.d.ts +3 -3
- package/dist/src/engine/implementations/Ajna/metadata.d.ts +5 -5
- package/dist/src/engine/implementations/Ajna/tvl.d.ts +2 -2
- package/dist/src/engine/implementations/Ambient/metadata.d.ts +5 -5
- package/dist/src/engine/implementations/Ambient/tvl.d.ts +2 -2
- package/dist/src/engine/implementations/Badger/metadata.d.ts +4 -4
- package/dist/src/engine/implementations/Clamm/metadata.d.ts +22 -22
- package/dist/src/engine/implementations/Compound/metadata.d.ts +4 -4
- package/dist/src/engine/implementations/CompoundV3/metadata.d.ts +4 -4
- package/dist/src/engine/implementations/Default/metadata.d.ts +3 -3
- package/dist/src/engine/implementations/Dolomite/metadata.d.ts +5 -5
- package/dist/src/engine/implementations/EigenLayer/metadata.d.ts +5 -5
- package/dist/src/engine/implementations/EigenLayer/tvl.d.ts +2 -2
- package/dist/src/engine/implementations/Encompassing/metadata.d.ts +3 -3
- package/dist/src/engine/implementations/Erc20/metadata.d.ts +4 -4
- package/dist/src/engine/implementations/Erc20/subTypes/detect.d.ts +2 -2
- package/dist/src/engine/implementations/Erc20/subTypes/factories.d.ts +4 -4
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/aave/metadata.d.ts +6 -6
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/aave/tvl.d.ts +4 -4
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/euler/metadata.d.ts +6 -6
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/euler/tvl.d.ts +2 -2
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/gearbox/metadata.d.ts +5 -5
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/gearbox/tvl.d.ts +4 -4
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/hypurrfiIsolatedMarket/metadata.d.ts +6 -6
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/hypurrfiIsolatedMarket/tvl.d.ts +4 -4
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/lendleVaults/metadata.d.ts +5 -5
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/lendleVaults/tvl.d.ts +4 -4
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/metamorpho/metadata.d.ts +17 -0
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/metamorpho/tvl.d.ts +6 -0
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/pino/metadata.d.ts +4 -4
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/pino/tvl.d.ts +4 -4
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/termmax/metadata.d.ts +5 -5
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/termmax/tvl.d.ts +4 -4
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/termmaxVault/metadata.d.ts +18 -0
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/termmaxVault/tvl.d.ts +6 -0
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/uniswapV2/metadata.d.ts +5 -5
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/uniswapV2/tvl.d.ts +4 -4
- package/dist/src/engine/implementations/Erc20/subTypes/index.d.ts +3 -2
- package/dist/src/engine/implementations/Erc20/tvl.d.ts +4 -4
- package/dist/src/engine/implementations/Erc20Snapshot/metadata.d.ts +4 -4
- package/dist/src/engine/implementations/Erc721/metadata.d.ts +4 -4
- package/dist/src/engine/implementations/ErcMultiToken/metadata.d.ts +6 -6
- package/dist/src/engine/implementations/EventBased/metadata.d.ts +5 -5
- package/dist/src/engine/implementations/FraxLend/metadataBorrow.d.ts +24 -0
- package/dist/src/engine/implementations/FraxLend/metadataCollateral.d.ts +18 -0
- package/dist/src/engine/implementations/FraxLend/tvlBorrow.d.ts +7 -0
- package/dist/src/engine/implementations/FraxLend/tvlCollateral.d.ts +7 -0
- package/dist/src/engine/implementations/Hyperdrive/metadata.d.ts +5 -5
- package/dist/src/engine/implementations/Invalid/metadata.d.ts +2 -2
- package/dist/src/engine/implementations/Ion/metadata.d.ts +5 -5
- package/dist/src/engine/implementations/JsonAirdrop/metadata.d.ts +7 -7
- package/dist/src/engine/implementations/Locker/metadata.d.ts +5 -5
- package/dist/src/engine/implementations/Locker/tvl.d.ts +2 -2
- package/dist/src/engine/implementations/Morpho/metadata.d.ts +7 -7
- package/dist/src/engine/implementations/MultiLog/metadata.d.ts +4 -4
- package/dist/src/engine/implementations/MultiLog/tvl.d.ts +3 -3
- package/dist/src/engine/implementations/Radiant/metadata.d.ts +4 -4
- package/dist/src/engine/implementations/Silo/metadata.d.ts +5 -5
- package/dist/src/engine/implementations/UniswapV4/metadata.d.ts +5 -5
- package/dist/src/engine/implementations/UniswapV4/tvl.d.ts +2 -2
- package/dist/src/engine/implementations/Vest/metadata.d.ts +4 -4
- package/dist/src/engine/implementations/morphoBorrow/metadata.d.ts +20 -0
- package/dist/src/engine/implementations/morphoBorrow/tvl.d.ts +7 -0
- package/dist/src/engine/implementations/morphoCollateral/metadata.d.ts +20 -0
- package/dist/src/engine/implementations/morphoCollateral/tvl.d.ts +7 -0
- package/dist/src/engine/implementations/morphoSupply/metadata.d.ts +20 -0
- package/dist/src/engine/implementations/morphoSupply/tvl.d.ts +7 -0
- package/dist/src/engine/metadata/factory.d.ts +1 -1
- package/dist/src/engine/tvl/factory.d.ts +2 -2
- package/dist/src/engine/tvl/logStates.d.ts +1 -1
- package/dist/src/hooks/checkQueryAddressValidity.d.ts +6 -2
- package/dist/src/hooks/checkQueryChainIdValidity.d.ts +6 -2
- package/dist/src/index.d.ts +5548 -2626
- package/dist/src/jobs/{dynamic-data.d.ts → update-v3-caches.d.ts} +4 -1
- package/dist/src/libs/computeFee.d.ts +1 -1
- package/dist/src/libs/deprecated-merklv3/index.d.ts +3 -3
- package/dist/src/libs/merklChainData.d.ts +1 -1
- package/dist/src/libs/parse/marketsWithCache.d.ts +1 -1
- package/dist/src/libs/positions/EigenLayer/index.d.ts +2 -2
- package/dist/src/libs/positions/ajna/index.d.ts +2 -2
- package/dist/src/libs/positions/badger/index.d.ts +2 -2
- package/dist/src/libs/positions/clamm/index.d.ts +1 -1
- package/dist/src/libs/positions/clamm/thegraph/fetchAlmPositions.d.ts +1 -1
- package/dist/src/libs/positions/clamm/thegraph/fetchAmmPositions.d.ts +1 -1
- package/dist/src/libs/positions/clamm/thegraph/fetchFarmedPositions.d.ts +1 -1
- package/dist/src/libs/positions/compound/index.d.ts +2 -2
- package/dist/src/libs/positions/dolomite/index.d.ts +2 -2
- package/dist/src/libs/positions/erc20/index.d.ts +2 -2
- package/dist/src/libs/positions/euler/index.d.ts +2 -2
- package/dist/src/libs/positions/index.d.ts +1 -1
- package/dist/src/libs/positions/morpho/index.d.ts +2 -2
- package/dist/src/libs/positions/prepareFetch.d.ts +1 -1
- package/dist/src/libs/positions/silo/index.d.ts +2 -2
- package/dist/src/libs/positions/types.d.ts +1 -1
- package/dist/src/libs/staticCampaigns.d.ts +1 -1
- package/dist/src/libs/tokens/balances.d.ts +1 -1
- package/dist/src/libs/tokens/tokenInfo.d.ts +1 -1
- package/dist/src/modules/v4/accounting/accounting.controller.d.ts +98 -33
- package/dist/src/modules/v4/accounting/accounting.repository.d.ts +41 -41
- package/dist/src/modules/v4/accounting/accounting.service.d.ts +7 -7
- package/dist/src/modules/v4/apr/apr.model.d.ts +8 -8
- package/dist/src/modules/v4/apr/apr.service.d.ts +1 -1
- package/dist/src/modules/v4/authentication/authentication.controller.d.ts +24 -2
- package/dist/src/modules/v4/blacklist/blacklist.controller.d.ts +64 -37
- package/dist/src/modules/v4/blacklist/blacklist.repository.d.ts +4 -4
- package/dist/src/modules/v4/blacklist/blacklist.service.d.ts +5 -5
- package/dist/src/modules/v4/boost/boost.controller.d.ts +25 -3
- package/dist/src/modules/v4/cache/cache.repository.d.ts +1 -1
- package/dist/src/modules/v4/cache/cache.service.d.ts +1 -1
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +665 -504
- package/dist/src/modules/v4/campaign/campaign.model.d.ts +30 -9
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +191 -191
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +415 -319
- package/dist/src/modules/v4/campaign/campaign.test.controller.d.ts +352 -282
- package/dist/src/modules/v4/chain/chain.controller.d.ts +91 -47
- package/dist/src/modules/v4/chain/chain.model.d.ts +11 -3
- package/dist/src/modules/v4/chain/chain.repository.d.ts +10 -10
- package/dist/src/modules/v4/chain/chain.service.d.ts +10 -10
- package/dist/src/modules/v4/chainInteraction/chainInteraction.service.d.ts +1 -1
- package/dist/src/modules/v4/claims/claims.controller.d.ts +15 -2
- package/dist/src/modules/v4/claims/claims.repository.d.ts +1 -1
- package/dist/src/modules/v4/claims/claims.service.d.ts +3 -3
- package/dist/src/modules/v4/computedValue/computedValue.controller.d.ts +47 -7
- package/dist/src/modules/v4/computedValue/computedValue.repository.d.ts +2 -2
- package/dist/src/modules/v4/computedValue/computedValue.service.d.ts +2 -2
- package/dist/src/modules/v4/creator/creator.controller.d.ts +160 -88
- package/dist/src/modules/v4/creator/creator.model.d.ts +1 -1
- package/dist/src/modules/v4/creator/creator.repository.d.ts +20 -20
- package/dist/src/modules/v4/creator/creator.service.d.ts +47 -47
- package/dist/src/modules/v4/dynamicData/dynamicData.model.d.ts +1 -1
- package/dist/src/modules/v4/dynamicData/dynamicData.service.d.ts +1 -1
- package/dist/src/modules/v4/enso/enso.service.d.ts +17 -17
- package/dist/src/modules/v4/explorer/explorer.controller.d.ts +19 -6
- package/dist/src/modules/v4/explorer/explorer.model.d.ts +2 -2
- package/dist/src/modules/v4/explorer/explorer.repository.d.ts +5 -5
- package/dist/src/modules/v4/explorer/explorer.service.d.ts +7 -7
- package/dist/src/modules/v4/interaction/interaction.controller.d.ts +39 -8
- package/dist/src/modules/v4/interaction/interaction.model.d.ts +1 -1
- package/dist/src/modules/v4/interaction/interaction.service.d.ts +2 -2
- package/dist/src/modules/v4/kyberzap/kyberzap.service.d.ts +1 -1
- package/dist/src/modules/v4/liquidity/implementations/AjnaPositionFetcher.d.ts +2 -2
- package/dist/src/modules/v4/liquidity/implementations/BadgerPositionFetcher.d.ts +2 -2
- package/dist/src/modules/v4/liquidity/implementations/ClammPositionFetcher.d.ts +2 -2
- package/dist/src/modules/v4/liquidity/implementations/DolomitePositionFetcher.d.ts +2 -2
- package/dist/src/modules/v4/liquidity/implementations/ERC20PositionFetcher.d.ts +3 -3
- package/dist/src/modules/v4/liquidity/implementations/EulerPositionFetcher.d.ts +2 -2
- package/dist/src/modules/v4/liquidity/liquidity.controller.d.ts +24 -13
- package/dist/src/modules/v4/liquidity/liquidity.model.d.ts +2 -2
- package/dist/src/modules/v4/liquidity/liquidity.repository.d.ts +1 -1
- package/dist/src/modules/v4/merklRoot/merklRoot.controller.d.ts +42 -22
- package/dist/src/modules/v4/merklRoot/merklRoot.repository.d.ts +7 -7
- package/dist/src/modules/v4/merklRoot/merklRoot.service.d.ts +18 -8
- package/dist/src/modules/v4/nodes/node.controller.d.ts +65 -0
- package/dist/src/modules/v4/nodes/node.model.d.ts +21 -0
- package/dist/src/modules/v4/nodes/node.repository.d.ts +21 -0
- package/dist/src/modules/v4/nodes/node.service.d.ts +21 -0
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +743 -644
- package/dist/src/modules/v4/opportunity/opportunity.converter.d.ts +111 -5
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +116 -81
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +408 -408
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +489 -459
- package/dist/src/modules/v4/parse/parse.controller.d.ts +64 -0
- package/dist/src/modules/v4/parse/parse.model.d.ts +10 -0
- package/dist/src/modules/v4/payload/payload.controller.d.ts +125 -0
- package/dist/src/modules/v4/payload/payload.model.d.ts +307 -0
- package/dist/src/modules/v4/payload/payload.service.d.ts +27 -0
- package/dist/src/modules/v4/price/price.controller.d.ts +93 -50
- package/dist/src/modules/v4/price/price.model.d.ts +16 -16
- package/dist/src/modules/v4/price/price.repository.d.ts +11 -11
- package/dist/src/modules/v4/price/price.service.d.ts +9 -9
- package/dist/src/modules/v4/prisma/index.d.ts +1 -1
- package/dist/src/modules/v4/programPayload/programPayload.controller.d.ts +939 -146
- package/dist/src/modules/v4/programPayload/programPayload.model.d.ts +12 -14
- package/dist/src/modules/v4/programPayload/programPayload.repository.d.ts +450 -362
- package/dist/src/modules/v4/programPayload/programPayload.service.d.ts +40 -19
- package/dist/src/modules/v4/protocol/protocol.controller.d.ts +117 -67
- package/dist/src/modules/v4/protocol/protocol.model.d.ts +2 -2
- package/dist/src/modules/v4/protocol/protocol.repository.d.ts +29 -29
- package/dist/src/modules/v4/protocol/protocol.service.d.ts +9 -6
- package/dist/src/modules/v4/referral/referral.controller.d.ts +29 -7
- package/dist/src/modules/v4/referral/referral.service.d.ts +8 -8
- package/dist/src/modules/v4/reward/reward.controller.d.ts +261 -93
- package/dist/src/modules/v4/reward/reward.converter.d.ts +1 -1
- package/dist/src/modules/v4/reward/reward.model.d.ts +3 -3
- package/dist/src/modules/v4/reward/reward.repository.d.ts +55 -54
- package/dist/src/modules/v4/reward/reward.service.d.ts +260 -260
- package/dist/src/modules/v4/router.d.ts +4706 -2394
- package/dist/src/modules/v4/status/status.controller.d.ts +127 -64
- package/dist/src/modules/v4/status/status.model.d.ts +10 -10
- package/dist/src/modules/v4/status/status.repository.d.ts +35 -35
- package/dist/src/modules/v4/status/status.service.d.ts +23 -23
- package/dist/src/modules/v4/token/token.controller.d.ts +224 -130
- package/dist/src/modules/v4/token/token.model.d.ts +1 -1
- package/dist/src/modules/v4/token/token.repository.d.ts +41 -37
- package/dist/src/modules/v4/token/token.service.d.ts +106 -101
- package/dist/src/modules/v4/turtle/turtle.controller.d.ts +15 -2
- package/dist/src/modules/v4/tvl/tvl.model.d.ts +5 -5
- package/dist/src/modules/v4/tvl/tvl.service.d.ts +1 -1
- package/dist/src/modules/v4/uniswap/uniswap.controller.d.ts +248 -11
- package/dist/src/modules/v4/uniswap/uniswap.model.d.ts +3 -3
- package/dist/src/modules/v4/uniswap/uniswap.repository.d.ts +4 -4
- package/dist/src/modules/v4/uniswap/uniswap.service.d.ts +3 -3
- package/dist/src/modules/v4/user/user.controller.d.ts +175 -164
- package/dist/src/modules/v4/user/user.model.d.ts +10 -1
- package/dist/src/modules/v4/user/user.repository.d.ts +7 -7
- package/dist/src/modules/v4/user/user.service.d.ts +7 -7
- package/dist/src/plugins/error-handling.plugin.d.ts +7 -3
- package/dist/src/routes/v1/allowances.d.ts +18 -5
- package/dist/src/routes/v1/balances.d.ts +16 -3
- package/dist/src/routes/v1/prices.d.ts +15 -2
- package/dist/src/routes/v1/router.d.ts +44 -4
- package/dist/src/routes/v1/tokens.d.ts +15 -2
- package/dist/src/routes/v2/merkl.d.ts +41 -4
- package/dist/src/routes/v2/router.d.ts +41 -4
- package/dist/src/routes/v3/app.d.ts +15 -2
- package/dist/src/routes/v3/blacklist.d.ts +15 -2
- package/dist/src/routes/v3/campaign/delay.d.ts +27 -16
- package/dist/src/routes/v3/campaignClaims.d.ts +15 -2
- package/dist/src/routes/v3/campaignUnclaimed.d.ts +15 -2
- package/dist/src/routes/v3/campaigns.d.ts +17 -4
- package/dist/src/routes/v3/campaignsForMainParameter.d.ts +15 -2
- package/dist/src/routes/v3/campaignsRewardsReport.d.ts +15 -2
- package/dist/src/routes/v3/claims.d.ts +15 -2
- package/dist/src/routes/v3/compoundV2.d.ts +15 -2
- package/dist/src/routes/v3/createCampaign.d.ts +16 -3
- package/dist/src/routes/v3/dolomite.d.ts +15 -2
- package/dist/src/routes/v3/euler.d.ts +43 -14
- package/dist/src/routes/v3/fetch.d.ts +15 -2
- package/dist/src/routes/v3/health.d.ts +15 -2
- package/dist/src/routes/v3/lostyield.d.ts +15 -2
- package/dist/src/routes/v3/merkl.d.ts +34 -6
- package/dist/src/routes/v3/morphoMarkets.d.ts +15 -2
- package/dist/src/routes/v3/morphoVaults.d.ts +15 -2
- package/dist/src/routes/v3/multiChainPositions.d.ts +15 -2
- package/dist/src/routes/v3/opportunity.d.ts +72 -6
- package/dist/src/routes/v3/overview.d.ts +15 -2
- package/dist/src/routes/v3/parse.d.ts +15 -2
- package/dist/src/routes/v3/payload.d.ts +19 -6
- package/dist/src/routes/v3/poolInfo.d.ts +18 -5
- package/dist/src/routes/v3/positions.d.ts +15 -2
- package/dist/src/routes/v3/radiant.d.ts +15 -2
- package/dist/src/routes/v3/recipients.d.ts +15 -2
- package/dist/src/routes/v3/rewards.d.ts +18 -5
- package/dist/src/routes/v3/rewardsReport.d.ts +16 -3
- package/dist/src/routes/v3/router.d.ts +608 -55
- package/dist/src/routes/v3/silo.d.ts +15 -2
- package/dist/src/routes/v3/token.d.ts +16 -3
- package/dist/src/routes/v3/twt/participants.d.ts +24 -13
- package/dist/src/routes/v3/uniswapv4.d.ts +192 -19
- package/dist/src/routes/v3/updates.d.ts +15 -2
- package/dist/src/routes/v3/userRewards.d.ts +18 -5
- package/dist/src/utils/decodeCalls.d.ts +1 -1
- package/dist/src/utils/encodeCalls.d.ts +2 -2
- package/dist/src/utils/error.d.ts +8 -4
- package/dist/src/utils/generateCardName.d.ts +2 -2
- package/dist/src/utils/generic.d.ts +2 -2
- package/dist/src/utils/lastBlockBefore.d.ts +1 -1
- package/dist/src/utils/logger.d.ts +0 -8
- package/dist/src/utils/pricer.d.ts +1 -1
- package/dist/src/utils/prices/chainlinkRead.d.ts +1 -1
- package/dist/src/utils/prices/curveVirtualPrice.d.ts +1 -1
- package/dist/src/utils/prices/getDQUICK.d.ts +1 -1
- package/dist/src/utils/prices/priceFetcherFactory.d.ts +1 -1
- package/dist/src/utils/prices/services/OnChainCallService.d.ts +1 -1
- package/dist/src/utils/prices/services/coinGeckoService.d.ts +1 -1
- package/dist/src/utils/prices/services/defillamaService.d.ts +1 -1
- package/dist/src/utils/prices/services/dexScreenerService.d.ts +1 -1
- package/dist/src/utils/prices/services/erc4626Service.d.ts +1 -1
- package/dist/src/utils/prices/services/getERC4626.d.ts +1 -1
- package/dist/src/utils/prices/services/indexCoopService.d.ts +1 -1
- package/dist/src/utils/prices/services/priceFetcher.d.ts +1 -1
- package/dist/src/utils/prices/uniV2Price.d.ts +1 -1
- package/dist/src/utils/providers.d.ts +113 -2
- package/dist/src/utils/queries/allCampaigns.d.ts +1 -2
- package/dist/src/utils/sanitizeChain.d.ts +2 -2
- package/dist/src/utils/stryke.d.ts +1 -1
- package/dist/src/utils/throw.d.ts +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +28 -48
- package/dist/database/api/.generated/default.d.ts +0 -1
- package/dist/database/api/.generated/default.js +0 -1
- package/dist/database/api/.generated/drizzle/schema.d.ts +0 -3342
- package/dist/database/api/.generated/drizzle/schema.js +0 -928
- package/dist/database/api/.generated/drizzle/schema.ts +0 -989
- package/dist/database/api/.generated/edge.d.ts +0 -1
- package/dist/database/api/.generated/edge.js +0 -725
- package/dist/database/api/.generated/index-browser.js +0 -696
- package/dist/database/api/.generated/index.d.ts +0 -48645
- package/dist/database/api/.generated/index.js +0 -758
- 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-arm64-openssl-3.0.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 +0 -97
- package/dist/database/api/.generated/runtime/edge-esm.js +0 -31
- package/dist/database/api/.generated/runtime/edge.js +0 -31
- package/dist/database/api/.generated/runtime/index-browser.d.ts +0 -365
- package/dist/database/api/.generated/runtime/index-browser.js +0 -13
- package/dist/database/api/.generated/runtime/library.d.ts +0 -3447
- package/dist/database/api/.generated/runtime/library.js +0 -143
- package/dist/database/api/.generated/runtime/react-native.js +0 -80
- package/dist/database/api/.generated/runtime/wasm.js +0 -32
- package/dist/database/api/.generated/schema.prisma +0 -482
- package/dist/database/api/.generated/wasm.d.ts +0 -1
- package/dist/database/api/.generated/wasm.js +0 -696
- package/dist/database/engine/.generated/default.d.ts +0 -1
- package/dist/database/engine/.generated/default.js +0 -1
- package/dist/database/engine/.generated/edge.d.ts +0 -1
- package/dist/database/engine/.generated/edge.js +0 -485
- package/dist/database/engine/.generated/index-browser.js +0 -456
- package/dist/database/engine/.generated/index.d.ts +0 -22107
- package/dist/database/engine/.generated/index.js +0 -518
- 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-arm64-openssl-3.0.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 +0 -97
- package/dist/database/engine/.generated/runtime/edge-esm.js +0 -31
- package/dist/database/engine/.generated/runtime/edge.js +0 -31
- package/dist/database/engine/.generated/runtime/index-browser.d.ts +0 -365
- package/dist/database/engine/.generated/runtime/index-browser.js +0 -13
- package/dist/database/engine/.generated/runtime/library.d.ts +0 -3447
- package/dist/database/engine/.generated/runtime/library.js +0 -143
- package/dist/database/engine/.generated/runtime/react-native.js +0 -80
- package/dist/database/engine/.generated/runtime/wasm.js +0 -32
- package/dist/database/engine/.generated/schema.prisma +0 -248
- package/dist/database/engine/.generated/wasm.d.ts +0 -1
- package/dist/database/engine/.generated/wasm.js +0 -456
- package/dist/database/index.d.ts +0 -29
- package/dist/database/index.js +0 -17
- package/dist/src/cache/declaration.js +0 -121
- package/dist/src/cache/index.js +0 -161
- package/dist/src/cache/redis.js +0 -57
- package/dist/src/constants.js +0 -93
- package/dist/src/engine/deprecated/dynamicData/implementations/Ajna.js +0 -107
- package/dist/src/engine/deprecated/dynamicData/implementations/Badger.js +0 -90
- package/dist/src/engine/deprecated/dynamicData/implementations/Clamm.js +0 -975
- package/dist/src/engine/deprecated/dynamicData/implementations/Compound.js +0 -139
- package/dist/src/engine/deprecated/dynamicData/implementations/CompoundV3.js +0 -101
- package/dist/src/engine/deprecated/dynamicData/implementations/Dolomite.js +0 -59
- package/dist/src/engine/deprecated/dynamicData/implementations/ERC721.js +0 -87
- package/dist/src/engine/deprecated/dynamicData/implementations/ERCMultiToken.js +0 -161
- package/dist/src/engine/deprecated/dynamicData/implementations/EigenLayer.js +0 -67
- package/dist/src/engine/deprecated/dynamicData/implementations/Encompassing.js +0 -26
- package/dist/src/engine/deprecated/dynamicData/implementations/Erc20.js +0 -162
- package/dist/src/engine/deprecated/dynamicData/implementations/Erc20Snapshot.js +0 -32
- package/dist/src/engine/deprecated/dynamicData/implementations/EventBased.js +0 -129
- package/dist/src/engine/deprecated/dynamicData/implementations/Hyperdrive.js +0 -112
- package/dist/src/engine/deprecated/dynamicData/implementations/Morpho.js +0 -132
- package/dist/src/engine/deprecated/dynamicData/implementations/Radiant.js +0 -123
- package/dist/src/engine/deprecated/dynamicData/implementations/Silo.js +0 -112
- package/dist/src/engine/deprecated/dynamicData/implementations/UniswapV4.js +0 -255
- package/dist/src/engine/deprecated/dynamicData/implementations/Vest.js +0 -61
- package/dist/src/engine/deprecated/dynamicData/implementations/default.js +0 -5
- package/dist/src/engine/deprecated/dynamicData/utils/fetchA51Strategies.js +0 -44
- package/dist/src/engine/deprecated/dynamicData/utils/fetchClamInfo.js +0 -27
- package/dist/src/engine/deprecated/dynamicData/utils/fetchLogs.js +0 -149
- package/dist/src/engine/deprecated/dynamicData/utils/getCompV2ForksVaults.js +0 -141
- package/dist/src/engine/deprecated/dynamicData/utils/getContractCreationBlock.js +0 -44
- package/dist/src/engine/deprecated/dynamicData/utils/getDolomiteMarkets.js +0 -53
- package/dist/src/engine/deprecated/dynamicData/utils/getEulerV2Vaults.js +0 -266
- package/dist/src/engine/deprecated/dynamicData/utils/getFixedApr.js +0 -27
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/GenericProcessor.js +0 -335
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/helpers/eulerVaultNames.js +0 -13
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/helpers/factoryFinder.js +0 -47
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/helpers/getBlacklistedSupply.js +0 -22
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/helpers/getCrossCurveTokenPrice.js +0 -13
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/helpers/hardcoded.js +0 -30
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/helpers/metamorphoTvl.d.ts +0 -1
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/helpers/metamorphoTvl.js +0 -35
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/helpers/ownerFinder.js +0 -16
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/helpers/spliceTVL.js +0 -23
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/helpers/treasuryFinder.js +0 -10
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/AaveProcessor.js +0 -26
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/AnglesLiquid.js +0 -51
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/AssetProcessor.js +0 -48
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/AuraProcessor.js +0 -113
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/BEXRewardGaugeProcessor.js +0 -111
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/BalancerGaugeProcessor.js +0 -86
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/BalancerPoolProcessor.js +0 -101
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/BalancerV3PoolProcessor.js +0 -81
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/BeefyProcessor.js +0 -54
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/BunniV2Processor.js +0 -91
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/CompoundProcessor.js +0 -37
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/ERC4626Processor.js +0 -37
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/EnzymeProcessor.js +0 -52
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/EqualizerGaugeProcessor.js +0 -54
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/EulerBorrowProcessor.js +0 -51
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/EulerLendProcessor.js +0 -58
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/FluidProcessor.js +0 -37
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/FraxProcessor.js +0 -42
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/GammaALMProcessor.js +0 -52
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/GammaProcessor.js +0 -67
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/GearboxProcessor.js +0 -58
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/HanjiVaultProcessor.js +0 -63
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/HoldStationProcessor.js +0 -35
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/HourglassProcessor.js +0 -35
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/MaverickBPProcessor.js +0 -78
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/MetamorphoProcessor.js +0 -48
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/NoLinkVaultProcessor.js +0 -82
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/PendleProcessor.js +0 -30
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/PendleYTProcessor.js +0 -30
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/RadiantProcessor.js +0 -59
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/RfxProcessor.js +0 -71
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/Satlayer.js +0 -28
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/SpectraProcessor.js +0 -42
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/SpectraYTProcessor.js +0 -40
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/SpliceProcessor.js +0 -37
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/StabilityProcessor.js +0 -30
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/SturdySiloProcessor.js +0 -38
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/TempestVaultProcessor.js +0 -83
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/TemplateProcessor.js +0 -40
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/TorosProcessor.js +0 -34
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/UniswapProcessor.js +0 -72
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/VicunaProcessor.js +0 -36
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/WoofiProcessor.js +0 -41
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/ZkSwapThreePoolProcessor.js +0 -60
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/curveNPoolProcessor.js +0 -102
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/curveProcessor.js +0 -85
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/processorMapping.js +0 -159
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/stakedCurveProcessor.js +0 -88
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/xU308Processor.js +0 -42
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/subtypesPrices.js +0 -28
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/subtypesRound1.js +0 -353
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/subtypesRound2.js +0 -22
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/subtypesRound3.js +0 -22
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/subtypesRound4.js +0 -22
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/tokenTypeStruct.js +0 -1
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/tokenTypeToProtocolAndAction.js +0 -155
- package/dist/src/engine/implementations/Ajna/metadata.js +0 -59
- package/dist/src/engine/implementations/Ajna/tvl.js +0 -91
- package/dist/src/engine/implementations/Ambient/metadata.js +0 -36
- package/dist/src/engine/implementations/Ambient/tvl.js +0 -178
- package/dist/src/engine/implementations/Badger/metadata.js +0 -31
- package/dist/src/engine/implementations/Clamm/metadata.js +0 -176
- package/dist/src/engine/implementations/Compound/metadata.js +0 -23
- package/dist/src/engine/implementations/CompoundV3/metadata.js +0 -23
- package/dist/src/engine/implementations/Default/metadata.js +0 -12
- package/dist/src/engine/implementations/Dolomite/metadata.js +0 -20
- package/dist/src/engine/implementations/EigenLayer/metadata.js +0 -12
- package/dist/src/engine/implementations/EigenLayer/tvl.js +0 -60
- package/dist/src/engine/implementations/Encompassing/metadata.js +0 -43
- package/dist/src/engine/implementations/Erc20/metadata.js +0 -64
- package/dist/src/engine/implementations/Erc20/subTypes/detect.js +0 -170
- package/dist/src/engine/implementations/Erc20/subTypes/factories.js +0 -69
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/aave/metadata.js +0 -46
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/aave/tvl.js +0 -51
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/euler/metadata.js +0 -35
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/euler/tvl.js +0 -59
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/gearbox/metadata.js +0 -21
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/gearbox/tvl.js +0 -46
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/hypurrfiIsolatedMarket/metadata.js +0 -40
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/hypurrfiIsolatedMarket/tvl.js +0 -57
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/lendleVaults/metadata.js +0 -20
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/lendleVaults/tvl.js +0 -52
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/pino/metadata.js +0 -38
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/pino/tvl.js +0 -83
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/termmax/metadata.js +0 -24
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/termmax/tvl.js +0 -69
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/uniswapV2/metadata.js +0 -65
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/uniswapV2/tvl.js +0 -94
- package/dist/src/engine/implementations/Erc20/subTypes/index.js +0 -119
- package/dist/src/engine/implementations/Erc20/tvl.js +0 -99
- package/dist/src/engine/implementations/Erc20Snapshot/metadata.js +0 -11
- package/dist/src/engine/implementations/Erc721/metadata.js +0 -13
- package/dist/src/engine/implementations/ErcMultiToken/metadata.js +0 -63
- package/dist/src/engine/implementations/EventBased/metadata.js +0 -181
- package/dist/src/engine/implementations/Hyperdrive/metadata.js +0 -29
- package/dist/src/engine/implementations/Invalid/metadata.js +0 -10
- package/dist/src/engine/implementations/Ion/metadata.js +0 -16
- package/dist/src/engine/implementations/JsonAirdrop/metadata.js +0 -43
- package/dist/src/engine/implementations/Locker/metadata.js +0 -36
- package/dist/src/engine/implementations/Locker/tvl.js +0 -26
- package/dist/src/engine/implementations/Morpho/metadata.js +0 -63
- package/dist/src/engine/implementations/MultiLog/metadata.js +0 -36
- package/dist/src/engine/implementations/MultiLog/tvl.js +0 -59
- package/dist/src/engine/implementations/Radiant/metadata.js +0 -33
- package/dist/src/engine/implementations/Silo/metadata.js +0 -20
- package/dist/src/engine/implementations/UniswapV4/metadata.js +0 -36
- package/dist/src/engine/implementations/UniswapV4/tvl.js +0 -158
- package/dist/src/engine/implementations/Vest/metadata.js +0 -13
- package/dist/src/engine/metadata/factory.js +0 -76
- package/dist/src/engine/tvl/factory.js +0 -87
- package/dist/src/engine/tvl/logStates.js +0 -106
- package/dist/src/errors/BadRequest.error.js +0 -7
- package/dist/src/errors/Conflict.error.js +0 -7
- package/dist/src/errors/HttpError.js +0 -17
- package/dist/src/errors/InvalidParameter.error.js +0 -7
- package/dist/src/errors/NotFound.error.js +0 -12
- package/dist/src/errors/Opportunity.error.js +0 -11
- package/dist/src/errors/UnableToFindPrice.error.js +0 -7
- package/dist/src/errors/Unauthorized.error.js +0 -7
- package/dist/src/errors/VoidString.error.js +0 -7
- package/dist/src/errors/index.js +0 -6
- package/dist/src/guards/BackOffice.guard.js +0 -10
- package/dist/src/guards/Engine.guard.js +0 -9
- package/dist/src/guards/TokenAuth.guard.js +0 -10
- package/dist/src/guards/VerifyJwt.guard.js +0 -13
- package/dist/src/hooks/checkQueryAddressValidity.js +0 -7
- package/dist/src/hooks/checkQueryChainIdValidity.js +0 -7
- package/dist/src/index.js +0 -113
- package/dist/src/jobs/dynamic-data.js +0 -159
- package/dist/src/jobs/pendings.js +0 -238
- package/dist/src/jobs/prices.js +0 -10
- package/dist/src/jobs/reward-breakdowns.js +0 -163
- package/dist/src/jobs/rewards.js +0 -112
- package/dist/src/jobs/set-dungeon-keeper.js +0 -90
- package/dist/src/jobs/update-analytics.js +0 -548
- package/dist/src/jobs/update-dynamic-data.js +0 -57
- package/dist/src/jobs/update-euler-vaults.js +0 -18
- package/dist/src/jobs/update-rpc-calls-cache.js +0 -30
- package/dist/src/jobs/update-uniswap-v4-pools.js +0 -15
- package/dist/src/libs/computeFee.js +0 -34
- package/dist/src/libs/deprecated-merklv3/index.js +0 -183
- package/dist/src/libs/getTokensList.js +0 -19
- package/dist/src/libs/merklChainData.js +0 -116
- package/dist/src/libs/parse/marketsWithCache.js +0 -8
- package/dist/src/libs/positions/EigenLayer/index.js +0 -54
- package/dist/src/libs/positions/ajna/index.js +0 -107
- package/dist/src/libs/positions/badger/index.js +0 -80
- package/dist/src/libs/positions/clamm/index.js +0 -412
- package/dist/src/libs/positions/clamm/thegraph/fetchAlmPositions.js +0 -36
- package/dist/src/libs/positions/clamm/thegraph/fetchAmmPositions.js +0 -36
- package/dist/src/libs/positions/clamm/thegraph/fetchFarmedPositions.js +0 -42
- package/dist/src/libs/positions/clamm/thegraph/index.js +0 -163
- package/dist/src/libs/positions/compound/index.js +0 -91
- package/dist/src/libs/positions/dolomite/index.js +0 -51
- package/dist/src/libs/positions/erc20/index.js +0 -55
- package/dist/src/libs/positions/euler/index.js +0 -56
- package/dist/src/libs/positions/index.js +0 -56
- package/dist/src/libs/positions/morpho/index.js +0 -177
- package/dist/src/libs/positions/prepareFetch.js +0 -392
- package/dist/src/libs/positions/silo/index.js +0 -68
- package/dist/src/libs/positions/types.js +0 -1
- package/dist/src/libs/staticCampaigns.js +0 -15
- package/dist/src/libs/tokens/allowances.js +0 -18
- package/dist/src/libs/tokens/balances.js +0 -128
- package/dist/src/libs/tokens/tokenInfo.js +0 -22
- package/dist/src/modules/v4/accounting/accounting.controller.js +0 -61
- package/dist/src/modules/v4/accounting/accounting.model.js +0 -32
- package/dist/src/modules/v4/accounting/accounting.repository.js +0 -154
- package/dist/src/modules/v4/accounting/accounting.service.js +0 -107
- package/dist/src/modules/v4/airflow/airflow.service.js +0 -20
- package/dist/src/modules/v4/apr/apr.model.js +0 -13
- package/dist/src/modules/v4/apr/apr.service.js +0 -52
- package/dist/src/modules/v4/authentication/authentication.controller.js +0 -23
- package/dist/src/modules/v4/authentication/authentication.model.js +0 -6
- package/dist/src/modules/v4/authentication/authentication.service.js +0 -31
- package/dist/src/modules/v4/blacklist/blacklist.controller.js +0 -42
- package/dist/src/modules/v4/blacklist/blacklist.model.js +0 -13
- package/dist/src/modules/v4/blacklist/blacklist.repository.js +0 -50
- package/dist/src/modules/v4/blacklist/blacklist.service.js +0 -31
- package/dist/src/modules/v4/boost/boost.controller.js +0 -15
- package/dist/src/modules/v4/boost/boost.model.js +0 -14
- package/dist/src/modules/v4/boost/boost.service.js +0 -20
- package/dist/src/modules/v4/bucket/bucket.model.js +0 -85
- package/dist/src/modules/v4/bucket/bucket.service.js +0 -178
- package/dist/src/modules/v4/cache/cache.model.js +0 -14
- package/dist/src/modules/v4/cache/cache.repository.js +0 -22
- package/dist/src/modules/v4/cache/cache.service.js +0 -59
- package/dist/src/modules/v4/campaign/campaign.controller.js +0 -174
- package/dist/src/modules/v4/campaign/campaign.model.js +0 -140
- package/dist/src/modules/v4/campaign/campaign.repository.js +0 -535
- package/dist/src/modules/v4/campaign/campaign.service.js +0 -455
- package/dist/src/modules/v4/campaign/campaign.test.controller.js +0 -127
- package/dist/src/modules/v4/chain/chain.controller.js +0 -44
- package/dist/src/modules/v4/chain/chain.model.js +0 -36
- package/dist/src/modules/v4/chain/chain.repository.js +0 -79
- package/dist/src/modules/v4/chain/chain.service.js +0 -55
- package/dist/src/modules/v4/chainInteraction/chainInteraction.service.js +0 -4
- package/dist/src/modules/v4/claims/claims.controller.js +0 -19
- package/dist/src/modules/v4/claims/claims.model.js +0 -1
- package/dist/src/modules/v4/claims/claims.repository.js +0 -39
- package/dist/src/modules/v4/claims/claims.service.js +0 -40
- package/dist/src/modules/v4/coingecko/coingecko.model.js +0 -1
- package/dist/src/modules/v4/coingecko/coingecko.repository.js +0 -9
- package/dist/src/modules/v4/coingecko/coingecko.service.js +0 -65
- package/dist/src/modules/v4/computedValue/computedValue.controller.js +0 -46
- package/dist/src/modules/v4/computedValue/computedValue.model.js +0 -30
- package/dist/src/modules/v4/computedValue/computedValue.repository.js +0 -48
- package/dist/src/modules/v4/computedValue/computedValue.service.js +0 -23
- package/dist/src/modules/v4/creator/creator.controller.js +0 -43
- package/dist/src/modules/v4/creator/creator.model.js +0 -42
- package/dist/src/modules/v4/creator/creator.repository.js +0 -69
- package/dist/src/modules/v4/creator/creator.service.js +0 -92
- package/dist/src/modules/v4/dynamicData/dynamicData.model.js +0 -56
- package/dist/src/modules/v4/dynamicData/dynamicData.service.js +0 -263
- package/dist/src/modules/v4/enso/enso.model.js +0 -147
- package/dist/src/modules/v4/enso/enso.service.js +0 -116
- package/dist/src/modules/v4/explorer/explorer.controller.js +0 -13
- package/dist/src/modules/v4/explorer/explorer.model.js +0 -8
- package/dist/src/modules/v4/explorer/explorer.repository.js +0 -23
- package/dist/src/modules/v4/explorer/explorer.service.js +0 -24
- package/dist/src/modules/v4/icon/icon.model.js +0 -1
- package/dist/src/modules/v4/icon/icon.service.js +0 -16
- package/dist/src/modules/v4/interaction/interaction.controller.js +0 -45
- package/dist/src/modules/v4/interaction/interaction.model.js +0 -25
- package/dist/src/modules/v4/interaction/interaction.service.js +0 -95
- package/dist/src/modules/v4/kyberzap/kyberzap.model.js +0 -83
- package/dist/src/modules/v4/kyberzap/kyberzap.service.js +0 -176
- package/dist/src/modules/v4/liquidity/implementations/AjnaPositionFetcher.js +0 -90
- package/dist/src/modules/v4/liquidity/implementations/BadgerPositionFetcher.js +0 -69
- package/dist/src/modules/v4/liquidity/implementations/ClammPositionFetcher.js +0 -61
- package/dist/src/modules/v4/liquidity/implementations/DolomitePositionFetcher.js +0 -45
- package/dist/src/modules/v4/liquidity/implementations/ERC20PositionFetcher.js +0 -47
- package/dist/src/modules/v4/liquidity/implementations/EulerPositionFetcher.js +0 -40
- package/dist/src/modules/v4/liquidity/liquidity.controller.js +0 -16
- package/dist/src/modules/v4/liquidity/liquidity.model.js +0 -5
- package/dist/src/modules/v4/liquidity/liquidity.repository.js +0 -6
- package/dist/src/modules/v4/liquidity/liquidity.service.js +0 -34
- package/dist/src/modules/v4/merklRoot/merklRoot.controller.js +0 -31
- package/dist/src/modules/v4/merklRoot/merklRoot.model.js +0 -12
- package/dist/src/modules/v4/merklRoot/merklRoot.repository.js +0 -56
- package/dist/src/modules/v4/merklRoot/merklRoot.service.js +0 -48
- package/dist/src/modules/v4/opportunity/opportunity.controller.js +0 -189
- package/dist/src/modules/v4/opportunity/opportunity.converter.js +0 -174
- package/dist/src/modules/v4/opportunity/opportunity.model.js +0 -132
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +0 -515
- package/dist/src/modules/v4/opportunity/opportunity.service.js +0 -380
- package/dist/src/modules/v4/opportunity/transform-id.pipe.js +0 -6
- package/dist/src/modules/v4/opportunity/validate-id.pipe.js +0 -12
- package/dist/src/modules/v4/price/price.controller.js +0 -56
- package/dist/src/modules/v4/price/price.model.js +0 -12
- package/dist/src/modules/v4/price/price.repository.js +0 -22
- package/dist/src/modules/v4/price/price.service.js +0 -63
- package/dist/src/modules/v4/prisma/index.js +0 -1
- package/dist/src/modules/v4/programPayload/programPayload.controller.js +0 -85
- package/dist/src/modules/v4/programPayload/programPayload.model.js +0 -179
- package/dist/src/modules/v4/programPayload/programPayload.repository.js +0 -7567
- package/dist/src/modules/v4/programPayload/programPayload.service.js +0 -240
- package/dist/src/modules/v4/protocol/protocol.controller.js +0 -42
- package/dist/src/modules/v4/protocol/protocol.model.js +0 -186
- package/dist/src/modules/v4/protocol/protocol.repository.js +0 -175
- package/dist/src/modules/v4/protocol/protocol.service.js +0 -73
- package/dist/src/modules/v4/referral/referral.controller.js +0 -25
- package/dist/src/modules/v4/referral/referral.model.js +0 -12
- package/dist/src/modules/v4/referral/referral.service.js +0 -171
- package/dist/src/modules/v4/reward/reward.controller.js +0 -140
- package/dist/src/modules/v4/reward/reward.converter.js +0 -124
- package/dist/src/modules/v4/reward/reward.model.js +0 -153
- package/dist/src/modules/v4/reward/reward.repository.js +0 -350
- package/dist/src/modules/v4/reward/reward.service.js +0 -406
- package/dist/src/modules/v4/router.js +0 -93
- package/dist/src/modules/v4/status/status.controller.js +0 -68
- package/dist/src/modules/v4/status/status.model.js +0 -34
- package/dist/src/modules/v4/status/status.repository.js +0 -146
- package/dist/src/modules/v4/status/status.service.js +0 -150
- package/dist/src/modules/v4/token/token.controller.js +0 -118
- package/dist/src/modules/v4/token/token.model.js +0 -87
- package/dist/src/modules/v4/token/token.repository.js +0 -192
- package/dist/src/modules/v4/token/token.service.js +0 -410
- package/dist/src/modules/v4/tracer/tracer.service.js +0 -30
- package/dist/src/modules/v4/turtle/turtle.controller.js +0 -20
- package/dist/src/modules/v4/turtle/turtle.repository.js +0 -40
- package/dist/src/modules/v4/turtle/turtle.service.js +0 -28
- package/dist/src/modules/v4/tvl/tvl.model.js +0 -13
- package/dist/src/modules/v4/tvl/tvl.service.js +0 -63
- package/dist/src/modules/v4/uniswap/uniswap.controller.js +0 -100
- package/dist/src/modules/v4/uniswap/uniswap.model.js +0 -46
- package/dist/src/modules/v4/uniswap/uniswap.repository.js +0 -12
- package/dist/src/modules/v4/uniswap/uniswap.service.js +0 -245
- package/dist/src/modules/v4/user/user.controller.js +0 -77
- package/dist/src/modules/v4/user/user.model.js +0 -66
- package/dist/src/modules/v4/user/user.repository.js +0 -41
- package/dist/src/modules/v4/user/user.service.js +0 -102
- package/dist/src/plugins/error-handling.plugin.js +0 -34
- package/dist/src/routes/v1/allowances.js +0 -115
- package/dist/src/routes/v1/balances.js +0 -25
- package/dist/src/routes/v1/prices.js +0 -9
- package/dist/src/routes/v1/router.js +0 -6
- package/dist/src/routes/v1/tokens.js +0 -17
- package/dist/src/routes/v2/merkl.js +0 -13
- package/dist/src/routes/v2/router.js +0 -3
- package/dist/src/routes/v3/app.js +0 -43
- package/dist/src/routes/v3/blacklist.js +0 -19
- package/dist/src/routes/v3/campaign/delay.js +0 -81
- package/dist/src/routes/v3/campaignClaims.js +0 -29
- package/dist/src/routes/v3/campaignUnclaimed.js +0 -28
- package/dist/src/routes/v3/campaigns.js +0 -136
- package/dist/src/routes/v3/campaignsForMainParameter.js +0 -33
- package/dist/src/routes/v3/campaignsRewardsReport.js +0 -48
- package/dist/src/routes/v3/claims.js +0 -16
- package/dist/src/routes/v3/compoundV2.js +0 -9
- package/dist/src/routes/v3/createCampaign.js +0 -66
- package/dist/src/routes/v3/dolomite.js +0 -12
- package/dist/src/routes/v3/euler.js +0 -52
- package/dist/src/routes/v3/fetch.js +0 -27
- package/dist/src/routes/v3/health.js +0 -13
- package/dist/src/routes/v3/lostyield.js +0 -101
- package/dist/src/routes/v3/merkl.js +0 -119
- package/dist/src/routes/v3/morphoMarkets.js +0 -27
- package/dist/src/routes/v3/morphoVaults.js +0 -22
- package/dist/src/routes/v3/multiChainPositions.js +0 -70
- package/dist/src/routes/v3/opportunity.js +0 -28
- package/dist/src/routes/v3/overview.js +0 -72
- package/dist/src/routes/v3/parse.js +0 -23
- package/dist/src/routes/v3/payload.js +0 -40
- package/dist/src/routes/v3/poolInfo.js +0 -88
- package/dist/src/routes/v3/positions.js +0 -62
- package/dist/src/routes/v3/radiant.js +0 -26
- package/dist/src/routes/v3/recipients.js +0 -29
- package/dist/src/routes/v3/rewards.js +0 -36
- package/dist/src/routes/v3/rewardsReport.js +0 -40
- package/dist/src/routes/v3/router.js +0 -70
- package/dist/src/routes/v3/silo.js +0 -20
- package/dist/src/routes/v3/token.js +0 -24
- package/dist/src/routes/v3/twt/participants.js +0 -63
- package/dist/src/routes/v3/uniswapv4.js +0 -29
- package/dist/src/routes/v3/updates.js +0 -47
- package/dist/src/routes/v3/userRewards.js +0 -63
- package/dist/src/scripts/fill-coingecko-data.js +0 -3
- package/dist/src/scripts/fill-descriptions.js +0 -101
- package/dist/src/scripts/fill-unknown-tokens.js +0 -58
- package/dist/src/scripts/reparse-opportunities.js +0 -75
- package/dist/src/types/external/spectraAPI.js +0 -1
- package/dist/src/types/index.js +0 -1
- package/dist/src/utils/TailSampler.js +0 -23
- package/dist/src/utils/bigintToString.js +0 -20
- package/dist/src/utils/caseChanges.js +0 -15
- package/dist/src/utils/decodeCalls.js +0 -340
- package/dist/src/utils/encodeCalls.js +0 -506
- package/dist/src/utils/error.js +0 -114
- package/dist/src/utils/execute.js +0 -117
- package/dist/src/utils/generateCardName.js +0 -209
- package/dist/src/utils/generic.js +0 -43
- package/dist/src/utils/hashArray.js +0 -7
- package/dist/src/utils/lastBlockBefore.js +0 -78
- package/dist/src/utils/logger.js +0 -52
- package/dist/src/utils/parseDistributionType.js +0 -16
- package/dist/src/utils/pricer.js +0 -189
- package/dist/src/utils/prices/chainlinkRead.js +0 -8
- package/dist/src/utils/prices/curveVirtualPrice.js +0 -7
- package/dist/src/utils/prices/getDQUICK.js +0 -8
- package/dist/src/utils/prices/priceFetcherFactory.js +0 -32
- package/dist/src/utils/prices/priceService.js +0 -274
- package/dist/src/utils/prices/services/OnChainCallService.js +0 -38
- package/dist/src/utils/prices/services/coinGeckoService.js +0 -63
- package/dist/src/utils/prices/services/defillamaService.js +0 -53
- package/dist/src/utils/prices/services/dexScreenerService.js +0 -62
- package/dist/src/utils/prices/services/erc4626Service.js +0 -38
- package/dist/src/utils/prices/services/getERC4626.js +0 -11
- package/dist/src/utils/prices/services/indexCoopService.js +0 -55
- package/dist/src/utils/prices/services/priceFetcher.js +0 -1
- package/dist/src/utils/prices/uniV2Price.js +0 -40
- package/dist/src/utils/providers.js +0 -37
- package/dist/src/utils/queries/allCampaigns.js +0 -12
- package/dist/src/utils/sanitizeChain.js +0 -6
- package/dist/src/utils/stryke.js +0 -4
- package/dist/src/utils/throw.js +0 -55
- package/dist/tsconfig.package.tsbuildinfo +0 -1
@@ -1,975 +0,0 @@
|
|
1
|
-
import { MERKL_ALM_POSITION_FETCHING_TIMEOUT } from "@/constants";
|
2
|
-
import { nftPositionByIdsQuery, positionMultipleOwnersQuery } from "@/libs/positions/clamm/thegraph";
|
3
|
-
import { fetchFarmedPositions } from "@/libs/positions/clamm/thegraph/fetchFarmedPositions";
|
4
|
-
import { TokenService } from "@/modules/v4/token/token.service";
|
5
|
-
import { log } from "@/utils/logger";
|
6
|
-
import { isStrykeCampaign } from "@/utils/stryke";
|
7
|
-
import { A51Factory__factory, ALM, ALMMapping, AMM, AMMAlgorithm, AMMAlgorithmMapping, BN2Number, ChainInteractionService, DecodeLiquidity, EAprBreakdownType, ERC20Interface, Forwarder, JonesDoubleRewardTracker__factory, Liquidity, NETWORK_LABELS, NitroInterface, PoolInterface, PoolState, PriorityAMM, SqrtPrice, almName, ammName, getAmountsForLiquidity, getTickAtSqrtRatio, isBlacklisted, isWhitelisted, merklSubgraphAMMEndpoints, shortenAddress, spNFTInterface, withTimeout, } from "@sdk";
|
8
|
-
import axios from "axios";
|
9
|
-
import { BigNumber, utils } from "ethers";
|
10
|
-
import request from "graphql-request";
|
11
|
-
import JSBI from "jsbi";
|
12
|
-
import moment from "moment";
|
13
|
-
import { fetchA51Strategies } from "../utils/fetchA51Strategies";
|
14
|
-
export class ClammDynamicData {
|
15
|
-
async build(chainId, campaigns) {
|
16
|
-
const dynamicData = [];
|
17
|
-
const calls = [];
|
18
|
-
const A51Interface = A51Factory__factory.createInterface();
|
19
|
-
/** Dedupe pools from campaigns to build pool list */
|
20
|
-
let poolList = [];
|
21
|
-
for (const campaign of campaigns ?? []) {
|
22
|
-
/** Loop through all campaigns to add pools */
|
23
|
-
if (!poolList?.map(p => p.mainParameter.toLowerCase()).includes(campaign.mainParameter.toLowerCase())) {
|
24
|
-
if (AMMAlgorithmMapping[campaign.campaignParameters.amm] === undefined) {
|
25
|
-
console.log("Invalid AMM", campaign.campaignParameters.amm);
|
26
|
-
continue;
|
27
|
-
}
|
28
|
-
poolList.push({
|
29
|
-
address: campaign.campaignParameters.poolAddress,
|
30
|
-
mainParameter: campaign.mainParameter, // main parameter containes info of poolAddress + AMM (in case its a priority AMM)
|
31
|
-
alms: [],
|
32
|
-
amm: campaign.campaignParameters.amm,
|
33
|
-
});
|
34
|
-
}
|
35
|
-
/** Now we have an entry with campaign.mainParameter in poolList */
|
36
|
-
const poolIndex = poolList
|
37
|
-
?.map(p => p.mainParameter.toLowerCase())
|
38
|
-
.findIndex(a => a === campaign.mainParameter.toLowerCase());
|
39
|
-
/** Fill ALMs per pools */
|
40
|
-
for (const forwarder of campaign.campaignParameters.forwarders
|
41
|
-
.filter(f => f.forwarderType === Forwarder.CLAMM)
|
42
|
-
.sort((a, b) => a.priority - b.priority)) {
|
43
|
-
const alm = {
|
44
|
-
address: forwarder.sender,
|
45
|
-
...(!!forwarder.owner && { owner: forwarder.owner?.toLowerCase() }),
|
46
|
-
target: forwarder.target.toLowerCase(),
|
47
|
-
type: forwarder.type,
|
48
|
-
priority: forwarder.priority,
|
49
|
-
};
|
50
|
-
/** If the ALM is not found - add it */
|
51
|
-
if (poolList[poolIndex].alms.findIndex(a => alm.address === a.address && alm.target === a.target) === -1) {
|
52
|
-
poolList[poolIndex].alms.push(alm);
|
53
|
-
}
|
54
|
-
}
|
55
|
-
}
|
56
|
-
poolList = poolList.filter(p => p.amm !== undefined && p.amm !== null);
|
57
|
-
if (!!poolList) {
|
58
|
-
// Prepare A51 fetching
|
59
|
-
const A51Pools = [];
|
60
|
-
for (const pool of poolList) {
|
61
|
-
for (const _ of pool.alms.filter(a => a.type === ALM.A51)) {
|
62
|
-
A51Pools.push(pool.address.toLowerCase());
|
63
|
-
}
|
64
|
-
}
|
65
|
-
let A51Strategies = {};
|
66
|
-
if (A51Pools.length > 0) {
|
67
|
-
A51Strategies = await fetchA51Strategies(chainId, [...new Set(A51Pools)]);
|
68
|
-
}
|
69
|
-
for (const pool of poolList) {
|
70
|
-
const poolInterface = PoolInterface[AMMAlgorithmMapping[pool.amm]];
|
71
|
-
const d = campaigns?.filter(campaign => campaign.mainParameter.toLowerCase() === pool.mainParameter.toLowerCase())[0];
|
72
|
-
calls.push({
|
73
|
-
allowFailure: true,
|
74
|
-
callData: poolInterface.encodeFunctionData(Liquidity[AMMAlgorithmMapping[pool.amm]]),
|
75
|
-
target: pool.address,
|
76
|
-
}, {
|
77
|
-
allowFailure: true,
|
78
|
-
callData: poolInterface.encodeFunctionData(PoolState[AMMAlgorithmMapping[pool.amm]]),
|
79
|
-
target: pool.address,
|
80
|
-
}, {
|
81
|
-
allowFailure: true,
|
82
|
-
callData: ERC20Interface.encodeFunctionData("balanceOf", [pool.address]),
|
83
|
-
target: d.campaignParameters.token0,
|
84
|
-
}, {
|
85
|
-
allowFailure: true,
|
86
|
-
callData: ERC20Interface.encodeFunctionData("balanceOf", [pool.address]),
|
87
|
-
target: d.campaignParameters.token1,
|
88
|
-
});
|
89
|
-
/** Direct ALMs */
|
90
|
-
for (const alm of pool.alms.filter(a => a.target.toLowerCase() === pool.address.toLowerCase() && a.type !== ALM.A51)) {
|
91
|
-
let almAddress = alm.address;
|
92
|
-
if (alm.type === ALM.Beefy) {
|
93
|
-
almAddress = alm.owner ?? alm.address;
|
94
|
-
}
|
95
|
-
calls.push({
|
96
|
-
allowFailure: true,
|
97
|
-
callData: ERC20Interface.encodeFunctionData("totalSupply"),
|
98
|
-
target: alm.address,
|
99
|
-
});
|
100
|
-
calls.push({
|
101
|
-
allowFailure: true,
|
102
|
-
callData: ERC20Interface.encodeFunctionData("balanceOf", [almAddress]),
|
103
|
-
target: d.campaignParameters.token0,
|
104
|
-
});
|
105
|
-
calls.push({
|
106
|
-
allowFailure: true,
|
107
|
-
callData: ERC20Interface.encodeFunctionData("balanceOf", [almAddress]),
|
108
|
-
target: d.campaignParameters.token1,
|
109
|
-
});
|
110
|
-
}
|
111
|
-
/** Multi-hop ALMs */
|
112
|
-
for (const alm of pool.alms.filter(a => a.target !== pool.address.toLowerCase())) {
|
113
|
-
if (alm.type === ALM.spNFT) {
|
114
|
-
calls.push({
|
115
|
-
allowFailure: true,
|
116
|
-
callData: spNFTInterface.encodeFunctionData("getPoolInfo"),
|
117
|
-
target: alm.address,
|
118
|
-
});
|
119
|
-
}
|
120
|
-
else if (alm.type === ALM.kpNFT) {
|
121
|
-
calls.push({
|
122
|
-
allowFailure: true,
|
123
|
-
callData: spNFTInterface.encodeFunctionData("getPoolInfo"),
|
124
|
-
target: alm.address,
|
125
|
-
});
|
126
|
-
}
|
127
|
-
else if (alm.type === ALM.Nitro) {
|
128
|
-
calls.push({
|
129
|
-
allowFailure: true,
|
130
|
-
callData: NitroInterface.encodeFunctionData("totalDepositAmount"),
|
131
|
-
target: alm.address,
|
132
|
-
});
|
133
|
-
}
|
134
|
-
else if ([ALM.ConcentricStaker, ALM.GammaChef].includes(alm.type)) {
|
135
|
-
calls.push({
|
136
|
-
allowFailure: true,
|
137
|
-
callData: ERC20Interface.encodeFunctionData("balanceOf", [alm.address]),
|
138
|
-
target: alm.target,
|
139
|
-
});
|
140
|
-
}
|
141
|
-
else if (alm.type === ALM.JonesTracker) {
|
142
|
-
calls.push({
|
143
|
-
allowFailure: true,
|
144
|
-
callData: JonesDoubleRewardTracker__factory.createInterface().encodeFunctionData("totalStakedAmount"),
|
145
|
-
target: alm.address,
|
146
|
-
});
|
147
|
-
}
|
148
|
-
else {
|
149
|
-
calls.push({
|
150
|
-
allowFailure: true,
|
151
|
-
callData: ERC20Interface.encodeFunctionData("totalSupply"),
|
152
|
-
target: alm.address,
|
153
|
-
});
|
154
|
-
}
|
155
|
-
}
|
156
|
-
/** A51 Strategies */
|
157
|
-
for (const w of pool.alms.filter(a => a.type === ALM.A51)) {
|
158
|
-
const strategies = A51Strategies?.[pool.address.toLowerCase()]?.[w.address] ?? [];
|
159
|
-
for (const strategy of strategies) {
|
160
|
-
calls.push({
|
161
|
-
allowFailure: true,
|
162
|
-
callData: A51Interface.encodeFunctionData("strategies", [strategy.id]),
|
163
|
-
target: w.address,
|
164
|
-
});
|
165
|
-
}
|
166
|
-
}
|
167
|
-
}
|
168
|
-
/**
|
169
|
-
* Fetch all ALM vaults positions for the pools.
|
170
|
-
* @dev Do it in parallel with 1 call / AMM subgraph to save time.
|
171
|
-
*/
|
172
|
-
const positions = {};
|
173
|
-
const positionsPromise = Object.keys(AMM)
|
174
|
-
.filter(amm => !!merklSubgraphAMMEndpoints[chainId][Number.parseInt(amm)])
|
175
|
-
.map(async (amm) => {
|
176
|
-
const tgURL = merklSubgraphAMMEndpoints[chainId][Number.parseInt(amm)];
|
177
|
-
let targetAddressesList = [];
|
178
|
-
if (!!poolList) {
|
179
|
-
for (const pool of poolList) {
|
180
|
-
if (pool.amm === Number.parseInt(amm)) {
|
181
|
-
/** Add direct alm addresses */
|
182
|
-
targetAddressesList = targetAddressesList.concat(pool.alms
|
183
|
-
.filter(a => a.target.toLowerCase() === pool.address.toLowerCase())
|
184
|
-
?.map(w => {
|
185
|
-
return !!w?.owner && Number.parseInt(amm) !== AMM.Stryke
|
186
|
-
? w.owner.toLowerCase()
|
187
|
-
: w.address.toLowerCase();
|
188
|
-
}) ?? []);
|
189
|
-
/** Add blacklisted / whitelisted addresses (optional) */
|
190
|
-
for (const campaign of campaigns.filter(campaign => campaign.mainParameter.toLowerCase() === pool.mainParameter.toLowerCase())) {
|
191
|
-
const distributionBlacklist = campaign.campaignId === "0x4a805dd97d823dfbc34d138af3d09536ac792b6ad73079573df082c71d4b057c"
|
192
|
-
? [...campaign.campaignParameters.blacklist, "0x657e6d2073A99aF61952beb7EE564169616b90C1"]
|
193
|
-
: campaign.campaignParameters.blacklist;
|
194
|
-
if (!!distributionBlacklist && distributionBlacklist.length > 0)
|
195
|
-
targetAddressesList = targetAddressesList.concat(distributionBlacklist.map((address) => address.toLowerCase()));
|
196
|
-
let distributionWhitelist = campaign.campaignParameters?.whitelist;
|
197
|
-
if (distributionWhitelist.length === 1 &&
|
198
|
-
distributionWhitelist[0].toLowerCase() ===
|
199
|
-
"0xE4bA6740aF4c666325D49B3112E4758371386aDc".toLowerCase()) {
|
200
|
-
distributionWhitelist = ["0xe11d346757d052214686bCbC860C94363AfB4a9A"];
|
201
|
-
}
|
202
|
-
if (!isStrykeCampaign(pool.amm) && !!distributionWhitelist && distributionWhitelist.length > 0)
|
203
|
-
targetAddressesList = targetAddressesList.concat(distributionWhitelist.map((address) => address.toLowerCase()));
|
204
|
-
}
|
205
|
-
}
|
206
|
-
}
|
207
|
-
}
|
208
|
-
targetAddressesList = targetAddressesList.filter((a, index, self) => self.indexOf(a) === index); // Dedupe
|
209
|
-
if (targetAddressesList?.length > 0) {
|
210
|
-
positions[Number.parseInt(amm)] = [];
|
211
|
-
/** Fetch NFT Wrapper positions */
|
212
|
-
const farmedPositionsList = await fetchFarmedPositions(chainId, targetAddressesList, Number(amm));
|
213
|
-
const farmedPositionsById = Object.keys(farmedPositionsList).reduce((acc, curr) => {
|
214
|
-
for (const pos of farmedPositionsList[curr]) {
|
215
|
-
acc[pos.id] = pos;
|
216
|
-
}
|
217
|
-
return acc;
|
218
|
-
}, {});
|
219
|
-
if (Object.keys(farmedPositionsById).length > 0) {
|
220
|
-
let hasFollowingPage = true;
|
221
|
-
let skip = 0;
|
222
|
-
const res = { nft: [] };
|
223
|
-
while (hasFollowingPage) {
|
224
|
-
const auxRes = await request(tgURL, nftPositionByIdsQuery, {
|
225
|
-
ids: Object.keys(farmedPositionsById),
|
226
|
-
skip,
|
227
|
-
});
|
228
|
-
res.nft = res.nft.concat(auxRes.nft ?? []);
|
229
|
-
if (auxRes.nft.length < 1000) {
|
230
|
-
hasFollowingPage = false;
|
231
|
-
}
|
232
|
-
skip += 1000;
|
233
|
-
}
|
234
|
-
if (!!res.nft) {
|
235
|
-
for (const pos of res.nft) {
|
236
|
-
positions[Number.parseInt(amm)]?.push({
|
237
|
-
...pos,
|
238
|
-
owner: farmedPositionsById[pos.id].holder,
|
239
|
-
});
|
240
|
-
}
|
241
|
-
}
|
242
|
-
}
|
243
|
-
await withTimeout((async () => {
|
244
|
-
let hasFollowingPage = true;
|
245
|
-
let skip = 0;
|
246
|
-
const res = { direct: [], nft: [] };
|
247
|
-
while (hasFollowingPage) {
|
248
|
-
const auxRes = await request(tgURL, positionMultipleOwnersQuery, {
|
249
|
-
owners: targetAddressesList,
|
250
|
-
skip,
|
251
|
-
});
|
252
|
-
res.direct = res.direct.concat(auxRes.direct ?? []);
|
253
|
-
res.nft = res.nft.concat(auxRes.nft ?? []);
|
254
|
-
if (auxRes.direct.length < 1000 && auxRes.nft.length < 1000) {
|
255
|
-
hasFollowingPage = false;
|
256
|
-
}
|
257
|
-
skip += 1000;
|
258
|
-
}
|
259
|
-
return res;
|
260
|
-
})().then(res => {
|
261
|
-
if (!!res.direct) {
|
262
|
-
for (const pos of res.direct) {
|
263
|
-
positions[Number.parseInt(amm)]?.push(pos);
|
264
|
-
}
|
265
|
-
}
|
266
|
-
if (!!res.nft) {
|
267
|
-
for (const pos of res.nft) {
|
268
|
-
positions[Number.parseInt(amm)]?.push(pos);
|
269
|
-
}
|
270
|
-
}
|
271
|
-
}), MERKL_ALM_POSITION_FETCHING_TIMEOUT).catch(error => {
|
272
|
-
const service = `Merkl AMM Subgraph for ${NETWORK_LABELS[chainId]} ${AMM[Number.parseInt(amm)]}`;
|
273
|
-
log.error(service, error, service, tgURL);
|
274
|
-
});
|
275
|
-
}
|
276
|
-
});
|
277
|
-
const result = await ChainInteractionService(chainId).fetchState(calls);
|
278
|
-
// Wait for position fetching before finalizing the data
|
279
|
-
await Promise.all(positionsPromise);
|
280
|
-
let i = 0;
|
281
|
-
if (!!poolList) {
|
282
|
-
for (const pool of poolList) {
|
283
|
-
const poolInterface = PoolInterface[AMMAlgorithmMapping[pool.amm]];
|
284
|
-
// This liquidity call gives the active liquidity on the pool. To get the total liquidity we would need to loop over all positions
|
285
|
-
let poolTotalLiquidity;
|
286
|
-
let sqrtPrice;
|
287
|
-
let poolBalanceToken0;
|
288
|
-
let poolBalanceToken1;
|
289
|
-
const d = campaigns?.filter(campaign => campaign.mainParameter.toLowerCase() === pool.mainParameter.toLowerCase())[0];
|
290
|
-
const decimalsToken0 = d.campaignParameters.decimalsToken0;
|
291
|
-
const decimalsToken1 = d.campaignParameters.decimalsToken1;
|
292
|
-
const symbolToken0 = d.campaignParameters.symbolToken0;
|
293
|
-
const symbolToken1 = d.campaignParameters.symbolToken1;
|
294
|
-
const prevI = i;
|
295
|
-
try {
|
296
|
-
poolTotalLiquidity = BN2Number(poolInterface.decodeFunctionResult(Liquidity[AMMAlgorithmMapping[pool.amm]], result[i++].returnData)[DecodeLiquidity[AMMAlgorithmMapping[pool.amm]]]);
|
297
|
-
sqrtPrice = poolInterface
|
298
|
-
.decodeFunctionResult(PoolState[AMMAlgorithmMapping[pool.amm]], result[i++].returnData)[SqrtPrice[AMMAlgorithmMapping[pool.amm]]].toString();
|
299
|
-
poolBalanceToken0 = BN2Number(ERC20Interface.decodeFunctionResult("balanceOf", result[i++].returnData)[0], decimalsToken0);
|
300
|
-
poolBalanceToken1 = BN2Number(ERC20Interface.decodeFunctionResult("balanceOf", result[i++].returnData)[0], decimalsToken1);
|
301
|
-
}
|
302
|
-
catch (e) {
|
303
|
-
log.warn(`merklDynamic data - failed to decode state of pool ${pool.address} on ${NETWORK_LABELS[chainId]}`);
|
304
|
-
i = prevI + 4;
|
305
|
-
continue;
|
306
|
-
}
|
307
|
-
const priceToken0 = await TokenService.getPrice({
|
308
|
-
address: d.campaignParameters.token0,
|
309
|
-
chainId: chainId,
|
310
|
-
symbol: symbolToken0,
|
311
|
-
});
|
312
|
-
const priceToken1 = await TokenService.getPrice({
|
313
|
-
address: d.campaignParameters.token1,
|
314
|
-
chainId: chainId,
|
315
|
-
symbol: symbolToken1,
|
316
|
-
});
|
317
|
-
const almDetails = [];
|
318
|
-
/** Direct ALMs */
|
319
|
-
for (const w of pool.alms.filter(a => a.target.toLowerCase() === pool.address.toLowerCase() && a.type !== ALM.A51)) {
|
320
|
-
const prevI = i;
|
321
|
-
try {
|
322
|
-
const totalSupply = BN2Number(ERC20Interface.decodeFunctionResult("totalSupply", result[i++].returnData)[0]);
|
323
|
-
const almIdleBalance0 = BN2Number(ERC20Interface.decodeFunctionResult("balanceOf", result[i++].returnData)[0], d.campaignParameters.decimalsToken0);
|
324
|
-
let almBalance0 = almIdleBalance0;
|
325
|
-
const almIdleBalance1 = BN2Number(ERC20Interface.decodeFunctionResult("balanceOf", result[i++].returnData)[0], d.campaignParameters.decimalsToken1);
|
326
|
-
let almBalance1 = almIdleBalance1;
|
327
|
-
let almTotalLiquidity = 0;
|
328
|
-
let almInRangeLiquidity = 0;
|
329
|
-
const almPositions = positions?.[pool.amm]?.filter(pos => pos.pool.id === pool.address.toLowerCase() &&
|
330
|
-
[w.address.toLowerCase(), ...[!!w?.owner && w.owner.toLowerCase()]].includes(pos.owner.toLowerCase()));
|
331
|
-
const almPositionsWithAPIType = [];
|
332
|
-
if (!!almPositions) {
|
333
|
-
for (const position of almPositions) {
|
334
|
-
const upperTick = Number.parseInt(position.tickUpper);
|
335
|
-
const lowerTick = Number.parseInt(position.tickLower);
|
336
|
-
const [amount0, amount1] = getAmountsForLiquidity(sqrtPrice, lowerTick, upperTick, BigNumber.from(position.liquidity));
|
337
|
-
const balance0 = BN2Number(amount0, decimalsToken0);
|
338
|
-
const balance1 = BN2Number(amount1, decimalsToken1);
|
339
|
-
const totalLiquidity = BN2Number(position.liquidity);
|
340
|
-
const inRangeLiquidity = balance0 > 0 && balance1 > 0 ? (BN2Number(position.liquidity) ?? 0) : 0;
|
341
|
-
almTotalLiquidity += totalLiquidity;
|
342
|
-
almInRangeLiquidity += inRangeLiquidity;
|
343
|
-
almBalance0 += balance0;
|
344
|
-
almBalance1 += balance1;
|
345
|
-
almPositionsWithAPIType.push({
|
346
|
-
balance0,
|
347
|
-
balance1,
|
348
|
-
id: position.id,
|
349
|
-
inRangeLiquidity,
|
350
|
-
lowerTick,
|
351
|
-
totalLiquidity,
|
352
|
-
tvl: priceToken0 * balance0 + priceToken1 * balance1,
|
353
|
-
upperTick,
|
354
|
-
});
|
355
|
-
}
|
356
|
-
// The wrapper type can exist in the subgraph without being declared in the SDK which can lead to type errors
|
357
|
-
if (!!ALMMapping[pool.amm] && w.type in ALMMapping[pool.amm]) {
|
358
|
-
almDetails.push({
|
359
|
-
almAPR: 0, // filled later on
|
360
|
-
almAddress: utils.getAddress(w.address),
|
361
|
-
almBalance0,
|
362
|
-
almIdleBalance0,
|
363
|
-
almIdleBalance1,
|
364
|
-
almBalance1,
|
365
|
-
almInRangeLiquidity,
|
366
|
-
almTVL: almBalance0 * priceToken0 + almBalance1 * priceToken1,
|
367
|
-
almTotalLiquidity,
|
368
|
-
forwarderType: Forwarder.CLAMM,
|
369
|
-
label: `${ALMMapping[pool.amm]?.[w.type]} ${w.address}`,
|
370
|
-
origin: w.type,
|
371
|
-
positions: almPositionsWithAPIType,
|
372
|
-
priority: 0,
|
373
|
-
sender: utils.getAddress(w.address),
|
374
|
-
target: w.target,
|
375
|
-
owner: utils.getAddress(w.owner ?? w.address),
|
376
|
-
totalSupply,
|
377
|
-
type: w.type,
|
378
|
-
});
|
379
|
-
}
|
380
|
-
}
|
381
|
-
}
|
382
|
-
catch (e) {
|
383
|
-
log.warn(`merklDynamic data - failed to handle direct alm data of pool ${pool.address} on ${NETWORK_LABELS[chainId]} - ${w.address}`);
|
384
|
-
i = prevI + 3;
|
385
|
-
}
|
386
|
-
}
|
387
|
-
/** Multi-hop ALMs */
|
388
|
-
for (const w of pool.alms.filter(a => a.target !== pool.address.toLowerCase())) {
|
389
|
-
const prevI = i;
|
390
|
-
try {
|
391
|
-
let totalSupply;
|
392
|
-
if (w.type === ALM.spNFT) {
|
393
|
-
totalSupply = BN2Number(spNFTInterface.decodeFunctionResult("getPoolInfo", result[i++].returnData)[5]);
|
394
|
-
}
|
395
|
-
else if (w.type === ALM.kpNFT) {
|
396
|
-
totalSupply = BN2Number(spNFTInterface.decodeFunctionResult("getPoolInfo", result[i++].returnData)[5]);
|
397
|
-
}
|
398
|
-
else if (w.type === ALM.Nitro) {
|
399
|
-
totalSupply = BN2Number(NitroInterface.decodeFunctionResult("totalDepositAmount", result[i++].returnData)[0]);
|
400
|
-
}
|
401
|
-
else if ([ALM.ConcentricStaker, ALM.GammaChef].includes(w.type)) {
|
402
|
-
totalSupply = BN2Number(ERC20Interface.decodeFunctionResult("balanceOf", result[i++].returnData)[0]);
|
403
|
-
}
|
404
|
-
else if (w.type === ALM.JonesTracker) {
|
405
|
-
totalSupply = BN2Number(JonesDoubleRewardTracker__factory.createInterface().decodeFunctionResult("totalStakedAmount", result[i++].returnData)[0]);
|
406
|
-
}
|
407
|
-
else {
|
408
|
-
totalSupply = BN2Number(ERC20Interface.decodeFunctionResult("totalSupply", result[i++].returnData)[0]);
|
409
|
-
}
|
410
|
-
const wrappedALM = almDetails.filter(a => utils.getAddress(a.almAddress) === utils.getAddress(w.target))[0];
|
411
|
-
if (!!wrappedALM && !!wrappedALM.totalSupply) {
|
412
|
-
const ratio = totalSupply / wrappedALM.totalSupply;
|
413
|
-
almDetails.push({
|
414
|
-
almAPR: 0,
|
415
|
-
// filled later on
|
416
|
-
almAddress: w.address,
|
417
|
-
almIdleBalance0: 0,
|
418
|
-
almIdleBalance1: 0,
|
419
|
-
almBalance0: ratio * wrappedALM.almBalance0,
|
420
|
-
almBalance1: ratio * wrappedALM.almBalance1,
|
421
|
-
almInRangeLiquidity: ratio * wrappedALM.almInRangeLiquidity,
|
422
|
-
almTVL: ratio * wrappedALM.almTVL,
|
423
|
-
almTotalLiquidity: ratio * wrappedALM.almTotalLiquidity,
|
424
|
-
forwarderType: Forwarder.CLAMM,
|
425
|
-
label: `${ALMMapping[pool.amm]?.[w.type]} ${w.address}`,
|
426
|
-
origin: w.type,
|
427
|
-
positions: wrappedALM.positions.map(pos => {
|
428
|
-
return {
|
429
|
-
...pos,
|
430
|
-
balance0: ratio * pos.balance0,
|
431
|
-
balance1: ratio * pos.balance1,
|
432
|
-
inRangeLiquidity: ratio * pos.inRangeLiquidity,
|
433
|
-
totalLiquidity: ratio * pos.totalLiquidity,
|
434
|
-
tvl: ratio * pos.tvl,
|
435
|
-
};
|
436
|
-
}),
|
437
|
-
priority: wrappedALM.priority + 1,
|
438
|
-
sender: utils.getAddress(w.address),
|
439
|
-
target: w.target,
|
440
|
-
owner: w.owner ?? w.address,
|
441
|
-
totalSupply,
|
442
|
-
type: w.type,
|
443
|
-
});
|
444
|
-
}
|
445
|
-
else {
|
446
|
-
log.local(`Target ALM not found (${NETWORK_LABELS[chainId]}). Address: ${w.address}, Target: ${w.target}`);
|
447
|
-
}
|
448
|
-
}
|
449
|
-
catch {
|
450
|
-
log.warn(`merklDynamic data - failed to handle multi hop alm data of pool ${pool.address} on ${NETWORK_LABELS[chainId]} - ${w.address}`);
|
451
|
-
i = prevI + 1;
|
452
|
-
}
|
453
|
-
}
|
454
|
-
/** A51 Strategies */
|
455
|
-
for (const w of pool.alms.filter(a => a.type === ALM.A51)) {
|
456
|
-
const prevI = i;
|
457
|
-
const strategies = A51Strategies?.[pool.address.toLowerCase()]?.[w.address] ?? [];
|
458
|
-
let j = 0;
|
459
|
-
for (const strategy of strategies) {
|
460
|
-
j++;
|
461
|
-
const almPositionsWithAPIType = [];
|
462
|
-
let almTotalLiquidity = 0;
|
463
|
-
let almInRangeLiquidity = 0;
|
464
|
-
let almBalance0 = 0;
|
465
|
-
let almBalance1 = 0;
|
466
|
-
try {
|
467
|
-
// struct StrategyData {
|
468
|
-
// StrategyKey key; 0
|
469
|
-
// address owner; 1
|
470
|
-
// bytes actions; 2
|
471
|
-
// bytes actionStatus; 3
|
472
|
-
// bool isCompound; 4
|
473
|
-
// bool isPrivate; 5
|
474
|
-
// uint256 managementFee; 6
|
475
|
-
// uint256 performanceFee; 7
|
476
|
-
// Account account; 8
|
477
|
-
// }
|
478
|
-
const strategyAccount = A51Interface.decodeFunctionResult("strategies", result[i++].returnData)[8];
|
479
|
-
// struct Account {
|
480
|
-
// uint256 fee0; 0
|
481
|
-
// uint256 fee1; 1
|
482
|
-
// uint256 balance0; 2
|
483
|
-
// uint256 balance1; 3
|
484
|
-
// uint256 totalShares; 4
|
485
|
-
// uint128 uniswapLiquidity;
|
486
|
-
// uint256 feeGrowthInside0LastX128;
|
487
|
-
// uint256 feeGrowthInside1LastX128;
|
488
|
-
// uint256 feeGrowthOutside0LastX128;
|
489
|
-
// uint256 feeGrowthOutside1LastX128;
|
490
|
-
// }
|
491
|
-
const a51Positions = positions?.[pool.amm]?.filter(pos => pos.pool.id === pool.address.toLowerCase() &&
|
492
|
-
pos.owner === w.address.toLowerCase() &&
|
493
|
-
pos.tickLower === strategy.tickLower.toString() &&
|
494
|
-
pos.tickUpper === strategy.tickUpper.toString());
|
495
|
-
if (!!a51Positions) {
|
496
|
-
for (const position of a51Positions) {
|
497
|
-
const upperTick = Number.parseInt(position.tickUpper);
|
498
|
-
const lowerTick = Number.parseInt(position.tickLower);
|
499
|
-
const [amount0, amount1] = getAmountsForLiquidity(sqrtPrice, lowerTick, upperTick, BigNumber.from(position.liquidity));
|
500
|
-
const balance0 = BN2Number(amount0, decimalsToken0);
|
501
|
-
const balance1 = BN2Number(amount1, decimalsToken1);
|
502
|
-
const totalLiquidity = BN2Number(position.liquidity);
|
503
|
-
const inRangeLiquidity = balance0 > 0 && balance1 > 0 ? (BN2Number(position.liquidity) ?? 0) : 0;
|
504
|
-
almTotalLiquidity += totalLiquidity;
|
505
|
-
almInRangeLiquidity += inRangeLiquidity;
|
506
|
-
almBalance0 += balance0;
|
507
|
-
almBalance1 += balance1;
|
508
|
-
almPositionsWithAPIType.push({
|
509
|
-
balance0,
|
510
|
-
balance1,
|
511
|
-
id: position.id,
|
512
|
-
inRangeLiquidity,
|
513
|
-
lowerTick,
|
514
|
-
totalLiquidity,
|
515
|
-
tvl: priceToken0 * balance0 + priceToken1 * balance1,
|
516
|
-
upperTick,
|
517
|
-
});
|
518
|
-
}
|
519
|
-
}
|
520
|
-
if (!!ALMMapping[pool.amm] && w.type in ALMMapping[pool.amm]) {
|
521
|
-
almDetails.push({
|
522
|
-
almAPR: 0,
|
523
|
-
// filled later on
|
524
|
-
almAddress: utils.getAddress(w.address),
|
525
|
-
almBalance0,
|
526
|
-
almBalance1,
|
527
|
-
almIdleBalance0: 0,
|
528
|
-
almIdleBalance1: 0,
|
529
|
-
almInRangeLiquidity,
|
530
|
-
almTVL: almBalance0 * priceToken0 + almBalance1 * priceToken1,
|
531
|
-
almTotalLiquidity,
|
532
|
-
forwarderType: Forwarder.CLAMM,
|
533
|
-
label: `${ALMMapping[pool.amm]?.[w.type]} ${w.address} - ${strategy.id}`,
|
534
|
-
origin: w.type,
|
535
|
-
positions: almPositionsWithAPIType,
|
536
|
-
priority: 0,
|
537
|
-
sender: w.address,
|
538
|
-
target: w.target,
|
539
|
-
owner: w.owner ?? w.address,
|
540
|
-
totalSupply: strategyAccount[4].toString(),
|
541
|
-
type: w.type,
|
542
|
-
});
|
543
|
-
}
|
544
|
-
}
|
545
|
-
catch (e) {
|
546
|
-
log.warn(`merklDynamic data - failed to handle A51 data of pool ${pool.address} on ${NETWORK_LABELS[chainId]} - ${w.address}`);
|
547
|
-
i = prevI + j;
|
548
|
-
}
|
549
|
-
}
|
550
|
-
}
|
551
|
-
/** Iterate over distributions to compute APRs */
|
552
|
-
for (const campaign of campaigns.filter(campaign => campaign.mainParameter.toLowerCase() === pool.mainParameter.toLowerCase())) {
|
553
|
-
const c = campaign;
|
554
|
-
const amount = BN2Number(c.amount, c.campaignParameters.decimalsRewardToken);
|
555
|
-
const startTimestamp = BN2Number(c.startTimestamp, 0);
|
556
|
-
const endTimestamp = BN2Number(c.endTimestamp, 0);
|
557
|
-
const isLive = moment().unix() > startTimestamp && moment().unix() < endTimestamp;
|
558
|
-
const totalWeight = BN2Number(c.campaignParameters.weightFees, 4) +
|
559
|
-
BN2Number(c.campaignParameters.weightToken0, 4) +
|
560
|
-
BN2Number(c.campaignParameters.weightToken1, 4);
|
561
|
-
// Proportions in percentage
|
562
|
-
const propFees = (BN2Number(c.campaignParameters.weightFees, 4) / totalWeight) * 100;
|
563
|
-
const propToken0 = (BN2Number(c.campaignParameters.weightToken0, 4) / totalWeight) * 100;
|
564
|
-
const propToken1 = (BN2Number(c.campaignParameters.weightToken1, 4) / totalWeight) * 100;
|
565
|
-
let distributionMeanAPR = 0;
|
566
|
-
let blacklistedBalance0 = 0;
|
567
|
-
let blacklistedBalance1 = 0;
|
568
|
-
let blacklistedLiquidity = 0;
|
569
|
-
/**
|
570
|
-
* @dev In case there is a super amm handling some other amm lp positions,
|
571
|
-
* we only need to check the positions associated to this super amm subgraph
|
572
|
-
* in order to compute the APRs.
|
573
|
-
* Yet, the pool will still be labelled with the main amm
|
574
|
-
*/
|
575
|
-
const amm = c.campaignParameters.whitelist.length > 0 && !!PriorityAMM?.[chainId]?.[c.campaignParameters.whitelist[0]]
|
576
|
-
? PriorityAMM[chainId]?.[c.campaignParameters.whitelist[0]]
|
577
|
-
: pool.amm;
|
578
|
-
const aprs = {};
|
579
|
-
const aprBreakdowns = [];
|
580
|
-
/** Clear alm APRs */
|
581
|
-
const distributionForwarders = almDetails.map(x => ({ ...x }));
|
582
|
-
let priceRewardToken = 0;
|
583
|
-
if (isLive && c.campaignParameters.symbolRewardToken !== "aglaMerkl") {
|
584
|
-
// priceRewardToken = (await pricer.get({
|
585
|
-
// address: c.rewardToken,
|
586
|
-
// chainId: chainId,
|
587
|
-
// symbol: c.campaignParameters.symbolRewardToken,
|
588
|
-
// })) as number;
|
589
|
-
priceRewardToken = await TokenService.getRewardTokenPrice(campaign);
|
590
|
-
/**
|
591
|
-
* Handle whitelisted/blacklisted addresses to compute APR
|
592
|
-
*/
|
593
|
-
if (c.campaignParameters.whitelist.length > 0) {
|
594
|
-
blacklistedBalance0 = poolBalanceToken0;
|
595
|
-
blacklistedBalance1 = poolBalanceToken1;
|
596
|
-
blacklistedLiquidity = poolTotalLiquidity;
|
597
|
-
// Get all beefy staker is whitelisted, get a list of all senders
|
598
|
-
let targetToMatch = "";
|
599
|
-
for (const alm of almDetails.filter(a => a.type === ALM.BeefyStaker)) {
|
600
|
-
if (c.campaignParameters.whitelist.includes(alm.sender)) {
|
601
|
-
targetToMatch = alm.target;
|
602
|
-
}
|
603
|
-
}
|
604
|
-
if (targetToMatch !== "") {
|
605
|
-
for (const alm of almDetails.filter(a => a.type === ALM.Beefy)) {
|
606
|
-
if (targetToMatch === alm.sender.toLowerCase()) {
|
607
|
-
c.campaignParameters.whitelist.push(alm.owner);
|
608
|
-
}
|
609
|
-
}
|
610
|
-
}
|
611
|
-
positions?.[pool.amm]?.forEach(pos => {
|
612
|
-
if (pos.pool.id === pool.address.toLowerCase() &&
|
613
|
-
(isWhitelisted(pos.owner, c.campaignParameters.whitelist) || isStrykeCampaign(pool.amm))) {
|
614
|
-
let [amount0, amount1] = [BigNumber.from(0), BigNumber.from(0)];
|
615
|
-
try {
|
616
|
-
[amount0, amount1] = getAmountsForLiquidity(sqrtPrice, Number.parseInt(pos.tickLower), Number.parseInt(pos.tickUpper), BigNumber.from(pos.liquidity));
|
617
|
-
}
|
618
|
-
catch {
|
619
|
-
log.warn(`merklDynamic data - failed to handle whitelisted positions of pool ${pool.address} on ${NETWORK_LABELS[chainId]} - ${pos.owner} ${pos.tickLower} ${pos.tickUpper} ${pos.liquidity}`);
|
620
|
-
}
|
621
|
-
blacklistedBalance0 -= BN2Number(amount0, decimalsToken0);
|
622
|
-
blacklistedBalance1 -= BN2Number(amount1, decimalsToken1);
|
623
|
-
if (c.campaignParameters.isOutOfRangeIncentivized
|
624
|
-
? BN2Number(amount0, decimalsToken0) > 0 || BN2Number(amount1, decimalsToken1) > 0
|
625
|
-
: BN2Number(amount0, decimalsToken0) > 0 && BN2Number(amount1, decimalsToken1) > 0)
|
626
|
-
blacklistedLiquidity -= BN2Number(pos.liquidity);
|
627
|
-
}
|
628
|
-
// Handling the case of a ALM of priority 2 being whitelisted
|
629
|
-
else if (pos.pool.id === pool.address.toLowerCase() &&
|
630
|
-
almDetails.map(a => a.target.toLowerCase()).includes(pos.owner.toLowerCase()) // If pos owner is an ALM
|
631
|
-
) {
|
632
|
-
// If we're in this branch it means the ALM owning the position is not whitelisted
|
633
|
-
const almHolding = almDetails.filter(a => a.almAddress.toLowerCase() === pos.owner.toLowerCase())[0];
|
634
|
-
for (const whitelistedAddress of c.campaignParameters.whitelist) {
|
635
|
-
const forwarderIndex = distributionForwarders.findIndex(f => utils.getAddress(f.almAddress) === utils.getAddress(whitelistedAddress));
|
636
|
-
if (forwarderIndex !== -1 &&
|
637
|
-
almHolding.almAddress.toLowerCase() ===
|
638
|
-
distributionForwarders[forwarderIndex].target.toLowerCase()) {
|
639
|
-
// If we are here it means one of the ALM whitelisted is a "child" of the ALM holding the position
|
640
|
-
const childALM = distributionForwarders[forwarderIndex];
|
641
|
-
let [amount0, amount1] = [BigNumber.from(0), BigNumber.from(0)];
|
642
|
-
try {
|
643
|
-
[amount0, amount1] = getAmountsForLiquidity(sqrtPrice, Number.parseInt(pos.tickLower), Number.parseInt(pos.tickUpper), BigNumber.from(pos.liquidity));
|
644
|
-
}
|
645
|
-
catch {
|
646
|
-
log.warn(`merklDynamic data - failed to handle whitelisted positions of pool ${pool.address} on ${NETWORK_LABELS[chainId]} - ${pos.owner} ${pos.tickLower} ${pos.tickUpper} ${pos.liquidity}`);
|
647
|
-
}
|
648
|
-
blacklistedBalance0 -=
|
649
|
-
(BN2Number(amount0, decimalsToken0) * childALM.almBalance0) / almHolding.almBalance0;
|
650
|
-
blacklistedBalance1 -=
|
651
|
-
(BN2Number(amount1, decimalsToken1) * childALM.almBalance1) / almHolding.almBalance1;
|
652
|
-
if (c.campaignParameters.isOutOfRangeIncentivized
|
653
|
-
? BN2Number(amount0, decimalsToken0) > 0 || BN2Number(amount1, decimalsToken1) > 0
|
654
|
-
: BN2Number(amount0, decimalsToken0) > 0 && BN2Number(amount1, decimalsToken1) > 0)
|
655
|
-
blacklistedLiquidity -=
|
656
|
-
(BN2Number(pos.liquidity) * childALM.almTotalLiquidity) / almHolding.almTotalLiquidity;
|
657
|
-
}
|
658
|
-
}
|
659
|
-
}
|
660
|
-
});
|
661
|
-
}
|
662
|
-
else if (c.campaignParameters.blacklist.length > 0) {
|
663
|
-
blacklistedBalance0 = 0;
|
664
|
-
blacklistedBalance1 = 0;
|
665
|
-
blacklistedLiquidity = 0;
|
666
|
-
for (const blacklistedAddress of c.campaignParameters.blacklist) {
|
667
|
-
const blackAddressPositions = positions?.[amm]?.filter(pos => pos.pool.id === pool.address.toLowerCase() && pos.owner === blacklistedAddress.toLowerCase());
|
668
|
-
if (!!blackAddressPositions) {
|
669
|
-
for (const position of blackAddressPositions) {
|
670
|
-
const [amount0, amount1] = getAmountsForLiquidity(sqrtPrice, Number.parseInt(position.tickLower), Number.parseInt(position.tickUpper), BigNumber.from(position.liquidity));
|
671
|
-
blacklistedBalance0 += BN2Number(amount0, decimalsToken0);
|
672
|
-
blacklistedBalance1 += BN2Number(amount1, decimalsToken1);
|
673
|
-
if (BN2Number(amount0, decimalsToken0) > 0 && BN2Number(amount1, decimalsToken1) > 0)
|
674
|
-
blacklistedLiquidity += BN2Number(position.liquidity);
|
675
|
-
}
|
676
|
-
}
|
677
|
-
}
|
678
|
-
}
|
679
|
-
/** Yearly rewards in $ */
|
680
|
-
const yearlyToken0Rewards = (propToken0 * priceRewardToken * amount * (365 * 24 * 3_600)) / (endTimestamp - startTimestamp);
|
681
|
-
const yearlyToken1Rewards = (propToken1 * priceRewardToken * amount * (365 * 24 * 3_600)) / (endTimestamp - startTimestamp);
|
682
|
-
const yearlyFeeRewards = (propFees * priceRewardToken * amount * (365 * 24 * 3_600)) / (endTimestamp - startTimestamp);
|
683
|
-
let poolAPRkey = "";
|
684
|
-
// /**
|
685
|
-
// * @notice Stryke users receive rewards with respect to their LP positions (they hold through
|
686
|
-
// * Stryke contracts and the `used liquidity` hold in the Stryke option market contracts
|
687
|
-
// */
|
688
|
-
// if (amm === AMM.Stryke || amm === AMM.StrykePCS) {
|
689
|
-
// try {
|
690
|
-
// poolBalanceToken0 +=
|
691
|
-
// BN2Number(
|
692
|
-
// await Erc20__factory.connect(c.campaignParameters.token0, providers[chainId]).balanceOf(
|
693
|
-
// DOPEX_OPTION_MARKET[pool.address.toLowerCase()]
|
694
|
-
// ),
|
695
|
-
// c.campaignParameters.decimalsToken0
|
696
|
-
// ) / 2;
|
697
|
-
// poolBalanceToken1 +=
|
698
|
-
// BN2Number(
|
699
|
-
// await Erc20__factory.connect(c.campaignParameters.token1, providers[chainId]).balanceOf(
|
700
|
-
// DOPEX_OPTION_MARKET[pool.address.toLowerCase()]
|
701
|
-
// ),
|
702
|
-
// c.campaignParameters.decimalsToken1
|
703
|
-
// ) / 2;
|
704
|
-
// } catch {
|
705
|
-
// log.error(
|
706
|
-
// "clamm dynamic data fetching",
|
707
|
-
// `failed to handle dopex option market - ${pool.address}`
|
708
|
-
// );
|
709
|
-
// }
|
710
|
-
// }
|
711
|
-
/**
|
712
|
-
* General APR (@notice potentially with a boost)
|
713
|
-
*/
|
714
|
-
const poolBalanceToken0WithoutBlacklist = Math.max(poolBalanceToken0 - (blacklistedBalance0 ?? 0), 0.00001);
|
715
|
-
const poolBalanceToken1WithoutBlacklist = Math.max(poolBalanceToken1 - (blacklistedBalance1 ?? 0), 0.00001);
|
716
|
-
const poolLiquidityWithoutBlacklist = Math.max(poolTotalLiquidity - (blacklistedLiquidity ?? 0), 0);
|
717
|
-
const tvl = isStrykeCampaign(amm)
|
718
|
-
? (await axios.get(`https://api.stryke.xyz/clamm/stats/tvl/${pool.address}?chainId=${chainId}`))
|
719
|
-
.data
|
720
|
-
: poolBalanceToken0WithoutBlacklist * priceToken0 + poolBalanceToken1WithoutBlacklist * priceToken1;
|
721
|
-
distributionMeanAPR = (yearlyToken0Rewards + yearlyToken1Rewards + yearlyFeeRewards) / tvl;
|
722
|
-
distributionMeanAPR = !distributionMeanAPR || Number.isNaN(distributionMeanAPR) ? 0 : distributionMeanAPR;
|
723
|
-
/**
|
724
|
-
* @dev We cannot include a whitelisted distrib apr into the mean APR
|
725
|
-
*/
|
726
|
-
if (c.campaignParameters.whitelist.length === 0) {
|
727
|
-
poolAPRkey = "Average APR (rewards / pool TVL)";
|
728
|
-
if (!aprs[poolAPRkey])
|
729
|
-
aprs[poolAPRkey] = 0;
|
730
|
-
aprs[poolAPRkey] += distributionMeanAPR;
|
731
|
-
// @Hugo wip: new way to structure aprBreakdowns
|
732
|
-
aprBreakdowns.push({
|
733
|
-
address: pool.address,
|
734
|
-
value: distributionMeanAPR,
|
735
|
-
type: EAprBreakdownType.AVERAGE,
|
736
|
-
label: "Average APR (rewards / pool TVL)",
|
737
|
-
});
|
738
|
-
// APR per token
|
739
|
-
poolAPRkey = `APR for holding ${c.campaignParameters.symbolToken0} in pool`;
|
740
|
-
if (!aprs[poolAPRkey])
|
741
|
-
aprs[poolAPRkey] = 0;
|
742
|
-
aprs[poolAPRkey] += yearlyToken0Rewards / (poolBalanceToken0WithoutBlacklist * priceToken0);
|
743
|
-
// @Hugo wip: new way to structure aprBreakdowns
|
744
|
-
aprBreakdowns.push({
|
745
|
-
address: pool.address,
|
746
|
-
value: yearlyToken0Rewards / (poolBalanceToken0WithoutBlacklist * priceToken0),
|
747
|
-
type: EAprBreakdownType.TOKEN1,
|
748
|
-
label: c.campaignParameters.symbolToken0,
|
749
|
-
});
|
750
|
-
poolAPRkey = `APR for holding ${c.campaignParameters.symbolToken1} in pool`;
|
751
|
-
if (!aprs[poolAPRkey])
|
752
|
-
aprs[poolAPRkey] = 0;
|
753
|
-
aprs[poolAPRkey] += yearlyToken1Rewards / (poolBalanceToken1WithoutBlacklist * priceToken1);
|
754
|
-
// @Hugo wip: new way to structure aprBreakdowns
|
755
|
-
aprBreakdowns.push({
|
756
|
-
address: pool.address,
|
757
|
-
value: yearlyToken1Rewards / (poolBalanceToken1WithoutBlacklist * priceToken1),
|
758
|
-
type: EAprBreakdownType.TOKEN2,
|
759
|
-
label: c.campaignParameters.symbolToken1,
|
760
|
-
});
|
761
|
-
}
|
762
|
-
else {
|
763
|
-
for (const whitelistedAddress of c.campaignParameters.whitelist) {
|
764
|
-
const forwarderIndex = distributionForwarders.findIndex(f => utils.getAddress(f.almAddress) === utils.getAddress(whitelistedAddress));
|
765
|
-
const poolAPRkey = `Whitelisted campaign on ${ammName(amm)} via address ${shortenAddress(c.campaignParameters.whitelist[0])} Average APR`;
|
766
|
-
if (!aprs[poolAPRkey])
|
767
|
-
aprs[poolAPRkey] = 0;
|
768
|
-
// Account for idle liquidity
|
769
|
-
if (forwarderIndex > -1) {
|
770
|
-
// @Hugo wip: new way to structure aprBreakdowns
|
771
|
-
const breakdownWl = {
|
772
|
-
address: c.campaignParameters.whitelist[0],
|
773
|
-
value: 0,
|
774
|
-
type: EAprBreakdownType.WHITELIST,
|
775
|
-
label: ammName(amm),
|
776
|
-
};
|
777
|
-
if (distributionForwarders[forwarderIndex].priority === 2) {
|
778
|
-
distributionMeanAPR =
|
779
|
-
(yearlyToken0Rewards + yearlyToken1Rewards + yearlyFeeRewards) /
|
780
|
-
(tvl +
|
781
|
-
distributionForwarders[forwarderIndex].almBalance0 * priceToken0 +
|
782
|
-
distributionForwarders[forwarderIndex].almBalance1 * priceToken1);
|
783
|
-
}
|
784
|
-
else {
|
785
|
-
distributionMeanAPR =
|
786
|
-
(yearlyToken0Rewards + yearlyToken1Rewards + yearlyFeeRewards) /
|
787
|
-
(tvl +
|
788
|
-
distributionForwarders[forwarderIndex].almIdleBalance0 * priceToken0 +
|
789
|
-
distributionForwarders[forwarderIndex].almIdleBalance1 * priceToken1);
|
790
|
-
}
|
791
|
-
distributionMeanAPR =
|
792
|
-
!distributionMeanAPR || Number.isNaN(distributionMeanAPR) ? 0 : distributionMeanAPR;
|
793
|
-
// @Hugo wip: new way to structure aprBreakdowns
|
794
|
-
breakdownWl.value = distributionMeanAPR;
|
795
|
-
aprBreakdowns.push(breakdownWl);
|
796
|
-
}
|
797
|
-
}
|
798
|
-
aprs[poolAPRkey] += distributionMeanAPR;
|
799
|
-
}
|
800
|
-
/**
|
801
|
-
* ALM APRs
|
802
|
-
* @notice given a campaign
|
803
|
-
* */
|
804
|
-
distributionForwarders.forEach((alm, index) => {
|
805
|
-
const targetForwarder = distributionForwarders.filter(f => f.almAddress.toLowerCase() === alm.target.toLowerCase())?.[0];
|
806
|
-
// @Hugo wip: new way to structure aprBreakdowns
|
807
|
-
const aprsBreakdown = getForwarderAprbreakDown(distributionForwarders, alm, c, pool, yearlyToken0Rewards, yearlyToken1Rewards, yearlyFeeRewards, poolBalanceToken0WithoutBlacklist, poolBalanceToken1WithoutBlacklist, poolLiquidityWithoutBlacklist, tvl, distributionMeanAPR, index, chainId, amm);
|
808
|
-
// @Hugo wip: new way to structure aprBreakdowns
|
809
|
-
aprsBreakdown && aprBreakdowns.push(aprsBreakdown);
|
810
|
-
const isALMWhitelisted = c.campaignParameters.whitelist.length > 0
|
811
|
-
? isStrykeCampaign(pool.amm)
|
812
|
-
? true
|
813
|
-
: isWhitelisted(alm.sender, c.campaignParameters.whitelist) ||
|
814
|
-
isWhitelisted(alm.almAddress, c.campaignParameters.whitelist) ||
|
815
|
-
isWhitelisted(!!alm?.owner ? alm.owner : "", c.campaignParameters.whitelist) ||
|
816
|
-
isWhitelisted(!!alm?.target ? alm.target : "", c.campaignParameters.whitelist) ||
|
817
|
-
(!!targetForwarder?.owner &&
|
818
|
-
isWhitelisted(targetForwarder?.owner, c.campaignParameters.whitelist))
|
819
|
-
: true;
|
820
|
-
const isBlacklistedByCampaign = isBlacklisted(alm.sender, c.campaignParameters.blacklist) ||
|
821
|
-
isBlacklisted(alm.almAddress, c.campaignParameters.blacklist) ||
|
822
|
-
(!!alm?.target && isBlacklisted(alm?.target, c.campaignParameters.blacklist)) ||
|
823
|
-
!isALMWhitelisted;
|
824
|
-
if (!isBlacklistedByCampaign && !!alm.almTVL && alm.almTVL > 0) {
|
825
|
-
try {
|
826
|
-
poolAPRkey = `${almName(alm.origin)} ${alm.almAddress}`;
|
827
|
-
if (!aprs[poolAPRkey])
|
828
|
-
aprs[poolAPRkey] = 0;
|
829
|
-
// Token 0 APR
|
830
|
-
const almToken0APR = (yearlyToken0Rewards * (alm?.almBalance0 ?? 0 - alm?.almIdleBalance0 ?? 0)) /
|
831
|
-
poolBalanceToken0WithoutBlacklist /
|
832
|
-
alm.almTVL;
|
833
|
-
aprs[poolAPRkey] += almToken0APR;
|
834
|
-
// Token 1 APR
|
835
|
-
const almToken1APR = (yearlyToken1Rewards * (alm?.almBalance1 ?? 0 - alm?.almIdleBalance1 ?? 0)) /
|
836
|
-
poolBalanceToken1WithoutBlacklist /
|
837
|
-
alm.almTVL;
|
838
|
-
((alm.almBalance1 / (alm?.almBalance1 ?? 0 + alm?.almIdleBalance1 ?? 0)) *
|
839
|
-
alm.almBalance1 *
|
840
|
-
yearlyToken1Rewards) /
|
841
|
-
poolBalanceToken1WithoutBlacklist /
|
842
|
-
alm.almTVL;
|
843
|
-
aprs[poolAPRkey] += almToken1APR;
|
844
|
-
// Fee APR
|
845
|
-
const almFeeAPR = (yearlyFeeRewards * (alm?.almInRangeLiquidity ?? 0)) / poolLiquidityWithoutBlacklist / alm.almTVL;
|
846
|
-
aprs[poolAPRkey] += almFeeAPR;
|
847
|
-
if (isStrykeCampaign(amm)) {
|
848
|
-
// computation is less precise here as we don't have the details of balances
|
849
|
-
aprs[poolAPRkey] = (yearlyToken0Rewards + yearlyToken1Rewards + yearlyFeeRewards) / tvl;
|
850
|
-
}
|
851
|
-
/** Fix to tackle discrepancies in the APRs when there is a whitelist */
|
852
|
-
if ((c.campaignParameters.whitelist?.length === 1 &&
|
853
|
-
(isWhitelisted(alm.sender, c.campaignParameters.whitelist) ||
|
854
|
-
isWhitelisted(alm.almAddress, c.campaignParameters.whitelist) ||
|
855
|
-
isWhitelisted(!!alm?.target ? alm.target : "", c.campaignParameters.whitelist) ||
|
856
|
-
isWhitelisted(!!alm?.owner ? alm.owner : "", c.campaignParameters.whitelist))) ||
|
857
|
-
(!!targetForwarder?.owner &&
|
858
|
-
isWhitelisted(targetForwarder?.owner, c.campaignParameters.whitelist))) {
|
859
|
-
if (aprs[poolAPRkey] < distributionMeanAPR || !aprs[poolAPRkey] || aprs[poolAPRkey] > 1e12) {
|
860
|
-
aprs[poolAPRkey] = distributionMeanAPR;
|
861
|
-
}
|
862
|
-
}
|
863
|
-
distributionForwarders[index].almAPR = aprs[poolAPRkey];
|
864
|
-
}
|
865
|
-
catch (e) {
|
866
|
-
log.error("CLAMMDynamicData", `failed to compute ALM APR for ${alm.almAddress} (sender ${alm.sender}) on ${NETWORK_LABELS[chainId]}: ${e}`);
|
867
|
-
}
|
868
|
-
}
|
869
|
-
});
|
870
|
-
}
|
871
|
-
const rewardTokens = await TokenService.findManyOrCreate([
|
872
|
-
{ chainId: campaign.chainId, address: campaign.rewardToken },
|
873
|
-
]);
|
874
|
-
const rewardToken = rewardTokens[0];
|
875
|
-
distributionMeanAPR = rewardToken.isPoint ? distributionMeanAPR / 365 / 100 : distributionMeanAPR;
|
876
|
-
let poolBalanceToken0WithoutBlacklist = poolBalanceToken0 - (blacklistedBalance0 ?? 0);
|
877
|
-
poolBalanceToken0WithoutBlacklist = !!poolBalanceToken0WithoutBlacklist
|
878
|
-
? poolBalanceToken0WithoutBlacklist
|
879
|
-
: 0.00001;
|
880
|
-
let poolBalanceToken1WithoutBlacklist = poolBalanceToken1 - (blacklistedBalance1 ?? 0);
|
881
|
-
poolBalanceToken1WithoutBlacklist = !!poolBalanceToken1WithoutBlacklist
|
882
|
-
? poolBalanceToken1WithoutBlacklist
|
883
|
-
: 0.00001;
|
884
|
-
dynamicData.push({
|
885
|
-
...campaign,
|
886
|
-
amm: pool.amm,
|
887
|
-
ammAlgo: AMMAlgorithmMapping[pool.amm],
|
888
|
-
ammAlgoName: AMMAlgorithm[AMMAlgorithmMapping[pool.amm]],
|
889
|
-
ammName: AMM[pool.amm],
|
890
|
-
apr: distributionMeanAPR,
|
891
|
-
aprs,
|
892
|
-
aprBreakdowns,
|
893
|
-
blacklistedBalance0,
|
894
|
-
blacklistedBalance1,
|
895
|
-
blacklistedLiquidity,
|
896
|
-
forwarders: distributionForwarders,
|
897
|
-
isLive,
|
898
|
-
isMock: c.campaignParameters.symbolRewardToken === "aglaMerkl",
|
899
|
-
poolBalanceToken0,
|
900
|
-
poolBalanceToken1,
|
901
|
-
poolTotalLiquidity,
|
902
|
-
symbolToken0,
|
903
|
-
symbolToken1,
|
904
|
-
tick: getTickAtSqrtRatio(JSBI.BigInt(sqrtPrice)),
|
905
|
-
priceRewardToken: priceRewardToken,
|
906
|
-
tvl: isStrykeCampaign(pool.amm)
|
907
|
-
? (await axios.get(`https://api.stryke.xyz/clamm/stats/tvl/${pool.address}?chainId=${chainId}`))
|
908
|
-
.data
|
909
|
-
: poolBalanceToken0 * priceToken0 + poolBalanceToken1 * priceToken1,
|
910
|
-
});
|
911
|
-
}
|
912
|
-
}
|
913
|
-
}
|
914
|
-
}
|
915
|
-
return dynamicData;
|
916
|
-
}
|
917
|
-
}
|
918
|
-
function getForwarderAprbreakDown(distributionForwarders, alm, campaign, pool, yearlyToken0Rewards, yearlyToken1Rewards, yearlyFeeRewards, poolBalanceToken0WithoutBlacklist, poolBalanceToken1WithoutBlacklist, poolLiquidityWithoutBlacklist, tvl, distributionMeanAPR, index, chainId, amm) {
|
919
|
-
if (!distributionForwarders)
|
920
|
-
return null;
|
921
|
-
let aprBreakdowns = null;
|
922
|
-
const targetForwarder = distributionForwarders.filter(f => f.almAddress.toLowerCase() === alm.target.toLowerCase())?.[0];
|
923
|
-
const isALMWhitelisted = campaign.campaignParameters.whitelist.length > 0
|
924
|
-
? isStrykeCampaign(pool.amm)
|
925
|
-
? true
|
926
|
-
: isWhitelisted(alm.sender, campaign.campaignParameters.whitelist) ||
|
927
|
-
isWhitelisted(alm.almAddress, campaign.campaignParameters.whitelist) ||
|
928
|
-
isWhitelisted(!!alm?.owner ? alm.owner : "", campaign.campaignParameters.whitelist) ||
|
929
|
-
isWhitelisted(!!alm?.target ? alm.target : "", campaign.campaignParameters.whitelist) ||
|
930
|
-
(!!targetForwarder?.owner && isWhitelisted(targetForwarder?.owner, campaign.campaignParameters.whitelist))
|
931
|
-
: true;
|
932
|
-
const isBlacklistedByCampaign = isBlacklisted(alm.sender, campaign.campaignParameters.blacklist) ||
|
933
|
-
isBlacklisted(alm.almAddress, campaign.campaignParameters.blacklist) ||
|
934
|
-
(!!alm?.target && isBlacklisted(alm?.target, campaign.campaignParameters.blacklist)) ||
|
935
|
-
!isALMWhitelisted;
|
936
|
-
if (!isBlacklistedByCampaign && !!alm.almTVL && alm.almTVL > 0) {
|
937
|
-
try {
|
938
|
-
// Token 0 APR
|
939
|
-
const almToken0APR = (yearlyToken0Rewards * (alm?.almBalance0 ?? 0 - alm?.almIdleBalance0 ?? 0)) /
|
940
|
-
poolBalanceToken0WithoutBlacklist /
|
941
|
-
alm.almTVL;
|
942
|
-
// Token 1 APR
|
943
|
-
const almToken1APR = (yearlyToken1Rewards * (alm?.almBalance1 ?? 0 - alm?.almIdleBalance1 ?? 0)) /
|
944
|
-
poolBalanceToken1WithoutBlacklist /
|
945
|
-
alm.almTVL;
|
946
|
-
// Fee APR
|
947
|
-
const almFeeAPR = (yearlyFeeRewards * (alm?.almInRangeLiquidity ?? 0)) / poolLiquidityWithoutBlacklist / alm.almTVL;
|
948
|
-
let aprValue = almToken0APR + almToken1APR + almFeeAPR;
|
949
|
-
// computation is less precise here as we don't have the details of balances
|
950
|
-
if (isStrykeCampaign(amm))
|
951
|
-
aprValue = (yearlyToken0Rewards + yearlyToken1Rewards + yearlyFeeRewards) / tvl;
|
952
|
-
/** Fix to tackle discrepancies in the APRs when there is a whitelist */
|
953
|
-
if ((campaign.campaignParameters.whitelist?.length === 1 &&
|
954
|
-
(isWhitelisted(alm.sender, campaign.campaignParameters.whitelist) ||
|
955
|
-
isWhitelisted(alm.almAddress, campaign.campaignParameters.whitelist) ||
|
956
|
-
isWhitelisted(!!alm?.target ? alm.target : "", campaign.campaignParameters.whitelist) ||
|
957
|
-
isWhitelisted(!!alm?.owner ? alm.owner : "", campaign.campaignParameters.whitelist))) ||
|
958
|
-
(!!targetForwarder?.owner && isWhitelisted(targetForwarder?.owner, campaign.campaignParameters.whitelist))) {
|
959
|
-
if (aprValue < distributionMeanAPR || !aprValue || aprValue > 1e12)
|
960
|
-
aprValue = distributionMeanAPR;
|
961
|
-
}
|
962
|
-
aprBreakdowns = {
|
963
|
-
address: pool.address,
|
964
|
-
value: aprValue,
|
965
|
-
type: EAprBreakdownType.FORWARDER,
|
966
|
-
label: almName(alm.origin),
|
967
|
-
};
|
968
|
-
distributionForwarders[index].almAPR = aprValue; // @Hugo wip: new way to structure aprBreakdowns + check this
|
969
|
-
}
|
970
|
-
catch (e) {
|
971
|
-
log.error("CLAMMDynamicData", `failed to compute ALM APR for ${alm.almAddress} (sender ${alm.sender}) on ${NETWORK_LABELS[chainId]}: ${e}`);
|
972
|
-
}
|
973
|
-
}
|
974
|
-
return aprBreakdowns;
|
975
|
-
}
|