@merkl/api 0.10.128 → 0.10.130
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/database/api/.generated/default.js +1 -0
- package/dist/database/api/.generated/edge.js +609 -0
- package/dist/database/api/.generated/index-browser.js +586 -0
- package/dist/database/api/.generated/index.js +638 -0
- package/dist/database/api/.generated/runtime/edge-esm.js +31 -0
- package/dist/database/api/.generated/runtime/edge.js +31 -0
- package/dist/database/api/.generated/runtime/index-browser.js +13 -0
- package/dist/database/api/.generated/runtime/library.js +143 -0
- package/dist/database/api/.generated/runtime/react-native.js +80 -0
- package/dist/database/api/.generated/runtime/wasm.js +32 -0
- package/dist/database/api/.generated/wasm.js +586 -0
- package/dist/database/api/seeder/resources/protocol.js +341 -0
- package/dist/database/engine/.generated/default.js +1 -0
- package/dist/database/engine/.generated/edge.js +438 -0
- package/dist/database/engine/.generated/index-browser.js +415 -0
- package/dist/database/engine/.generated/index.js +467 -0
- package/dist/database/engine/.generated/runtime/edge-esm.js +31 -0
- package/dist/database/engine/.generated/runtime/edge.js +31 -0
- package/dist/database/engine/.generated/runtime/index-browser.js +13 -0
- package/dist/database/engine/.generated/runtime/library.js +143 -0
- package/dist/database/engine/.generated/runtime/react-native.js +80 -0
- package/dist/database/engine/.generated/runtime/wasm.js +32 -0
- package/dist/database/engine/.generated/wasm.js +415 -0
- package/dist/node_modules/@elysiajs/eden/eden/LICENSE +7 -0
- package/dist/node_modules/@elysiajs/eden/eden/README.md +46 -0
- package/dist/node_modules/@elysiajs/eden/eden/bunfig.toml +2 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/chunk-2IHGLN7W.mjs +1 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/chunk-7WO4HTSU.mjs +1 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/chunk-XYW4OUFN.mjs +1 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/chunk-YAG46HFR.mjs +1 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/errors.d.ts +5 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/fetch/index.d.ts +4 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/fetch/types.d.ts +44 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/fetch.d.mts +48 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/fetch.d.ts +48 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/fetch.global.js +1 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/fetch.js +1 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/fetch.mjs +1 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/index.d.mts +5 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/index.d.ts +5 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/index.global.js +1 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/index.js +1 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/index.mjs +1 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/treaty/index.d.ts +17 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/treaty/types.d.ts +99 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/treaty/utils.d.ts +1 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/treaty.d.mts +114 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/treaty.d.ts +114 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/treaty.global.js +1 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/treaty.js +1 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/treaty.mjs +1 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/treaty2/index.d.ts +5 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/treaty2/types.d.ts +86 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/treaty2/ws.d.ts +14 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/treaty2.d.mts +103 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/treaty2.d.ts +103 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/treaty2.global.js +1 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/treaty2.js +1 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/treaty2.mjs +1 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/types-C41kuZ-K.d.mts +44 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/types-C41kuZ-K.d.ts +44 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/types.d.ts +39 -0
- package/dist/node_modules/@elysiajs/eden/eden/dist/utils/parsingUtils.d.ts +6 -0
- package/dist/node_modules/@elysiajs/eden/eden/package.json +85 -0
- package/dist/package.json +2 -2
- package/dist/src/backgroundJobs/index.js +44 -0
- package/dist/src/backgroundJobs/jobs/campaignsCacheUpdater.js +160 -0
- package/dist/src/backgroundJobs/jobs/health.js +15 -0
- package/dist/src/backgroundJobs/jobs/opportunityUpdater.js +63 -0
- package/dist/src/backgroundJobs/jobs/priceUpdater.js +16 -0
- package/dist/src/backgroundJobs/jobs/sync.js +33 -0
- package/dist/src/cache/declaration.js +146 -0
- package/dist/src/cache/index.js +152 -0
- package/dist/src/cache/redis.js +49 -0
- package/dist/src/constants.js +119 -0
- package/dist/src/entities/campaign.js +134 -0
- package/dist/src/entities/opportunity.js +549 -0
- package/dist/src/errors/BadRequest.error.js +7 -0
- package/dist/src/errors/Conflict.error.js +7 -0
- package/dist/src/errors/HttpError.js +11 -0
- package/dist/src/errors/NotFound.error.js +7 -0
- package/dist/src/errors/Opportunity.error.js +11 -0
- package/dist/src/errors/Unauthorized.error.js +7 -0
- package/dist/src/errors/index.js +5 -0
- package/dist/src/guards/BackOffice.guard.js +10 -0
- package/dist/src/guards/Engine.guard.js +10 -0
- package/dist/src/guards/TokenAuth.guard.js +10 -0
- package/dist/src/hooks/checkQueryAddressValidity.js +7 -0
- package/dist/src/hooks/checkQueryChainIdValidity.js +7 -0
- package/dist/src/index.js +79 -0
- package/dist/src/internal/controllers/endingCampaigns.js +41 -0
- package/dist/src/internal/controllers/unclaimed.js +36 -0
- package/dist/src/internal/index.js +30 -0
- package/dist/src/libs/campaigns/campaignTypes/AjnaDynamicData.js +111 -0
- package/dist/src/libs/campaigns/campaignTypes/BadgerDynamicData.js +93 -0
- package/dist/src/libs/campaigns/campaignTypes/CLAMMDynamicData.js +942 -0
- package/dist/src/libs/campaigns/campaignTypes/CompoundDynamicData.js +90 -0
- package/dist/src/libs/campaigns/campaignTypes/DolomiteDynamicData.js +60 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicData.js +162 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicDataRefacto.js +159 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/eulerVaultNames.js +13 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/factoryFinder.js +29 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/getBlacklistedSupply.js +22 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/metamorphoTvl.js +35 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/spliceTVL.js +21 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +106 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/AaveProcessor.js +26 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/AssetProcessor.js +47 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/AuraProcessor.js +103 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/BalancerGaugeProcessor.js +83 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/BalancerPoolProcessor.js +99 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/BeefyProcessor.js +51 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/CompoundProcessor.js +36 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/EnzymeProcessor.js +51 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/EulerBorrowProcessor.js +46 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/EulerLendProcessor.js +47 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/FluidProcessor.js +36 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/FraxProcessor.js +41 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GearboxProcessor.js +44 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GenericProcessor.js +239 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/MetamorphoProcessor.js +43 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/PendleProcessor.js +31 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/RadiantProcessor.js +58 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/RfxProcessor.js +64 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/SpliceProcessor.js +35 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/SturdySiloProcessor.js +37 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/TemplateProcessor.js +40 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/TorosProcessor.js +33 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/UniswapProcessor.js +48 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/WoofiProcessor.js +40 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/curveProcessor.js +68 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +77 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesPrices.js +583 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesPricesRefactoFinal.js +24 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.js +1209 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1RefactoFinal.js +194 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound2.js +645 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound2RefactoFinal.js +22 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound3.js +392 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound3RefactoFinal.js +22 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound4.js +323 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound4RefactoFinal.js +22 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20_SNAPSHOTDynamicData.js +38 -0
- package/dist/src/libs/campaigns/campaignTypes/EulerDynamicData.js +165 -0
- package/dist/src/libs/campaigns/campaignTypes/JSON_AIRDROPDynamicData.js +19 -0
- package/dist/src/libs/campaigns/campaignTypes/MORPHODynamicData.js +120 -0
- package/dist/src/libs/campaigns/campaignTypes/RadiantDynamicData.js +112 -0
- package/dist/src/libs/campaigns/campaignTypes/SILODynamicData.js +113 -0
- package/dist/src/libs/campaigns/campaignsDynamicData.js +83 -0
- package/dist/src/libs/campaigns/campaignsDynamicDataRefacto.js +78 -0
- package/dist/src/libs/campaigns/getCampaigns.js +18 -0
- package/dist/src/libs/campaigns/utils/fetchA51Strategies.js +44 -0
- package/dist/src/libs/campaigns/utils/fetchClamInfo.js +27 -0
- package/dist/src/libs/campaigns/utils/fetchLogs.js +91 -0
- package/dist/src/libs/campaigns/utils/getCompV2ForksVaults.js +122 -0
- package/dist/src/libs/campaigns/utils/getContractCreationBlock.js +44 -0
- package/dist/src/libs/campaigns/utils/getDolomiteMarkets.js +50 -0
- package/dist/src/libs/campaigns/utils/getEulerV2Vaults.js +87 -0
- package/dist/src/libs/campaigns/utils/getLastEligibilityRatio.js +56 -0
- package/dist/src/libs/computeFee.js +34 -0
- package/dist/src/libs/custom/twtParticipants.js +54 -0
- package/dist/src/libs/deprecated-merklv3/index.js +184 -0
- package/dist/src/libs/getTokensList.js +37 -0
- package/dist/src/libs/merklChainData.js +129 -0
- package/dist/src/libs/parse/marketsWithCache.js +8 -0
- package/dist/src/libs/positions/ajna/index.js +107 -0
- package/dist/src/libs/positions/badger/index.js +79 -0
- package/dist/src/libs/positions/clamm/index.js +419 -0
- package/dist/src/libs/positions/clamm/thegraph/fetchAlmPositions.js +35 -0
- package/dist/src/libs/positions/clamm/thegraph/fetchAmmPositions.js +35 -0
- package/dist/src/libs/positions/clamm/thegraph/fetchFarmedPositions.js +44 -0
- package/dist/src/libs/positions/clamm/thegraph/index.js +162 -0
- package/dist/src/libs/positions/compound/index.js +93 -0
- package/dist/src/libs/positions/dolomite/index.js +49 -0
- package/dist/src/libs/positions/erc20/index.js +55 -0
- package/dist/src/libs/positions/euler/index.js +57 -0
- package/dist/src/libs/positions/index.js +48 -0
- package/dist/src/libs/positions/morpho/index.js +177 -0
- package/dist/src/libs/positions/prepareFetch.js +339 -0
- package/dist/src/libs/positions/silo/index.js +67 -0
- package/dist/src/libs/positions/types.js +1 -0
- package/dist/src/libs/reports/campaignReport.js +37 -0
- package/dist/src/libs/reports/mainParameterRewards.js +48 -0
- package/dist/src/libs/rewards/userRewards.js +154 -0
- package/dist/src/libs/staticCampaigns.js +10 -0
- package/dist/src/libs/tokens/balances.js +126 -0
- package/dist/src/libs/tokens/tokenInfo.js +22 -0
- package/dist/src/modules/v4/accounting/accounting.controller.js +66 -0
- package/dist/src/modules/v4/accounting/accounting.model.js +32 -0
- package/dist/src/modules/v4/accounting/accounting.repository.js +100 -0
- package/dist/src/modules/v4/accounting/accounting.service.js +78 -0
- package/dist/src/modules/v4/accounting/index.js +3 -0
- package/dist/src/modules/v4/apr/apr.controller.js +1 -0
- package/dist/src/modules/v4/apr/apr.model.js +1 -0
- package/dist/src/modules/v4/apr/apr.repository.js +1 -0
- package/dist/src/modules/v4/apr/apr.service.js +40 -0
- package/dist/src/modules/v4/apr/index.js +2 -0
- package/dist/src/modules/v4/blacklist/blacklist.controller.js +45 -0
- package/dist/src/modules/v4/blacklist/blacklist.model.js +13 -0
- package/dist/src/modules/v4/blacklist/blacklist.repository.js +56 -0
- package/dist/src/modules/v4/blacklist/blacklist.service.js +24 -0
- package/dist/src/modules/v4/blacklist/index.js +3 -0
- package/dist/src/modules/v4/cache/cache.model.js +14 -0
- package/dist/src/modules/v4/cache/cache.repository.js +10 -0
- package/dist/src/modules/v4/cache/cache.service.js +44 -0
- package/dist/src/modules/v4/cache/index.js +1 -0
- package/dist/src/modules/v4/campaign/campaign.controller.js +56 -0
- package/dist/src/modules/v4/campaign/campaign.model.js +54 -0
- package/dist/src/modules/v4/campaign/campaign.repository.js +346 -0
- package/dist/src/modules/v4/campaign/campaign.service.js +203 -0
- package/dist/src/modules/v4/campaign/index.js +3 -0
- package/dist/src/modules/v4/chain/chain.controller.js +40 -0
- package/dist/src/modules/v4/chain/chain.model.js +17 -0
- package/dist/src/modules/v4/chain/chain.repository.js +64 -0
- package/dist/src/modules/v4/chain/chain.service.js +42 -0
- package/dist/src/modules/v4/chain/index.js +3 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.js +19 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.model.js +6 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.repository.js +1 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.service.js +49 -0
- package/dist/src/modules/v4/dynamicData/index.js +3 -0
- package/dist/src/modules/v4/enso/enso.model.js +108 -0
- package/dist/src/modules/v4/enso/enso.service.js +46 -0
- package/dist/src/modules/v4/explorer/explorer.model.js +2 -0
- package/dist/src/modules/v4/explorer/explorer.repository.js +23 -0
- package/dist/src/modules/v4/explorer/explorer.service.js +24 -0
- package/dist/src/modules/v4/explorer/index.js +1 -0
- package/dist/src/modules/v4/index.js +4 -0
- package/dist/src/modules/v4/merklRoot/index.js +3 -0
- package/dist/src/modules/v4/merklRoot/merklRoot.controller.js +19 -0
- package/dist/src/modules/v4/merklRoot/merklRoot.model.js +6 -0
- package/dist/src/modules/v4/merklRoot/merklRoot.repository.js +31 -0
- package/dist/src/modules/v4/merklRoot/merklRoot.service.js +38 -0
- package/dist/src/modules/v4/opportunity/index.js +3 -0
- package/dist/src/modules/v4/opportunity/opportunity.controller.js +69 -0
- package/dist/src/modules/v4/opportunity/opportunity.model.js +36 -0
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +14 -0
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +217 -0
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +0 -15
- package/dist/src/modules/v4/opportunity/opportunity.service.js +180 -0
- package/dist/src/modules/v4/opportunity/subservices/getAjnaMetadata.service.js +50 -0
- package/dist/src/modules/v4/opportunity/subservices/getBadgerMetadata.service.js +23 -0
- package/dist/src/modules/v4/opportunity/subservices/getClammMetadata.service.js +33 -0
- package/dist/src/modules/v4/opportunity/subservices/getCompoundMetadata.service.js +18 -0
- package/dist/src/modules/v4/opportunity/subservices/getDolomiteMetadata.service.js +15 -0
- package/dist/src/modules/v4/opportunity/subservices/getErc20Metadata.service.js +63 -0
- package/dist/src/modules/v4/opportunity/subservices/getErc20SnapshotMetadata.service.js +8 -0
- package/dist/src/modules/v4/opportunity/subservices/getEulerMetadata.service.js +30 -0
- package/dist/src/modules/v4/opportunity/subservices/getJsonAirDropMetadata.service.js +36 -0
- package/dist/src/modules/v4/opportunity/subservices/getMorphoMetadata.service.js +19 -0
- package/dist/src/modules/v4/opportunity/subservices/getRadiantMetadata.service.js +9 -0
- package/dist/src/modules/v4/opportunity/subservices/getSiloMetadata.service.js +13 -0
- package/dist/src/modules/v4/opportunity/transform-id.pipe.js +6 -0
- package/dist/src/modules/v4/opportunity/validate-id.pipe.js +12 -0
- package/dist/src/modules/v4/participate/participate.controller.js +66 -0
- package/dist/src/modules/v4/participate/participate.model.js +24 -0
- package/dist/src/modules/v4/participate/participate.service.js +33 -0
- package/dist/src/modules/v4/price/index.js +3 -0
- package/dist/src/modules/v4/price/price.controller.js +62 -0
- package/dist/src/modules/v4/price/price.model.js +12 -0
- package/dist/src/modules/v4/price/price.repository.js +18 -0
- package/dist/src/modules/v4/price/price.service.js +44 -0
- package/dist/src/modules/v4/prisma/index.js +1 -0
- package/dist/src/modules/v4/protocol/index.js +3 -0
- package/dist/src/modules/v4/protocol/protocol.controller.js +23 -0
- package/dist/src/modules/v4/protocol/protocol.model.js +68 -0
- package/dist/src/modules/v4/protocol/protocol.repository.js +37 -0
- package/dist/src/modules/v4/protocol/protocol.service.js +77 -0
- package/dist/src/modules/v4/reward/index.js +3 -0
- package/dist/src/modules/v4/reward/reward.controller.js +52 -0
- package/dist/src/modules/v4/reward/reward.model.js +104 -0
- package/dist/src/modules/v4/reward/reward.repository.js +237 -0
- package/dist/src/modules/v4/reward/reward.service.js +283 -0
- package/dist/src/modules/v4/reward/rewardConvertor.service.js +136 -0
- package/dist/src/modules/v4/router.js +57 -0
- package/dist/src/modules/v4/status/index.js +3 -0
- package/dist/src/modules/v4/status/status.controller.js +48 -0
- package/dist/src/modules/v4/status/status.model.js +24 -0
- package/dist/src/modules/v4/status/status.repository.js +88 -0
- package/dist/src/modules/v4/status/status.service.js +60 -0
- package/dist/src/modules/v4/token/index.js +3 -0
- package/dist/src/modules/v4/token/token.controller.js +32 -0
- package/dist/src/modules/v4/token/token.model.js +23 -0
- package/dist/src/modules/v4/token/token.repository.js +128 -0
- package/dist/src/modules/v4/token/token.service.js +268 -0
- package/dist/src/modules/v4/tvl/index.js +2 -0
- package/dist/src/modules/v4/tvl/tvl.controller.js +1 -0
- package/dist/src/modules/v4/tvl/tvl.model.js +1 -0
- package/dist/src/modules/v4/tvl/tvl.repository.js +1 -0
- package/dist/src/modules/v4/tvl/tvl.service.js +49 -0
- package/dist/src/modules/v4/uniswapV4/index.js +4 -0
- package/dist/src/modules/v4/uniswapV4/uniswapV4.controller.js +11 -0
- package/dist/src/modules/v4/uniswapV4/uniswapV4.model.js +17 -0
- package/dist/src/modules/v4/uniswapV4/uniswapV4.repository.js +2 -0
- package/dist/src/modules/v4/uniswapV4/uniswapV4.service.js +73 -0
- package/dist/src/modules/v4/user/index.js +3 -0
- package/dist/src/modules/v4/user/user.controller.js +69 -0
- package/dist/src/modules/v4/user/user.model.js +18 -0
- package/dist/src/modules/v4/user/user.repository.js +38 -0
- package/dist/src/modules/v4/user/user.service.js +50 -0
- package/dist/src/plugins/error-handling.plugin.js +28 -0
- package/dist/src/plugins/logger.plugin.js +22 -0
- package/dist/src/routes/v1/allowances.js +115 -0
- package/dist/src/routes/v1/balances.js +25 -0
- package/dist/src/routes/v1/prices.js +11 -0
- package/dist/src/routes/v1/tokens.js +17 -0
- package/dist/src/routes/v2/merkl.js +13 -0
- package/dist/src/routes/v3/ERC20Campaigns.js +63 -0
- package/dist/src/routes/v3/app.js +18 -0
- package/dist/src/routes/v3/blacklist.js +18 -0
- package/dist/src/routes/v3/campaign/delay.js +78 -0
- package/dist/src/routes/v3/campaignClaims.js +24 -0
- package/dist/src/routes/v3/campaignReport.js +22 -0
- package/dist/src/routes/v3/campaignUnclaimed.js +28 -0
- package/dist/src/routes/v3/campaigns.js +101 -0
- package/dist/src/routes/v3/campaignsForMainParameter.js +19 -0
- package/dist/src/routes/v3/campaignsInfo.js +54 -0
- package/dist/src/routes/v3/campaignsRewardsReport.js +47 -0
- package/dist/src/routes/v3/claims.js +45 -0
- package/dist/src/routes/v3/compoundV2.js +9 -0
- package/dist/src/routes/v3/createCampaign.js +66 -0
- package/dist/src/routes/v3/dolomite.js +9 -0
- package/dist/src/routes/v3/euler.js +9 -0
- package/dist/src/routes/v3/exports/campaigns.js +28 -0
- package/dist/src/routes/v3/fetch.js +27 -0
- package/dist/src/routes/v3/health.js +13 -0
- package/dist/src/routes/v3/lostyield.js +98 -0
- package/dist/src/routes/v3/merkl.js +119 -0
- package/dist/src/routes/v3/morphoMarkets.js +27 -0
- package/dist/src/routes/v3/morphoVaults.js +22 -0
- package/dist/src/routes/v3/multiChainPositions.js +69 -0
- package/dist/src/routes/v3/opportunity.js +63 -0
- package/dist/src/routes/v3/overview.js +73 -0
- package/dist/src/routes/v3/parse.js +23 -0
- package/dist/src/routes/v3/payload.js +40 -0
- package/dist/src/routes/v3/poolInfo.js +88 -0
- package/dist/src/routes/v3/positions.js +62 -0
- package/dist/src/routes/v3/radiant.js +26 -0
- package/dist/src/routes/v3/recipients.js +20 -0
- package/dist/src/routes/v3/rewards.js +33 -0
- package/dist/src/routes/v3/rewardsReport.js +51 -0
- package/dist/src/routes/v3/rootForTimestamp.js +47 -0
- package/dist/src/routes/v3/silo.js +20 -0
- package/dist/src/routes/v3/token.js +24 -0
- package/dist/src/routes/v3/tokenUnclaimed.js +24 -0
- package/dist/src/routes/v3/twt/participants.js +11 -0
- package/dist/src/routes/v3/updates.js +47 -0
- package/dist/src/routes/v3/userRewards.js +59 -0
- package/dist/src/types/index.js +6 -0
- package/dist/src/types/parameters/Action.js +11 -0
- package/dist/src/types/parameters/Chain.js +13 -0
- package/dist/src/types/parameters/ChainCampaignId.js +13 -0
- package/dist/src/types/parameters/MainParameter.js +19 -0
- package/dist/src/types/parameters/OpportunityId.js +14 -0
- package/dist/src/types/parameters/Timestamp.js +16 -0
- package/dist/src/types/parameters/Type.js +15 -0
- package/dist/src/types/parameters/index.js +17 -0
- package/dist/src/types/returnTypes.js +1 -0
- package/dist/src/types/utils.js +1 -0
- package/dist/src/utils/addString.js +6 -0
- package/dist/src/utils/bigintToString.js +20 -0
- package/dist/src/utils/crypto.js +4 -0
- package/dist/src/utils/decodeCalls.js +170 -0
- package/dist/src/utils/encodeCalls.js +240 -0
- package/dist/src/utils/error.js +90 -0
- package/dist/src/utils/execute.js +41 -0
- package/dist/src/utils/generateCardName.js +89 -0
- package/dist/src/utils/generic.js +117 -0
- package/dist/src/utils/hashArray.js +4 -0
- package/dist/src/utils/lastBlockBefore.js +78 -0
- package/dist/src/utils/logger.js +52 -0
- package/dist/src/utils/pricer.js +180 -0
- package/dist/src/utils/prices/chainlinkRead.js +8 -0
- package/dist/src/utils/prices/curveVirtualPrice.js +7 -0
- package/dist/src/utils/prices/getDQUICK.js +8 -0
- package/dist/src/utils/prices/priceFetcherFactory.js +29 -0
- package/dist/src/utils/prices/priceService.js +328 -0
- package/dist/src/utils/prices/services/coinGeckoService.js +53 -0
- package/dist/src/utils/prices/services/defillamaService.js +53 -0
- package/dist/src/utils/prices/services/dexScreenerService.js +62 -0
- package/dist/src/utils/prices/services/erc4626Service.js +30 -0
- package/dist/src/utils/prices/services/getERC4626.js +11 -0
- package/dist/src/utils/prices/services/indexCoopService.js +55 -0
- package/dist/src/utils/prices/services/priceFetcher.js +1 -0
- package/dist/src/utils/prices/uniV2Price.js +40 -0
- package/dist/src/utils/prisma.js +12 -0
- package/dist/src/utils/providers.js +30 -0
- package/dist/src/utils/queries/activeCampaigns.js +22 -0
- package/dist/src/utils/queries/allCampaigns.js +51 -0
- package/dist/src/utils/queries/campaignsForMainParameter.js +23 -0
- package/dist/src/utils/queries/claimsOverTime.js +111 -0
- package/dist/src/utils/queries/endingCampaigns.js +21 -0
- package/dist/src/utils/queries/futureCampaigns.js +19 -0
- package/dist/src/utils/queries/mainParameterCampaigns.js +11 -0
- package/dist/src/utils/queries/rewardsAmount.js +106 -0
- package/dist/src/utils/queries/unclaimed.js +81 -0
- package/dist/src/utils/rateLimit.js +13 -0
- package/dist/src/utils/stryke.js +4 -0
- package/dist/src/utils/throw.js +27 -0
- package/dist/src/utils/validation.js +20 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +2 -2
@@ -0,0 +1,47 @@
|
|
1
|
+
import { decodeCall } from "../../../../../utils/decodeCalls";
|
2
|
+
import { generateCardName } from "../../../../../utils/generateCardName";
|
3
|
+
import { BN2Number } from "@sdk";
|
4
|
+
import { fetchEulerVaultName } from "../helpers/eulerVaultNames";
|
5
|
+
import { GenericProcessor } from "./GenericProcessor";
|
6
|
+
export class EulerLendProcessor extends GenericProcessor {
|
7
|
+
rounds = {
|
8
|
+
round1: [],
|
9
|
+
round2: [{ key: "underlying", call: "underlying", target: "tokenAddress" }],
|
10
|
+
round3: [
|
11
|
+
{ key: "decimalsUnderlyingToken", call: "decimals", target: "underlying" },
|
12
|
+
{ key: "symbolUnderlyingToken", call: "symbol", target: "underlying" },
|
13
|
+
],
|
14
|
+
round4: [
|
15
|
+
{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" },
|
16
|
+
{ key: "totalAssets", call: "totalAssets", target: "tokenAddress" },
|
17
|
+
],
|
18
|
+
};
|
19
|
+
// override computeRound1(): void {}
|
20
|
+
async processingRound5(index, type, typeInfo, calls, campaign, pricer) {
|
21
|
+
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
22
|
+
const priceUnderlying = (await pricer.get({ symbol: typeInfo.symbolUnderlyingToken })) ?? 1;
|
23
|
+
let totalAssetsOrBorrows = 0;
|
24
|
+
let cardName = "";
|
25
|
+
const decimalsUnderlyingToken = Number(typeInfo.decimalsUnderlyingToken);
|
26
|
+
totalAssetsOrBorrows = BN2Number(
|
27
|
+
// eulerInterface.decodeFunctionResult("totalAssets", calls[index++])[0],
|
28
|
+
decodeCall(calls, index++, "totalAssets", type), decimalsUnderlyingToken);
|
29
|
+
cardName = generateCardName(type, typeInfo, campaign);
|
30
|
+
const vaultName = await fetchEulerVaultName(typeInfo.tokenAddress, campaign.chainId);
|
31
|
+
if (!!vaultName) {
|
32
|
+
cardName = `Supply ${typeInfo.symbolUnderlyingToken} on ${vaultName} vault`;
|
33
|
+
}
|
34
|
+
const tvl = priceUnderlying * totalAssetsOrBorrows;
|
35
|
+
const priceTargetToken = tvl / totalSupply;
|
36
|
+
return {
|
37
|
+
...typeInfo,
|
38
|
+
totalSupply,
|
39
|
+
blacklistedSupply,
|
40
|
+
tvl,
|
41
|
+
whitelistedSupplyTargetToken,
|
42
|
+
priceTargetToken,
|
43
|
+
cardName: cardName,
|
44
|
+
totalAssets: typeInfo.totalAssets,
|
45
|
+
};
|
46
|
+
}
|
47
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { generateCardName } from "../../../../../utils/generateCardName";
|
2
|
+
import { BN2Number } from "@sdk";
|
3
|
+
import { BigNumber } from "ethers";
|
4
|
+
import { GenericProcessor } from "./GenericProcessor";
|
5
|
+
export class FluidProcessor extends GenericProcessor {
|
6
|
+
rounds = {
|
7
|
+
round1: [{ key: "underlying", call: "underlying", target: "tokenAddress" }],
|
8
|
+
round2: [
|
9
|
+
{ key: "symbolUnderlyingToken", call: "symbol", target: "underlying" },
|
10
|
+
{ key: "decimalsUnderlyingToken", call: "decimals", target: "underlying" },
|
11
|
+
],
|
12
|
+
round3: [{ key: "toAssets", call: "convertToAssets", target: "tokenAddress", metaData: "amount" }],
|
13
|
+
round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
|
14
|
+
};
|
15
|
+
// override computeRound1(): void {}
|
16
|
+
async processingRound5(_index, type, typeInfo, _calls, campaign, pricer) {
|
17
|
+
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
18
|
+
const priceUnderlying = (await pricer.get({ symbol: typeInfo.symbolUnderlyingToken })) ?? 0;
|
19
|
+
const exchangeRate = BN2Number(typeInfo.toAssets, Number(typeInfo.decimalsUnderlyingToken));
|
20
|
+
const priceTargetToken = priceUnderlying * exchangeRate;
|
21
|
+
const tvl = priceTargetToken * totalSupply;
|
22
|
+
return {
|
23
|
+
...typeInfo,
|
24
|
+
tvl,
|
25
|
+
exchangeRate,
|
26
|
+
whitelistedSupplyTargetToken,
|
27
|
+
blacklistedSupply,
|
28
|
+
totalSupply,
|
29
|
+
priceTargetToken,
|
30
|
+
cardName: generateCardName(type, typeInfo, campaign),
|
31
|
+
};
|
32
|
+
}
|
33
|
+
processingRound3(typeInfo) {
|
34
|
+
typeInfo.amount = BigNumber.from(10).pow(typeInfo.decimalsUnderlyingToken).toString();
|
35
|
+
}
|
36
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import { generateCardName } from "../../../../../utils/generateCardName";
|
2
|
+
import { BN2Number } from "@sdk";
|
3
|
+
import { tokenType } from "../helpers/tokenType";
|
4
|
+
import { GenericProcessor } from "./GenericProcessor";
|
5
|
+
export class FraxProcessor extends GenericProcessor {
|
6
|
+
rounds = {
|
7
|
+
round1: [
|
8
|
+
{ key: "underlying", call: "underlying", target: "tokenAddress" },
|
9
|
+
{ key: "sharePrice", call: "pricePerShare", target: "tokenAddress" },
|
10
|
+
],
|
11
|
+
round2: [
|
12
|
+
{ key: "symbolUnderlyingToken", call: "symbol", target: "underlying" },
|
13
|
+
{ key: "decimalsUnderlyingToken", call: "decimals", target: "underlying" },
|
14
|
+
],
|
15
|
+
round3: [],
|
16
|
+
round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
|
17
|
+
};
|
18
|
+
async processingRound5(_index, type, typeInfo, _calls, campaign, pricer) {
|
19
|
+
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
20
|
+
const sharePrice = BN2Number(typeInfo.sharePrice, 18);
|
21
|
+
const priceUnderlying = (await pricer.get({ symbol: typeInfo.symbolUnderlyingToken })) ?? 1;
|
22
|
+
let priceTargetToken = 0;
|
23
|
+
let tvl = 0;
|
24
|
+
if (type === tokenType.silostaking) {
|
25
|
+
priceTargetToken = priceUnderlying;
|
26
|
+
tvl = priceTargetToken * BN2Number(totalSupply, campaign.campaignParameters.decimalsTargetToken);
|
27
|
+
}
|
28
|
+
tvl = sharePrice * totalSupply * priceUnderlying;
|
29
|
+
priceTargetToken = tvl / totalSupply;
|
30
|
+
return {
|
31
|
+
...typeInfo,
|
32
|
+
totalSupply,
|
33
|
+
tvl,
|
34
|
+
whitelistedSupplyTargetToken,
|
35
|
+
blacklistedSupply,
|
36
|
+
sharePrice,
|
37
|
+
priceTargetToken,
|
38
|
+
cardName: generateCardName(type, typeInfo, campaign),
|
39
|
+
};
|
40
|
+
}
|
41
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import { generateCardName } from "../../../../../utils/generateCardName";
|
2
|
+
import { BN2Number } from "@sdk";
|
3
|
+
import { GenericProcessor } from "./GenericProcessor";
|
4
|
+
export class GearboxProcessor extends GenericProcessor {
|
5
|
+
rounds = {
|
6
|
+
round1: [{ key: "stakingToken", call: "stakingToken", target: "tokenAddress" }],
|
7
|
+
round2: [
|
8
|
+
{ key: "balanceStakingToken", call: "balanceOf", target: "stakingToken", metaData: "tokenAddress" },
|
9
|
+
{ key: "totalSupplyStakingToken", call: "totalSupply", target: "stakingToken" },
|
10
|
+
{ key: "decimalsStakingToken", call: "decimals", target: "stakingToken" },
|
11
|
+
{ key: "underlyingToken", call: "underlying", target: "stakingToken" },
|
12
|
+
{ key: "totalAssets", call: "totalAssets", target: "stakingToken" },
|
13
|
+
],
|
14
|
+
round3: [
|
15
|
+
{ key: "decimalsUnderlyingToken", call: "decimals", target: "underlyingToken" },
|
16
|
+
{ key: "symbolUnderlyingToken", call: "symbol", target: "underlyingToken" },
|
17
|
+
],
|
18
|
+
round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
|
19
|
+
};
|
20
|
+
// override computeRound1(): void {}
|
21
|
+
async processingRound5(_index, type, typeInfo, _calls, campaign, pricer) {
|
22
|
+
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
23
|
+
const totalAssets = BN2Number(typeInfo.totalAssets, Number(typeInfo.decimalsUnderlyingToken));
|
24
|
+
const balanceStakingToken = BN2Number(typeInfo.balanceStakingToken, Number(typeInfo.decimalsStakingToken));
|
25
|
+
const totalSupplyStakingToken = BN2Number(typeInfo.totalSupplyStakingToken, Number(typeInfo.decimalsStakingToken));
|
26
|
+
const percentageOfSupplyUnderlyingPoolTokens = balanceStakingToken / totalSupplyStakingToken;
|
27
|
+
const underlyingTokenPrice = (await pricer.get({ symbol: typeInfo.symbolUnderlyingToken })) ?? 0;
|
28
|
+
const tvl = underlyingTokenPrice * Number(totalAssets) * percentageOfSupplyUnderlyingPoolTokens;
|
29
|
+
const priceTargetToken = tvl / totalSupply;
|
30
|
+
return {
|
31
|
+
...typeInfo,
|
32
|
+
balanceStakingToken,
|
33
|
+
totalSupplyStakingToken,
|
34
|
+
whitelistedSupplyTargetToken,
|
35
|
+
percentageOfSupplyUnderlyingPoolTokens,
|
36
|
+
totalSupply,
|
37
|
+
totalAssets,
|
38
|
+
blacklistedSupply,
|
39
|
+
tvl: tvl,
|
40
|
+
priceTargetToken: priceTargetToken,
|
41
|
+
cardName: generateCardName(type, typeInfo, campaign),
|
42
|
+
};
|
43
|
+
}
|
44
|
+
}
|
@@ -0,0 +1,239 @@
|
|
1
|
+
import { decodeCall } from "../../../../../utils/decodeCalls";
|
2
|
+
import { createCall } from "../../../../../utils/encodeCalls";
|
3
|
+
import { generateCardName } from "../../../../../utils/generateCardName";
|
4
|
+
import { BN2Number } from "@sdk";
|
5
|
+
import { tokenTypeToProtocol } from "../helpers/tokenType";
|
6
|
+
export var roundType;
|
7
|
+
(function (roundType) {
|
8
|
+
roundType["one"] = "round1";
|
9
|
+
roundType["two"] = "round2";
|
10
|
+
roundType["three"] = "round3";
|
11
|
+
roundType["four"] = "round4";
|
12
|
+
})(roundType || (roundType = {}));
|
13
|
+
export class GenericProcessor {
|
14
|
+
rounds = {
|
15
|
+
round1: [],
|
16
|
+
round2: [],
|
17
|
+
round3: [],
|
18
|
+
round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
|
19
|
+
};
|
20
|
+
debug = false;
|
21
|
+
processingRound1(typeInfo) { }
|
22
|
+
processingRound2(typeInfo) { }
|
23
|
+
processingRound3(typeInfo) { }
|
24
|
+
processingRound4(typeInfo) { }
|
25
|
+
handleWhiteListBlacklistRound5(typeInfo, campaign) {
|
26
|
+
const totalSupply = BN2Number(typeInfo.totalSupply, campaign.campaignParameters.decimalsTargetToken);
|
27
|
+
const whitelistedSupply = Number(typeInfo.whitelistedSupply);
|
28
|
+
const blacklistedSupply = Number(typeInfo.blacklistedSupply);
|
29
|
+
let whitelistedSupplyTargetToken = whitelistedSupply ? whitelistedSupply : totalSupply - blacklistedSupply;
|
30
|
+
whitelistedSupplyTargetToken = whitelistedSupplyTargetToken ? whitelistedSupplyTargetToken : 0.00001;
|
31
|
+
return {
|
32
|
+
whitelistedSupplyTargetToken,
|
33
|
+
totalSupply,
|
34
|
+
blacklistedSupply,
|
35
|
+
};
|
36
|
+
}
|
37
|
+
async processingRound5(index, type, typeInfo, calls, campaign, pricer) {
|
38
|
+
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
39
|
+
const priceTargetToken = (await pricer.get({ symbol: campaign.campaignParameters.symbolTargetToken })) ?? 0;
|
40
|
+
const tvl = whitelistedSupplyTargetToken * priceTargetToken;
|
41
|
+
return {
|
42
|
+
whitelistedSupplyTargetToken,
|
43
|
+
totalSupply,
|
44
|
+
priceTargetToken,
|
45
|
+
tvl,
|
46
|
+
blacklistedSupply,
|
47
|
+
cardName: generateCardName(type, typeInfo, campaign),
|
48
|
+
};
|
49
|
+
}
|
50
|
+
computeRound1(type, typeInfo) {
|
51
|
+
typeInfo = { ...tokenTypeToProtocol[type], ...typeInfo };
|
52
|
+
this.processingRound1(typeInfo);
|
53
|
+
if (this.debug) {
|
54
|
+
console.log("Round 1", {
|
55
|
+
type: type,
|
56
|
+
calls: this.encodeNextRound(roundType.one, type, typeInfo),
|
57
|
+
typeInfo,
|
58
|
+
});
|
59
|
+
}
|
60
|
+
return {
|
61
|
+
type: type,
|
62
|
+
calls: this.encodeNextRound(roundType.one, type, typeInfo),
|
63
|
+
typeInfo,
|
64
|
+
};
|
65
|
+
}
|
66
|
+
computeRound2(index, type, typeInfo, calls) {
|
67
|
+
this.decodePreviousRound(roundType.one, calls, typeInfo, type, index);
|
68
|
+
this.processingRound2(typeInfo);
|
69
|
+
if (this.debug) {
|
70
|
+
console.log("Round 2", {
|
71
|
+
type: type,
|
72
|
+
calls: this.encodeNextRound(roundType.two, type, typeInfo),
|
73
|
+
typeInfo,
|
74
|
+
});
|
75
|
+
}
|
76
|
+
return {
|
77
|
+
type: type,
|
78
|
+
calls: this.encodeNextRound(roundType.two, type, typeInfo),
|
79
|
+
typeInfo,
|
80
|
+
};
|
81
|
+
}
|
82
|
+
computeRound3(index, type, typeInfo, calls) {
|
83
|
+
this.decodePreviousRound(roundType.two, calls, typeInfo, type, index);
|
84
|
+
this.processingRound3(typeInfo);
|
85
|
+
if (this.debug) {
|
86
|
+
console.log("Round 3", {
|
87
|
+
type: type,
|
88
|
+
calls: this.encodeNextRound(roundType.three, type, typeInfo),
|
89
|
+
typeInfo,
|
90
|
+
});
|
91
|
+
}
|
92
|
+
return {
|
93
|
+
type: type,
|
94
|
+
calls: this.encodeNextRound(roundType.three, type, typeInfo),
|
95
|
+
typeInfo,
|
96
|
+
};
|
97
|
+
}
|
98
|
+
computeRound4(index, type, typeInfo, calls, campaign) {
|
99
|
+
const blacklistedLiquidityCalls = this.generateBlackListCall(type, typeInfo, campaign);
|
100
|
+
const whitelistedLiquidityCalls = this.generateWhitelistCall(type, typeInfo, campaign);
|
101
|
+
this.decodePreviousRound(roundType.three, calls, typeInfo, type, index);
|
102
|
+
this.processingRound4(typeInfo);
|
103
|
+
if (this.debug) {
|
104
|
+
console.log("Round 4", {
|
105
|
+
type: type,
|
106
|
+
calls: this.encodeNextRound(roundType.four, type, typeInfo),
|
107
|
+
typeInfo,
|
108
|
+
});
|
109
|
+
}
|
110
|
+
return {
|
111
|
+
type: type,
|
112
|
+
calls: whitelistedLiquidityCalls
|
113
|
+
.concat(blacklistedLiquidityCalls)
|
114
|
+
.concat(this.encodeNextRound(roundType.four, type, typeInfo)),
|
115
|
+
typeInfo: {
|
116
|
+
...typeInfo,
|
117
|
+
},
|
118
|
+
};
|
119
|
+
}
|
120
|
+
async computeRound5(index, type, typeInfo, calls, campaign, pricer) {
|
121
|
+
typeInfo.whitelistedSupply = this.decodeListedSupply(index, campaign.campaignParameters.decimalsTargetToken, campaign.campaignParameters.whitelist, calls);
|
122
|
+
index = index + campaign.campaignParameters.whitelist.length;
|
123
|
+
typeInfo.blacklistedSupply = this.decodeListedSupply(index, campaign.campaignParameters.decimalsTargetToken, campaign.campaignParameters.blacklist, calls);
|
124
|
+
index = index + campaign.campaignParameters.blacklist.length;
|
125
|
+
this.decodePreviousRound(roundType.four, calls, typeInfo, type, index);
|
126
|
+
const outputInfo = (await this.processingRound5(index, type, typeInfo, calls, campaign, pricer));
|
127
|
+
if (this.debug) {
|
128
|
+
console.log("Round 5", {
|
129
|
+
type: type,
|
130
|
+
calls: [],
|
131
|
+
outputInfo,
|
132
|
+
});
|
133
|
+
}
|
134
|
+
return {
|
135
|
+
type: type,
|
136
|
+
calls: [],
|
137
|
+
typeInfo: {
|
138
|
+
...outputInfo,
|
139
|
+
},
|
140
|
+
};
|
141
|
+
}
|
142
|
+
generateWhitelistCall(type, typeInfo, campaign) {
|
143
|
+
const whitelistedLiquidityCalls = [];
|
144
|
+
if (campaign.campaignParameters.whitelist.length > 0) {
|
145
|
+
for (const whitelistedAddress of campaign.campaignParameters.whitelist) {
|
146
|
+
if (!campaign.campaignParameters.blacklist.includes(whitelistedAddress)) {
|
147
|
+
whitelistedLiquidityCalls.push(createCall(typeInfo.tokenAddress, "balanceOf", type, whitelistedAddress));
|
148
|
+
}
|
149
|
+
}
|
150
|
+
}
|
151
|
+
return whitelistedLiquidityCalls;
|
152
|
+
}
|
153
|
+
generateBlackListCall(type, typeInfo, campaign) {
|
154
|
+
const blacklistedLiquidityCalls = [];
|
155
|
+
if (campaign.campaignParameters.blacklist.length > 0) {
|
156
|
+
for (const blacklistedAddress of campaign.campaignParameters.blacklist) {
|
157
|
+
blacklistedLiquidityCalls.push(createCall(typeInfo.tokenAddress, "balanceOf", type, blacklistedAddress));
|
158
|
+
}
|
159
|
+
}
|
160
|
+
return blacklistedLiquidityCalls;
|
161
|
+
}
|
162
|
+
decodeListedSupply(index, decimals, list, calls) {
|
163
|
+
if (list.length === 0) {
|
164
|
+
return "0";
|
165
|
+
}
|
166
|
+
let listedSupply = 0;
|
167
|
+
for (const _ of list) {
|
168
|
+
listedSupply += BN2Number(decodeCall(calls, index++, "balanceOf"), decimals);
|
169
|
+
}
|
170
|
+
return listedSupply.toString();
|
171
|
+
}
|
172
|
+
decodeRound(round, index, calls, type, data) {
|
173
|
+
round.map(({ key, call, optional }) => {
|
174
|
+
if (optional) {
|
175
|
+
try {
|
176
|
+
const value = decodeCall(calls, index, call, type);
|
177
|
+
index++;
|
178
|
+
data[key] = value;
|
179
|
+
}
|
180
|
+
catch (error) { }
|
181
|
+
}
|
182
|
+
else {
|
183
|
+
const value = decodeCall(calls, index, call, type);
|
184
|
+
index++;
|
185
|
+
data[key] = value;
|
186
|
+
}
|
187
|
+
});
|
188
|
+
}
|
189
|
+
decodePreviousRound(round, calls, data, type, index) {
|
190
|
+
if (round === roundType.one) {
|
191
|
+
this.decodeRound(this.rounds.round1, index, calls, type, data);
|
192
|
+
}
|
193
|
+
if (round === roundType.two) {
|
194
|
+
this.decodeRound(this.rounds.round2, index, calls, type, data);
|
195
|
+
}
|
196
|
+
if (round === roundType.three) {
|
197
|
+
this.decodeRound(this.rounds.round3, index, calls, type, data);
|
198
|
+
}
|
199
|
+
if (round === roundType.four) {
|
200
|
+
this.decodeRound(this.rounds.round4, index, calls, type, data);
|
201
|
+
}
|
202
|
+
}
|
203
|
+
encodeRound(round, callInfo, type) {
|
204
|
+
return round
|
205
|
+
.map(({ call, target, metaData, optional }) => {
|
206
|
+
if (optional && !callInfo[target]) {
|
207
|
+
return [];
|
208
|
+
}
|
209
|
+
if (metaData) {
|
210
|
+
return createCall(callInfo[target], call, type, callInfo[metaData]);
|
211
|
+
}
|
212
|
+
return createCall(callInfo[target], call, type);
|
213
|
+
})
|
214
|
+
.filter(call => Array.isArray(call) === false);
|
215
|
+
}
|
216
|
+
encodeNextRound(round, type, data) {
|
217
|
+
const keys = Object.keys(data);
|
218
|
+
const callInfo = keys.reduce((acc, key) => {
|
219
|
+
if (data[key]) {
|
220
|
+
acc[key] = data[key];
|
221
|
+
}
|
222
|
+
return acc;
|
223
|
+
}, {});
|
224
|
+
let calls = [];
|
225
|
+
if (round === roundType.one) {
|
226
|
+
calls = this.encodeRound(this.rounds.round1, callInfo, type);
|
227
|
+
}
|
228
|
+
if (round === roundType.two) {
|
229
|
+
calls = this.encodeRound(this.rounds.round2, callInfo, type);
|
230
|
+
}
|
231
|
+
if (round === roundType.three) {
|
232
|
+
calls = this.encodeRound(this.rounds.round3, callInfo, type);
|
233
|
+
}
|
234
|
+
if (round === roundType.four) {
|
235
|
+
calls = this.encodeRound(this.rounds.round4, callInfo, type);
|
236
|
+
}
|
237
|
+
return calls;
|
238
|
+
}
|
239
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { generateCardName } from "../../../../../utils/generateCardName";
|
2
|
+
import { fetchMetamorphoTvl } from "../helpers/metamorphoTvl";
|
3
|
+
import { GenericProcessor } from "./GenericProcessor";
|
4
|
+
export class MetamorphoProcessor extends GenericProcessor {
|
5
|
+
rounds = {
|
6
|
+
round1: [{ key: "underlying", call: "underlying", target: "tokenAddress" }],
|
7
|
+
round2: [{ key: "symbolUnderlyingToken", call: "symbol", target: "underlying" }],
|
8
|
+
round3: [],
|
9
|
+
round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
|
10
|
+
};
|
11
|
+
// override computeRound1(): void {}
|
12
|
+
async processingRound5(_index, type, typeInfo, _calls, campaign, _pricer) {
|
13
|
+
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
14
|
+
const tvl = await fetchMetamorphoTvl(campaign.chainId, typeInfo.tokenAddress);
|
15
|
+
const priceTargetToken = tvl / totalSupply;
|
16
|
+
return {
|
17
|
+
...typeInfo,
|
18
|
+
totalSupply,
|
19
|
+
tvl,
|
20
|
+
whitelistedSupplyTargetToken,
|
21
|
+
blacklistedSupply,
|
22
|
+
priceTargetToken,
|
23
|
+
cardName: generateCardName(type, typeInfo, campaign),
|
24
|
+
};
|
25
|
+
}
|
26
|
+
computeRound3(index, type, typeInfo, calls) {
|
27
|
+
// This is to enforce type checking
|
28
|
+
try {
|
29
|
+
return super.computeRound3(index, type, typeInfo, calls);
|
30
|
+
}
|
31
|
+
catch (e) {
|
32
|
+
// usually if this fails its because of native ETH
|
33
|
+
return {
|
34
|
+
type: type,
|
35
|
+
calls: [],
|
36
|
+
typeInfo: {
|
37
|
+
...typeInfo,
|
38
|
+
symbolUnderlyingToken: "ETH",
|
39
|
+
},
|
40
|
+
};
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { generateCardName } from "../../../../../utils/generateCardName";
|
2
|
+
import { ChainId } from "@sdk";
|
3
|
+
import { GenericProcessor } from "./GenericProcessor";
|
4
|
+
export class PendleProcessor extends GenericProcessor {
|
5
|
+
rounds = {
|
6
|
+
round1: [
|
7
|
+
{ key: "SYToken", call: "readTokens0", target: "tokenAddress" },
|
8
|
+
{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" },
|
9
|
+
],
|
10
|
+
round2: [{ key: "underlying", call: "underlying", target: "SYToken" }],
|
11
|
+
round3: [{ key: "symbolUnderlyingToken", call: "symbol", target: "underlying" }],
|
12
|
+
round4: [],
|
13
|
+
};
|
14
|
+
async processingRound5(_index, type, typeInfo, _calls, campaign, pricer) {
|
15
|
+
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
16
|
+
const priceTargetToken = (await pricer.get({
|
17
|
+
address: typeInfo.tokenAddress,
|
18
|
+
chainId: ChainId.MAINNET,
|
19
|
+
})) ?? 0;
|
20
|
+
const tvl = priceTargetToken * totalSupply;
|
21
|
+
return {
|
22
|
+
...typeInfo,
|
23
|
+
totalSupply,
|
24
|
+
tvl,
|
25
|
+
whitelistedSupplyTargetToken,
|
26
|
+
priceTargetToken: priceTargetToken,
|
27
|
+
cardName: generateCardName(type, typeInfo, campaign),
|
28
|
+
blacklistedSupply,
|
29
|
+
};
|
30
|
+
}
|
31
|
+
}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import { generateCardName } from "../../../../../utils/generateCardName";
|
2
|
+
import { BN2Number } from "@sdk";
|
3
|
+
import { GenericProcessor } from "./GenericProcessor";
|
4
|
+
export class RadiantProcessor extends GenericProcessor {
|
5
|
+
rounds = {
|
6
|
+
round1: [
|
7
|
+
{ key: "underlyingToken", call: "underlying", target: "tokenAddress" },
|
8
|
+
{ key: "priceBN", call: "getAssetPrice", target: "tokenAddress" },
|
9
|
+
],
|
10
|
+
round2: [{ key: "symbolUnderlyingToken", call: "symbol", target: "underlyingToken" }],
|
11
|
+
round3: [],
|
12
|
+
round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
|
13
|
+
};
|
14
|
+
// override computeRound1(): void {}
|
15
|
+
async processingRound5(_index, type, typeInfo, _calls, campaign, _pricer) {
|
16
|
+
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
17
|
+
const priceTargetToken = BN2Number(typeInfo.priceBN, 8);
|
18
|
+
const tvl = priceTargetToken * totalSupply;
|
19
|
+
// TO DO FIX THE CARD NAME
|
20
|
+
// SEEMS I HAVE DROPPED THE BALL ON THIS ONE
|
21
|
+
let cardToken = typeInfo.symbolUnderlyingToken;
|
22
|
+
if (campaign.campaignParameters.symbolTargetToken.startsWith("r")) {
|
23
|
+
cardToken = campaign.campaignParameters.symbolTargetToken.substring(1);
|
24
|
+
}
|
25
|
+
let finalSymbol = typeInfo.symbolUnderlyingToken;
|
26
|
+
if (typeInfo.symbolUnderlyingToken.toLowerCase().includes("gm") && cardToken.toLowerCase().includes("gm")) {
|
27
|
+
// Remove gm from the card name
|
28
|
+
finalSymbol = cardToken.substring(2);
|
29
|
+
}
|
30
|
+
return {
|
31
|
+
...typeInfo,
|
32
|
+
priceTargetToken,
|
33
|
+
whitelistedSupplyTargetToken,
|
34
|
+
totalSupply,
|
35
|
+
blacklistedSupply,
|
36
|
+
tvl,
|
37
|
+
cardName: generateCardName(type, typeInfo, campaign),
|
38
|
+
symbolUnderlyingToken: finalSymbol,
|
39
|
+
};
|
40
|
+
}
|
41
|
+
computeRound3(index, type, typeInfo, calls) {
|
42
|
+
// This is to enforce type checking
|
43
|
+
try {
|
44
|
+
return super.computeRound3(index, type, typeInfo, calls);
|
45
|
+
}
|
46
|
+
catch (e) {
|
47
|
+
// usually if this fails its because of native ETH
|
48
|
+
return {
|
49
|
+
type: type,
|
50
|
+
calls: [],
|
51
|
+
typeInfo: {
|
52
|
+
...typeInfo,
|
53
|
+
symbolUnderlyingToken: "ETH",
|
54
|
+
},
|
55
|
+
};
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
import { RFX_DATASTORE } from "../../../../../constants";
|
2
|
+
import { generateCardName } from "../../../../../utils/generateCardName";
|
3
|
+
import { BN2Number } from "@sdk";
|
4
|
+
import { ethers } from "ethers";
|
5
|
+
import { GenericProcessor } from "./GenericProcessor";
|
6
|
+
export class RfxProcessor extends GenericProcessor {
|
7
|
+
rounds = {
|
8
|
+
round1: [
|
9
|
+
{
|
10
|
+
key: "shortToken",
|
11
|
+
call: "shortToken",
|
12
|
+
target: "RFX_DATASTORE",
|
13
|
+
metaData: "metaDataShort",
|
14
|
+
},
|
15
|
+
{
|
16
|
+
key: "longToken",
|
17
|
+
call: "longToken",
|
18
|
+
target: "RFX_DATASTORE",
|
19
|
+
metaData: "metaDataLong",
|
20
|
+
},
|
21
|
+
{ key: "decimalsToken", call: "decimals", target: "tokenAddress" },
|
22
|
+
],
|
23
|
+
round2: [
|
24
|
+
{ key: "symbolShortToken", call: "symbol", target: "shortToken" },
|
25
|
+
{ key: "symbolLongToken", call: "symbol", target: "longToken" },
|
26
|
+
{ key: "decimalsShortToken", call: "decimals", target: "shortToken" },
|
27
|
+
{ key: "decimalsLongToken", call: "decimals", target: "longToken" },
|
28
|
+
{ key: "balanceShortToken", call: "balanceOf", target: "shortToken", metaData: "tokenAddress" },
|
29
|
+
{ key: "balanceLongToken", call: "balanceOf", target: "longToken", metaData: "tokenAddress" },
|
30
|
+
],
|
31
|
+
round3: [],
|
32
|
+
round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
|
33
|
+
};
|
34
|
+
// override computeRound1(): void {}
|
35
|
+
processingRound1(typeInfo) {
|
36
|
+
const hexShortToken = ethers.utils.keccak256(ethers.utils.defaultAbiCoder.encode(["string"], ["SHORT_TOKEN"]));
|
37
|
+
const hexLongToken = ethers.utils.keccak256(ethers.utils.defaultAbiCoder.encode(["string"], ["LONG_TOKEN"]));
|
38
|
+
typeInfo.RFX_DATASTORE = RFX_DATASTORE;
|
39
|
+
typeInfo.metaDataShort = ethers.utils.keccak256(ethers.utils.defaultAbiCoder.encode(["address", "bytes32"], [typeInfo.tokenAddress, hexShortToken]));
|
40
|
+
typeInfo.metaDataLong = ethers.utils.keccak256(ethers.utils.defaultAbiCoder.encode(["address", "bytes32"], [typeInfo.tokenAddress, hexLongToken]));
|
41
|
+
}
|
42
|
+
async processingRound5(index, type, typeInfo, calls, campaign, pricer) {
|
43
|
+
// return super.processingRound5(index, type, typeInfo, calls, campaign, pricer);
|
44
|
+
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
45
|
+
const priceShortToken = (await pricer.get({ symbol: typeInfo.symbolShortToken })) ?? 0;
|
46
|
+
const priceLongToken = (await pricer.get({ symbol: typeInfo.symbolLongToken })) ?? 0;
|
47
|
+
let tvl = 0;
|
48
|
+
if (priceShortToken !== 0 && priceLongToken !== 0) {
|
49
|
+
tvl =
|
50
|
+
priceShortToken * BN2Number(typeInfo.balanceShortToken, Number(typeInfo.decimalsShortToken)) +
|
51
|
+
priceLongToken * BN2Number(typeInfo.balanceLongToken, Number(typeInfo.decimalsLongToken));
|
52
|
+
}
|
53
|
+
const priceTargetToken = tvl / BN2Number(typeInfo.totalSupply, Number(typeInfo.decimalsToken));
|
54
|
+
return {
|
55
|
+
tokenAddress: typeInfo.tokenAddress,
|
56
|
+
totalSupply,
|
57
|
+
whitelistedSupplyTargetToken,
|
58
|
+
blacklistedSupply,
|
59
|
+
cardName: generateCardName(type, typeInfo, campaign),
|
60
|
+
priceTargetToken: priceTargetToken, // Add the appropriate value here
|
61
|
+
tvl,
|
62
|
+
};
|
63
|
+
}
|
64
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import { fetchSpliceInformation } from "../helpers/spliceTVL";
|
2
|
+
import { GenericProcessor } from "./GenericProcessor";
|
3
|
+
export class SpliceProcessor extends GenericProcessor {
|
4
|
+
// override computeRound1(): void {}
|
5
|
+
async processingRound5(_index, _type, typeInfo, _calls, campaign, _pricer) {
|
6
|
+
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
7
|
+
const { symbolUnderlyingToken, priceTargetToken, tvl } = await fetchSpliceInformation(campaign.campaignParameters.targetToken);
|
8
|
+
return {
|
9
|
+
totalSupply,
|
10
|
+
priceTargetToken,
|
11
|
+
tvl,
|
12
|
+
whitelistedSupplyTargetToken,
|
13
|
+
blacklistedSupply,
|
14
|
+
cardName: `Supply ${symbolUnderlyingToken} on Splice`,
|
15
|
+
tokenAddress: typeInfo.tokenAddress,
|
16
|
+
};
|
17
|
+
}
|
18
|
+
computeRound3(index, type, typeInfo, calls) {
|
19
|
+
// This is to enforce type checking
|
20
|
+
try {
|
21
|
+
return super.computeRound3(index, type, typeInfo, calls);
|
22
|
+
}
|
23
|
+
catch (e) {
|
24
|
+
// usually if this fails its because of native ETH
|
25
|
+
return {
|
26
|
+
type: type,
|
27
|
+
calls: [],
|
28
|
+
typeInfo: {
|
29
|
+
...typeInfo,
|
30
|
+
symbolUnderlyingToken: "ETH",
|
31
|
+
},
|
32
|
+
};
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|