@merkl/api 0.10.361 → 0.10.377
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/README.md +78 -14
- package/dist/database/api/.generated/edge.js +21 -6
- package/dist/database/api/.generated/index-browser.js +18 -3
- package/dist/database/api/.generated/index.d.ts +1746 -256
- package/dist/database/api/.generated/index.js +21 -6
- package/dist/database/api/.generated/package.json +1 -1
- package/dist/database/api/.generated/schema.prisma +12 -2
- package/dist/database/api/.generated/wasm.js +18 -3
- package/dist/src/eden/index.d.ts +1260 -127
- package/dist/src/entities/campaign.js +2 -1
- package/dist/src/entities/opportunity.js +169 -3
- package/dist/src/index.d.ts +432 -5
- package/dist/src/jobs/etl/pendings.js +2 -1
- package/dist/src/jobs/etl/reward-breakdowns.js +2 -1
- package/dist/src/jobs/etl/rewards.js +2 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicData.js +45 -54
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +3 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +4 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/ERC4626Processor.d.ts +34 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/ERC4626Processor.js +36 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +3 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.js +4 -1
- package/dist/src/libs/campaigns/campaignTypes/HyperdriveDynamicData.d.ts +5 -0
- package/dist/src/libs/campaigns/campaignTypes/HyperdriveDynamicData.js +76 -0
- package/dist/src/libs/campaigns/campaignsDynamicData.js +8 -0
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +2 -0
- package/dist/src/modules/v4/campaign/campaign.model.d.ts +1 -0
- package/dist/src/modules/v4/campaign/campaign.model.js +1 -0
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +63 -1
- package/dist/src/modules/v4/campaign/campaign.repository.js +15 -10
- package/dist/src/modules/v4/computedValue/computedValue.controller.d.ts +8 -5
- package/dist/src/modules/v4/computedValue/computedValue.controller.js +8 -6
- package/dist/src/modules/v4/computedValue/computedValue.model.js +12 -4
- package/dist/src/modules/v4/computedValue/computedValue.repository.d.ts +8 -5
- package/dist/src/modules/v4/computedValue/computedValue.repository.js +7 -3
- package/dist/src/modules/v4/computedValue/computedValue.service.d.ts +7 -4
- package/dist/src/modules/v4/computedValue/computedValue.service.js +10 -0
- package/dist/src/modules/v4/creator/creator.controller.d.ts +118 -0
- package/dist/src/modules/v4/creator/creator.controller.js +30 -0
- package/dist/src/modules/v4/creator/creator.model.d.ts +29 -0
- package/dist/src/modules/v4/creator/creator.model.js +18 -0
- package/dist/src/modules/v4/creator/creator.repository.d.ts +40 -0
- package/dist/src/modules/v4/creator/creator.repository.js +63 -0
- package/dist/src/modules/v4/creator/creator.service.d.ts +61 -0
- package/dist/src/modules/v4/creator/creator.service.js +44 -0
- package/dist/src/modules/v4/creator/index.d.ts +3 -0
- package/dist/src/modules/v4/creator/index.js +3 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.d.ts +3 -4
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.js +1 -1
- package/dist/src/modules/v4/dynamicData/dynamicData.model.d.ts +1 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.model.js +1 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.service.d.ts +6 -3
- package/dist/src/modules/v4/dynamicData/dynamicData.service.js +50 -9
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +171 -1
- package/dist/src/modules/v4/opportunity/opportunity.controller.js +14 -0
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +0 -1
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +185 -0
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +41 -0
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +151 -1
- package/dist/src/modules/v4/opportunity/opportunity.service.js +45 -2
- package/dist/src/modules/v4/opportunity/subservices/getHyperdriveMetadata.service.d.ts +1 -1
- package/dist/src/modules/v4/opportunity/subservices/getHyperdriveMetadata.service.js +2 -2
- package/dist/src/modules/v4/programPayload/programPayload.controller.d.ts +30 -0
- package/dist/src/modules/v4/programPayload/programPayload.controller.js +12 -1
- package/dist/src/modules/v4/programPayload/programPayload.model.d.ts +21 -1
- package/dist/src/modules/v4/programPayload/programPayload.model.js +12 -0
- package/dist/src/modules/v4/programPayload/programPayload.repository.d.ts +3 -2
- package/dist/src/modules/v4/programPayload/programPayload.repository.js +28 -2
- package/dist/src/modules/v4/programPayload/programPayload.service.d.ts +2 -1
- package/dist/src/modules/v4/programPayload/programPayload.service.js +42 -2
- package/dist/src/modules/v4/protocol/protocol.controller.d.ts +1 -0
- package/dist/src/modules/v4/protocol/protocol.model.d.ts +1 -0
- package/dist/src/modules/v4/protocol/protocol.model.js +1 -0
- package/dist/src/modules/v4/reward/reward.repository.d.ts +2 -1
- package/dist/src/modules/v4/reward/reward.repository.js +12 -1
- package/dist/src/modules/v4/reward/reward.service.js +5 -2
- package/dist/src/modules/v4/router.d.ts +432 -5
- package/dist/src/modules/v4/router.js +5 -1
- package/dist/src/modules/v4/user/user.controller.d.ts +28 -0
- package/dist/src/modules/v4/user/user.controller.js +5 -0
- package/dist/src/modules/v4/user/user.repository.d.ts +5 -0
- package/dist/src/modules/v4/user/user.service.d.ts +5 -0
- package/dist/src/utils/decodeCalls.js +7 -1
- package/dist/src/utils/encodeCalls.js +19 -1
- package/dist/src/utils/generateCardName.js +3 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +6 -2
- package/dist/src/jobs/breakdowns.d.ts +0 -1
- package/dist/src/jobs/breakdowns.js +0 -55
- package/dist/src/jobs/rewards.d.ts +0 -1
- package/dist/src/jobs/rewards.js +0 -74
@@ -13,8 +13,9 @@ export async function getCampaignsFor(chainIds, filters = { onlyLive: false }) {
|
|
13
13
|
prev[chain] = Object.keys(allData).reduce((acc, curr) => {
|
14
14
|
const [type, mainParameter] = curr.split("_");
|
15
15
|
const campaignType = Number.parseInt(type);
|
16
|
-
if (!filters?.types?.length || filters?.types?.includes(campaignType))
|
16
|
+
if (!filters?.types?.length || filters?.types?.includes(campaignType)) {
|
17
17
|
acc[`${campaignType}_${mainParameter}`] = allData[curr];
|
18
|
+
}
|
18
19
|
return acc;
|
19
20
|
}, {});
|
20
21
|
}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { getHyperdriveMetadata } from "../modules/v4/opportunity/subservices/getHyperdriveMetadata.service";
|
1
2
|
import { AjnaSubCampaignType, BN2Number, Campaign, ChainId, CompFork, CompoundSubCampaignType, DolomiteSubCampaignType, EAprBreakdownType, EulerSubCampaignType, MorphoSubCampaignType, almName, ammName, } from "@sdk";
|
2
3
|
import { activeCampaign, getApr, getCampaignsFor, getDailyRewards, getRewardTokenIcons, getRewardTokens, getStatus, getTags, inactiveCampaign, removeTestTokens, } from "./campaign";
|
3
4
|
export const extractOpportunities = {
|
@@ -41,11 +42,11 @@ export const extractOpportunities = {
|
|
41
42
|
];
|
42
43
|
let platform = ammName(amm ?? params.amm);
|
43
44
|
let subCampaignTag = "";
|
44
|
-
if (platform === "BaseSwap" &&
|
45
|
+
if (platform === "BaseSwap" && computeChainId === ChainId.MODE)
|
45
46
|
platform = "SwapMode";
|
46
|
-
if (platform === "BaseSwap" &&
|
47
|
+
if (platform === "BaseSwap" && computeChainId === ChainId.ARBITRUM)
|
47
48
|
platform = "Arbidex";
|
48
|
-
if (platform === "BaseSwap" &&
|
49
|
+
if (platform === "BaseSwap" && computeChainId === ChainId.OPTIMISM)
|
49
50
|
platform = "SuperSwap";
|
50
51
|
const restrictedToForwarders = params.whitelist.flatMap(addr => {
|
51
52
|
const forwarders = campaigns.all.map(({ forwarders }) => forwarders?.find(({ almAddress, sender, owner }) => [almAddress, sender, owner].some(a => a?.toLowerCase() === addr?.toLowerCase())));
|
@@ -888,6 +889,171 @@ export const extractOpportunities = {
|
|
888
889
|
};
|
889
890
|
return opportunity;
|
890
891
|
},
|
892
|
+
[Campaign.ERC20_FIX_APR]: (campaign, campaigns, prices) => {
|
893
|
+
const { chainId, tvl, campaignParameters: params, typeInfo, computeChainId, mainParameter } = campaign;
|
894
|
+
const { active, all } = campaigns;
|
895
|
+
// DEPRECATED!!!!
|
896
|
+
const map = {
|
897
|
+
actions: {
|
898
|
+
pool: [
|
899
|
+
"uniswapv2",
|
900
|
+
"velodrome",
|
901
|
+
"aerodrome",
|
902
|
+
"balancerGauge",
|
903
|
+
"balancerPool",
|
904
|
+
"curve",
|
905
|
+
"aura",
|
906
|
+
"akron",
|
907
|
+
"beefy",
|
908
|
+
"dragonswap",
|
909
|
+
"poolside",
|
910
|
+
"koi",
|
911
|
+
"pancakeswap",
|
912
|
+
"tempest",
|
913
|
+
"cross_curve",
|
914
|
+
"zkswap",
|
915
|
+
"maverickBoostedPosition",
|
916
|
+
"zkSwapThreePool",
|
917
|
+
"syncswap",
|
918
|
+
"rfx",
|
919
|
+
],
|
920
|
+
borrow: ["radiant_borrow", "aave_borrowing", "euler_borrow", "zerolend_borrowing"],
|
921
|
+
lend: [
|
922
|
+
"gearbox",
|
923
|
+
"compound",
|
924
|
+
"radiant_lend",
|
925
|
+
"aave_lending",
|
926
|
+
"sturdy_aggregator",
|
927
|
+
"sturdy_silo",
|
928
|
+
"fraxlend",
|
929
|
+
"moonwell",
|
930
|
+
"ionic",
|
931
|
+
"fluid",
|
932
|
+
"silostaking",
|
933
|
+
"euler_lend",
|
934
|
+
"layerbank",
|
935
|
+
"zerolend_lending",
|
936
|
+
"venus",
|
937
|
+
"reactor_fusion",
|
938
|
+
"woofi",
|
939
|
+
],
|
940
|
+
},
|
941
|
+
icons: {
|
942
|
+
pool: () => {
|
943
|
+
if (["balancerGauge", "balancerPool"].includes(campaign.type ?? ""))
|
944
|
+
return Object.values(typeInfo.poolTokens ?? {})
|
945
|
+
.map(tkn => tkn?.symbol)
|
946
|
+
.filter(tkn => tkn);
|
947
|
+
if (["curve"].includes(campaign.type ?? ""))
|
948
|
+
return Object.values(typeInfo.poolTokens ?? {}).filter(tkn => tkn);
|
949
|
+
if (["rfx"].includes(campaign.type ?? "")) {
|
950
|
+
return [typeInfo.symbolShortToken, typeInfo.symbolLongToken];
|
951
|
+
}
|
952
|
+
if (["maverickBoostedPosition"].includes(campaign.type ?? "")) {
|
953
|
+
return [typeInfo.symbolTokenA, typeInfo.symbolTokenB];
|
954
|
+
}
|
955
|
+
return [typeInfo.symbolToken0, typeInfo.symbolToken1];
|
956
|
+
},
|
957
|
+
lend: () => (campaign.type === "compound" ? [typeInfo.symbolBaseToken] : [typeInfo.symbolUnderlyingToken]),
|
958
|
+
borrow: () => [typeInfo.symbolUnderlyingToken],
|
959
|
+
hold: () => {
|
960
|
+
if (["toros", "enzyme"].includes(campaign.type))
|
961
|
+
return [typeInfo.symbolUnderlyingToken];
|
962
|
+
return [campaign.campaignParameters.symbolTargetToken];
|
963
|
+
},
|
964
|
+
},
|
965
|
+
};
|
966
|
+
const action = Object.entries(map.actions).find(([_action, _types]) => _types.includes(campaign.type ?? ""))?.[0] ?? "hold";
|
967
|
+
const icons = map.icons[action]();
|
968
|
+
const opportunity = {
|
969
|
+
id: `${Campaign.ERC20}_${mainParameter}`,
|
970
|
+
platform: params.symbolTargetToken,
|
971
|
+
name: typeInfo?.cardName,
|
972
|
+
chainId: !computeChainId ? chainId : computeChainId,
|
973
|
+
distributionChainId: chainId,
|
974
|
+
tvl,
|
975
|
+
action,
|
976
|
+
apr: getApr(active),
|
977
|
+
status: getStatus(all),
|
978
|
+
tags: getTags(campaigns.all),
|
979
|
+
dailyrewards: getDailyRewards(active, prices),
|
980
|
+
tokenIcons: icons,
|
981
|
+
campaigns: { ...campaigns, type: Campaign.ERC20, ids: campaigns.all.map(c => c.campaignId) },
|
982
|
+
rewardTokenIcons: getRewardTokenIcons(campaigns.active),
|
983
|
+
dailyRewardTokens: getRewardTokens(campaigns.active),
|
984
|
+
};
|
985
|
+
return opportunity;
|
986
|
+
},
|
987
|
+
[Campaign.HYPERDRIVELOGFIXPROCESSOR]: (campaign, campaigns, prices) => {
|
988
|
+
const { chainId, tvl, campaignSubType, campaignParameters: params, computeChainId } = campaign;
|
989
|
+
const { active, all } = campaigns;
|
990
|
+
const metadata = getHyperdriveMetadata(chainId, campaign.campaignSubType, campaign.campaignParameters);
|
991
|
+
const aprBreakdown = active.reduce((res, campaign) => {
|
992
|
+
res[`Campaign ${campaign.campaignId.slice(0, 8)}`] = {
|
993
|
+
value: campaign.apr ?? 0,
|
994
|
+
address: campaign.campaignId,
|
995
|
+
type: EAprBreakdownType.DETAILS,
|
996
|
+
};
|
997
|
+
return res;
|
998
|
+
}, {});
|
999
|
+
const aprBreakdown2 = getCampaignsApr(active);
|
1000
|
+
const opportunity = {
|
1001
|
+
id: `${Campaign.HYPERDRIVELOGFIXPROCESSOR}_${campaign.mainParameter}`,
|
1002
|
+
platform: "Hyperdrive",
|
1003
|
+
name: metadata.name,
|
1004
|
+
chainId: !computeChainId ? chainId : computeChainId,
|
1005
|
+
distributionChainId: chainId,
|
1006
|
+
tvl,
|
1007
|
+
action: metadata.action?.toLowerCase(),
|
1008
|
+
subtype: campaignSubType,
|
1009
|
+
status: getStatus(all),
|
1010
|
+
tags: getTags(campaigns.all),
|
1011
|
+
dailyrewards: getDailyRewards(active, prices),
|
1012
|
+
tokenIcons: [params.symbolTargetToken],
|
1013
|
+
campaigns: { ...campaigns, type: Campaign.HYPERDRIVELOGFIXPROCESSOR, ids: campaigns.all.map(c => c.campaignId) },
|
1014
|
+
rewardTokenIcons: getRewardTokenIcons(campaigns.active),
|
1015
|
+
dailyRewardTokens: getRewardTokens(campaigns.active),
|
1016
|
+
apr: getApr(active),
|
1017
|
+
aprBreakdown,
|
1018
|
+
aprBreakdown2,
|
1019
|
+
};
|
1020
|
+
return opportunity;
|
1021
|
+
},
|
1022
|
+
[Campaign.HYPERDRIVELOGPROCESSOR]: (campaign, campaigns, prices) => {
|
1023
|
+
const { chainId, tvl, campaignSubType, campaignParameters: params, computeChainId } = campaign;
|
1024
|
+
const { active, all } = campaigns;
|
1025
|
+
const metadata = getHyperdriveMetadata(chainId, campaign.campaignSubType, campaign.campaignParameters);
|
1026
|
+
const aprBreakdown = active.reduce((res, campaign) => {
|
1027
|
+
res[`Campaign ${campaign.campaignId.slice(0, 8)}`] = {
|
1028
|
+
value: campaign.apr ?? 0,
|
1029
|
+
address: campaign.campaignId,
|
1030
|
+
type: EAprBreakdownType.DETAILS,
|
1031
|
+
};
|
1032
|
+
return res;
|
1033
|
+
}, {});
|
1034
|
+
const aprBreakdown2 = getCampaignsApr(active);
|
1035
|
+
const opportunity = {
|
1036
|
+
id: `${Campaign.HYPERDRIVELOGPROCESSOR}_${campaign.mainParameter}`,
|
1037
|
+
platform: "Hyperdrive",
|
1038
|
+
name: metadata.name,
|
1039
|
+
chainId: !computeChainId ? chainId : computeChainId,
|
1040
|
+
distributionChainId: chainId,
|
1041
|
+
tvl,
|
1042
|
+
action: metadata.action?.toLowerCase(),
|
1043
|
+
subtype: campaignSubType,
|
1044
|
+
status: getStatus(all),
|
1045
|
+
tags: getTags(campaigns.all),
|
1046
|
+
dailyrewards: getDailyRewards(active, prices),
|
1047
|
+
tokenIcons: [params.symbolTargetToken],
|
1048
|
+
campaigns: { ...campaigns, type: Campaign.HYPERDRIVELOGPROCESSOR, ids: campaigns.all.map(c => c.campaignId) },
|
1049
|
+
rewardTokenIcons: getRewardTokenIcons(campaigns.active),
|
1050
|
+
dailyRewardTokens: getRewardTokens(campaigns.active),
|
1051
|
+
apr: getApr(active),
|
1052
|
+
aprBreakdown,
|
1053
|
+
aprBreakdown2,
|
1054
|
+
};
|
1055
|
+
return opportunity;
|
1056
|
+
},
|
891
1057
|
};
|
892
1058
|
/**
|
893
1059
|
* @returns the opportunities map with their corresponding campaign's data added
|