@merkl/api 0.14.13 → 0.15.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.
@@ -1,4 +1,4 @@
1
- import { BN2Number, ETH_ADDRESS, HyperDriveSubCampaignType, HyperdriveTargetInterface, } from "@sdk";
1
+ import { BN2Number, ETH_ADDRESS, HyperDriveSubCampaignType, HyperdriveTargetInterface, YEAR, } from "@sdk";
2
2
  import { Pricer } from "../../../utils/pricer";
3
3
  export async function HyperdriveDynamicData(chainId, campaigns) {
4
4
  const pricer = await Pricer.load();
@@ -53,7 +53,14 @@ export async function HyperdriveDynamicData(chainId, campaigns) {
53
53
  ...campaign,
54
54
  totalSupplyTargetToken: marketSupply,
55
55
  tvl: tvl,
56
- apr: 0,
56
+ apr: priceRewardToken !== 0
57
+ ? (priceRewardToken *
58
+ BN2Number(campaign.amount, campaign.campaignParameters.decimalsRewardToken) *
59
+ YEAR *
60
+ 100) /
61
+ campaign.campaignParameters.duration /
62
+ tvl
63
+ : 0,
57
64
  priceRewardToken: priceRewardToken,
58
65
  });
59
66
  }
@@ -69,7 +69,7 @@ export class OpportunityRepository {
69
69
  }
70
70
  const data = {
71
71
  id: newOpp.id,
72
- action: newOpp.action,
72
+ action: newOpp.action ?? "HOLD",
73
73
  identifier: newOpp.identifier,
74
74
  name: newOpp.name,
75
75
  status: newOpp.status,