@merkl/api 0.20.165 → 0.20.167

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.
@@ -4,7 +4,7 @@ import type { CampaignParameters, Campaign as CampaignType, ChainId } from "@sdk
4
4
  type campaignType = CampaignType.LOCKER;
5
5
  export declare class LockerMetadata implements MetadataBuilder<campaignType> {
6
6
  build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">): Promise<{
7
- action: "SWAP";
7
+ action: "HOLD";
8
8
  name: string;
9
9
  tokens: {
10
10
  chainId: number;
@@ -3,7 +3,7 @@ export class LockerMetadata {
3
3
  async build(campaign) {
4
4
  const { params, computeChainId } = campaign;
5
5
  try {
6
- const action = "SWAP";
6
+ const action = "HOLD";
7
7
  const mainProtocolId = "puffer";
8
8
  let name = `Lock on ${capitalize(mainProtocolId)}`;
9
9
  let tokens = [];
@@ -17,6 +17,7 @@ import { HyperdriveMetadata } from "../implementations/Hyperdrive/metadata";
17
17
  import { InvalidMetadata } from "../implementations/Invalid/metadata";
18
18
  import { IonMetadata } from "../implementations/Ion/metadata";
19
19
  import { JsonAirdropMetadata } from "../implementations/JsonAirdrop/metadata";
20
+ import { LockerMetadata } from "../implementations/Locker/metadata";
20
21
  import { MorphoMetadata } from "../implementations/Morpho/metadata";
21
22
  import { MultiLogMetaData } from "../implementations/MultiLog/metadata";
22
23
  import { RadiantMetadata } from "../implementations/Radiant/metadata";
@@ -68,6 +69,6 @@ const map = {
68
69
  [Campaign.ERC721]: new Erc721Metadata(),
69
70
  [Campaign.ERC721FIXAPR]: new Erc721Metadata(),
70
71
  [Campaign.MULTILOG]: new MultiLogMetaData(),
71
- [Campaign.LOCKER]: new DefaultMetadata(), // TODO
72
+ [Campaign.LOCKER]: new LockerMetadata(),
72
73
  };
73
74
  export const metadataBuilderFactory = (campaignType) => map[campaignType];
@@ -4,6 +4,7 @@ import { AjnaTVLBuilder } from "../implementations/Ajna/tvl";
4
4
  import { AmbiantTVLBuilder } from "../implementations/Ambient/tvl";
5
5
  import { EigenLayerTVLBuilder } from "../implementations/EigenLayer/tvl";
6
6
  import { Erc20TVLBuilder } from "../implementations/Erc20/tvl";
7
+ import { LockerTVLBuilder } from "../implementations/Locker/tvl";
7
8
  import { MultiLogTVLBuilder } from "../implementations/MultiLog/tvl";
8
9
  /**
9
10
  * @dev TYPE SAFETY DISABLED FOR NOW AS WE DON'T HAVE ALL THE CAMPAIGNS IMPLEMENTED
@@ -23,6 +24,7 @@ const map = {
23
24
  [Campaign.ERC20_FIX_APR]: new Erc20TVLBuilder(),
24
25
  [Campaign.EULER]: new Erc20TVLBuilder(),
25
26
  [Campaign.MULTILOG]: new MultiLogTVLBuilder(),
27
+ [Campaign.LOCKER]: new LockerTVLBuilder(),
26
28
  };
27
29
  export const campaignTVLBuilderFactory = (campaignType) => {
28
30
  if (!map[campaignType]) {
@@ -5,7 +5,7 @@ import { TokenService } from "@/modules/v4/token/token.service";
5
5
  import { CannotParseOpportunity, InvalidParameter } from "@/utils/error";
6
6
  import { log } from "@/utils/logger";
7
7
  import { parseDistributionType } from "@/utils/parseDistributionType";
8
- import { Campaign as CampaignType, NETWORK_LABELS, } from "@sdk";
8
+ import { Campaign as CampaignType, HOOK, NETWORK_LABELS, } from "@sdk";
9
9
  import { utils } from "ethers";
10
10
  import moment from "moment";
11
11
  import { ChainService } from "../chain/chain.service";
@@ -62,6 +62,10 @@ export class CampaignService {
62
62
  createdAt: new Date().toISOString(),
63
63
  chain,
64
64
  };
65
+ // Separate Worldchain ID only campaign opportunities
66
+ if (campaign.params.hooks?.some(hook => hook.hookType === HOOK.WORLDCHAINID)) {
67
+ body.opportunityIdentifier += "WORLDCHAINID";
68
+ }
65
69
  try {
66
70
  const opportunity = await OpportunityService.createFromCampaign(campaign, body.opportunityIdentifier, false, dryRun);
67
71
  if (dryRun)
@@ -7,7 +7,7 @@ import { TokenService } from "@/modules/v4/token/token.service";
7
7
  import { UserService } from "@/modules/v4/user/user.service";
8
8
  import { log } from "@/utils/logger";
9
9
  import { AprType, Status } from "@db/api";
10
- import { Campaign as CampaignType, HOOK, numberToBigInt } from "@sdk";
10
+ import { Campaign as CampaignType, numberToBigInt } from "@sdk";
11
11
  import moment from "moment";
12
12
  import { metadataBuilderFactory } from "../../../engine/metadata/factory";
13
13
  import { ChainService } from "../chain/chain.service";
@@ -55,10 +55,6 @@ export class OpportunityService {
55
55
  static async createFromCampaign(campaign, opportunityIdentifier, upsert = false, dryRun = false) {
56
56
  if (dryRun)
57
57
  log.info(`opportunity creation dry run for ${campaign.campaignId} of type ${campaign.type}`);
58
- // Separate Worldchain ID only campaign opportunities
59
- if (campaign.params.hooks?.some(hook => hook.hookType === HOOK.WORLDCHAINID)) {
60
- opportunityIdentifier += "WORLDCHAINID";
61
- }
62
58
  const metadata = await OpportunityService.#getMetadata(campaign, opportunityIdentifier);
63
59
  const tags = (await UserService.findUnique(campaign.creatorAddress))?.tags ?? [];
64
60
  const opportunityId = OpportunityService.hashId({
@@ -6011,6 +6011,7 @@ const PufferInterfaceCampaigns = {
6011
6011
  },
6012
6012
  [pufferCampaigns.carrot_Staking]: {
6013
6013
  campaignType: Campaign.LOCKER,
6014
+ computeChainId: ChainId.MAINNET,
6014
6015
  computeScoreParameters: {
6015
6016
  computeMethod: ComputeScoreMethod.genericTimeWeighted,
6016
6017
  },