@ape.swap/bonds-sdk 4.5.3 → 4.5.4-test.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/main.js CHANGED
@@ -4463,7 +4463,7 @@ const Success$1 = ({ direction = 'down', color = 'success', width, getStyles })
4463
4463
  degree: deg[direction],
4464
4464
  color,
4465
4465
  });
4466
- return (jsxs("svg", { width: width || '10', viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", sx: style, children: [jsx$2("mask", { id: "path-1-inside-1_8581_37376", fill: "white", children: jsx$2("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M7.5 15C11.6421 15 15 11.6421 15 7.5C15 3.35786 11.6421 0 7.5 0C3.35786 0 0 3.35786 0 7.5C0 11.6421 3.35786 15 7.5 15ZM10.7168 4.6311C10.8812 4.47247 11.1484 4.46313 11.3232 4.6031C11.4773 4.73374 11.5082 4.94836 11.3848 5.10699L7.57177 10.1459L7.54094 10.1832C7.29427 10.5098 6.80094 10.5938 6.44122 10.3698C6.36927 10.3232 6.29733 10.2578 6.24594 10.1925L4.324 7.70108C4.19039 7.52379 4.2315 7.28117 4.42678 7.15987C4.58094 7.05722 4.79678 7.06656 4.94066 7.17853L6.79066 8.55956L10.7168 4.6311Z" }) }), jsx$2("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M7.5 15C11.6421 15 15 11.6421 15 7.5C15 3.35786 11.6421 0 7.5 0C3.35786 0 0 3.35786 0 7.5C0 11.6421 3.35786 15 7.5 15ZM10.7168 4.6311C10.8812 4.47247 11.1484 4.46313 11.3232 4.6031C11.4773 4.73374 11.5082 4.94836 11.3848 5.10699L7.57177 10.1459L7.54094 10.1832C7.29427 10.5098 6.80094 10.5938 6.44122 10.3698C6.36927 10.3232 6.29733 10.2578 6.24594 10.1925L4.324 7.70108C4.19039 7.52379 4.2315 7.28117 4.42678 7.15987C4.58094 7.05722 4.79678 7.06656 4.94066 7.17853L6.79066 8.55956L10.7168 4.6311Z", fill: "#38A611" }), jsx$2("path", { d: "M11.3232 4.6031L12.6161 3.07725L12.5951 3.05944L12.5736 3.0422L11.3232 4.6031ZM10.7168 4.6311L9.32823 3.19167L9.31506 3.20437L9.30213 3.21731L10.7168 4.6311ZM11.3848 5.10699L9.80589 3.8794L9.79787 3.88972L9.78999 3.90014L11.3848 5.10699ZM7.57177 10.1459L9.11371 11.4196L9.14087 11.3867L9.16661 11.3527L7.57177 10.1459ZM7.54094 10.1832L5.999 8.90945L5.97125 8.94305L5.94499 8.97782L7.54094 10.1832ZM6.44122 10.3698L5.35301 12.0479L5.36851 12.0579L5.3842 12.0677L6.44122 10.3698ZM6.24594 10.1925L4.66237 11.4141L4.66819 11.4217L4.67408 11.4292L6.24594 10.1925ZM4.324 7.70108L2.72677 8.90477L2.73355 8.91376L2.74042 8.92268L4.324 7.70108ZM4.42678 7.15987L5.48213 8.85876L5.50892 8.84212L5.53518 8.82463L4.42678 7.15987ZM4.94066 7.17853L3.71236 8.75691L3.72819 8.76922L3.74426 8.78122L4.94066 7.17853ZM6.79066 8.55956L5.59425 10.1622L6.98153 11.1978L8.2053 9.97335L6.79066 8.55956ZM13 7.5C13 10.5376 10.5376 13 7.5 13V17C12.7467 17 17 12.7467 17 7.5H13ZM7.5 2C10.5376 2 13 4.46243 13 7.5H17C17 2.25329 12.7467 -2 7.5 -2V2ZM2 7.5C2 4.46243 4.46243 2 7.5 2V-2C2.25329 -2 -2 2.25329 -2 7.5H2ZM7.5 13C4.46243 13 2 10.5376 2 7.5H-2C-2 12.7467 2.25329 17 7.5 17V13ZM12.5736 3.0422C11.623 2.28067 10.225 2.32656 9.32823 3.19167L12.1053 6.07052C11.5374 6.61837 10.6739 6.64559 10.0727 6.164L12.5736 3.0422ZM12.9638 6.33458C13.7999 5.2591 13.5179 3.84143 12.6161 3.07725L10.0302 6.12895C9.43671 5.62605 9.2164 4.63761 9.80589 3.8794L12.9638 6.33458ZM9.16661 11.3527L12.9797 6.31385L9.78999 3.90014L5.97694 8.93902L9.16661 11.3527ZM9.08288 11.4569L9.11371 11.4196L6.02984 8.87212L5.999 8.90945L9.08288 11.4569ZM5.3842 12.0677C6.57521 12.8092 8.23351 12.5847 9.13689 11.3886L5.94499 8.97782C6.1621 8.69035 6.45202 8.55308 6.69854 8.51121C6.94576 8.46921 7.23358 8.5072 7.49824 8.67197L5.3842 12.0677ZM4.67408 11.4292C4.86564 11.6726 5.10262 11.8855 5.35301 12.0479L7.52942 8.69178C7.59192 8.73231 7.64101 8.77179 7.68026 8.80742C7.71912 8.8427 7.76655 8.89076 7.8178 8.95589L4.67408 11.4292ZM2.74042 8.92268L4.66237 11.4141L7.82951 8.97093L5.90757 6.47949L2.74042 8.92268ZM3.37143 5.46098C2.16753 6.20884 1.89287 7.79823 2.72677 8.90477L5.92123 6.49739C6.48791 7.24934 6.29547 8.35351 5.48213 8.85876L3.37143 5.46098ZM6.16897 5.60015C5.3495 4.96244 4.1927 4.91298 3.31837 5.4951L5.53518 8.82463C4.96918 9.20147 4.24405 9.17067 3.71236 8.75691L6.16897 5.60015ZM7.98707 6.95687L6.13707 5.57584L3.74426 8.78122L5.59425 10.1622L7.98707 6.95687ZM9.30213 3.21731L5.37603 7.14577L8.2053 9.97335L12.1314 6.04489L9.30213 3.21731Z", fill: "#38A611", mask: "url(#path-1-inside-1_8581_37376)" })] }));
4466
+ return (jsxs("svg", { width: width || '10', viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", sx: style, children: [jsx$2("circle", { cx: "7.5", cy: "7.5", r: "7.5", fill: "white" }), jsx$2("mask", { id: "path-1-inside-1_8581_37376", fill: "white", children: jsx$2("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M7.5 15C11.6421 15 15 11.6421 15 7.5C15 3.35786 11.6421 0 7.5 0C3.35786 0 0 3.35786 0 7.5C0 11.6421 3.35786 15 7.5 15ZM10.7168 4.6311C10.8812 4.47247 11.1484 4.46313 11.3232 4.6031C11.4773 4.73374 11.5082 4.94836 11.3848 5.10699L7.57177 10.1459L7.54094 10.1832C7.29427 10.5098 6.80094 10.5938 6.44122 10.3698C6.36927 10.3232 6.29733 10.2578 6.24594 10.1925L4.324 7.70108C4.19039 7.52379 4.2315 7.28117 4.42678 7.15987C4.58094 7.05722 4.79678 7.06656 4.94066 7.17853L6.79066 8.55956L10.7168 4.6311Z" }) }), jsx$2("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M7.5 15C11.6421 15 15 11.6421 15 7.5C15 3.35786 11.6421 0 7.5 0C3.35786 0 0 3.35786 0 7.5C0 11.6421 3.35786 15 7.5 15ZM10.7168 4.6311C10.8812 4.47247 11.1484 4.46313 11.3232 4.6031C11.4773 4.73374 11.5082 4.94836 11.3848 5.10699L7.57177 10.1459L7.54094 10.1832C7.29427 10.5098 6.80094 10.5938 6.44122 10.3698C6.36927 10.3232 6.29733 10.2578 6.24594 10.1925L4.324 7.70108C4.19039 7.52379 4.2315 7.28117 4.42678 7.15987C4.58094 7.05722 4.79678 7.06656 4.94066 7.17853L6.79066 8.55956L10.7168 4.6311Z", fill: "#38A611" }), jsx$2("path", { d: "M11.3232 4.6031L12.6161 3.07725L12.5951 3.05944L12.5736 3.0422L11.3232 4.6031ZM10.7168 4.6311L9.32823 3.19167L9.31506 3.20437L9.30213 3.21731L10.7168 4.6311ZM11.3848 5.10699L9.80589 3.8794L9.79787 3.88972L9.78999 3.90014L11.3848 5.10699ZM7.57177 10.1459L9.11371 11.4196L9.14087 11.3867L9.16661 11.3527L7.57177 10.1459ZM7.54094 10.1832L5.999 8.90945L5.97125 8.94305L5.94499 8.97782L7.54094 10.1832ZM6.44122 10.3698L5.35301 12.0479L5.36851 12.0579L5.3842 12.0677L6.44122 10.3698ZM6.24594 10.1925L4.66237 11.4141L4.66819 11.4217L4.67408 11.4292L6.24594 10.1925ZM4.324 7.70108L2.72677 8.90477L2.73355 8.91376L2.74042 8.92268L4.324 7.70108ZM4.42678 7.15987L5.48213 8.85876L5.50892 8.84212L5.53518 8.82463L4.42678 7.15987ZM4.94066 7.17853L3.71236 8.75691L3.72819 8.76922L3.74426 8.78122L4.94066 7.17853ZM6.79066 8.55956L5.59425 10.1622L6.98153 11.1978L8.2053 9.97335L6.79066 8.55956ZM13 7.5C13 10.5376 10.5376 13 7.5 13V17C12.7467 17 17 12.7467 17 7.5H13ZM7.5 2C10.5376 2 13 4.46243 13 7.5H17C17 2.25329 12.7467 -2 7.5 -2V2ZM2 7.5C2 4.46243 4.46243 2 7.5 2V-2C2.25329 -2 -2 2.25329 -2 7.5H2ZM7.5 13C4.46243 13 2 10.5376 2 7.5H-2C-2 12.7467 2.25329 17 7.5 17V13ZM12.5736 3.0422C11.623 2.28067 10.225 2.32656 9.32823 3.19167L12.1053 6.07052C11.5374 6.61837 10.6739 6.64559 10.0727 6.164L12.5736 3.0422ZM12.9638 6.33458C13.7999 5.2591 13.5179 3.84143 12.6161 3.07725L10.0302 6.12895C9.43671 5.62605 9.2164 4.63761 9.80589 3.8794L12.9638 6.33458ZM9.16661 11.3527L12.9797 6.31385L9.78999 3.90014L5.97694 8.93902L9.16661 11.3527ZM9.08288 11.4569L9.11371 11.4196L6.02984 8.87212L5.999 8.90945L9.08288 11.4569ZM5.3842 12.0677C6.57521 12.8092 8.23351 12.5847 9.13689 11.3886L5.94499 8.97782C6.1621 8.69035 6.45202 8.55308 6.69854 8.51121C6.94576 8.46921 7.23358 8.5072 7.49824 8.67197L5.3842 12.0677ZM4.67408 11.4292C4.86564 11.6726 5.10262 11.8855 5.35301 12.0479L7.52942 8.69178C7.59192 8.73231 7.64101 8.77179 7.68026 8.80742C7.71912 8.8427 7.76655 8.89076 7.8178 8.95589L4.67408 11.4292ZM2.74042 8.92268L4.66237 11.4141L7.82951 8.97093L5.90757 6.47949L2.74042 8.92268ZM3.37143 5.46098C2.16753 6.20884 1.89287 7.79823 2.72677 8.90477L5.92123 6.49739C6.48791 7.24934 6.29547 8.35351 5.48213 8.85876L3.37143 5.46098ZM6.16897 5.60015C5.3495 4.96244 4.1927 4.91298 3.31837 5.4951L5.53518 8.82463C4.96918 9.20147 4.24405 9.17067 3.71236 8.75691L6.16897 5.60015ZM7.98707 6.95687L6.13707 5.57584L3.74426 8.78122L5.59425 10.1622L7.98707 6.95687ZM9.30213 3.21731L5.37603 7.14577L8.2053 9.97335L12.1314 6.04489L9.30213 3.21731Z", fill: "#38A611", mask: "url(#path-1-inside-1_8581_37376)" })] }));
4467
4467
  };
4468
4468
 
4469
4469
  const QuestionCircle = ({ direction = 'down', color = 'text', width, getStyles }) => {
@@ -19717,7 +19717,7 @@ const MINUTE_IN_SECONDS = 60;
19717
19717
  const HOUR_IN_SECONDS = MINUTE_IN_SECONDS * 60;
19718
19718
  const DAY_IN_SECONDS = HOUR_IN_SECONDS * 24;
19719
19719
  const MONTH_IN_SECONDS = DAY_IN_SECONDS * 30; // Assuming 30 days in a month
19720
- const getTimePeriods = (seconds, days) => {
19720
+ const getTimePeriods = (seconds = 0, days) => {
19721
19721
  let delta = seconds;
19722
19722
  const timeLeft = {
19723
19723
  months: 0,
@@ -19753,7 +19753,7 @@ const getTimePeriods = (seconds, days) => {
19753
19753
  * @param shorten determines whether you want to get just the highest value or the full string
19754
19754
  */
19755
19755
  const formatTimeLeft = (timeLeft, useDays = true, shorten = false) => {
19756
- const parsedTimeLeft = getTimePeriods(timeLeft !== null && timeLeft !== void 0 ? timeLeft : 0, useDays);
19756
+ const parsedTimeLeft = getTimePeriods(timeLeft, useDays);
19757
19757
  if (shorten) {
19758
19758
  if (parsedTimeLeft.months > 0) {
19759
19759
  return `${parsedTimeLeft.months}Mo`;
@@ -19789,7 +19789,7 @@ const localeFormat = (number, precision = 2) => {
19789
19789
  const formatNumberSI = (num, digits = 2) => {
19790
19790
  if (!num)
19791
19791
  return '0';
19792
- const number = typeof num === 'string' ? parseFloat(num) : num;
19792
+ const number = typeof num === 'string' ? parseFloat(num) : typeof num === 'number' ? num : num.toNumber();
19793
19793
  const suffixes = [
19794
19794
  { value: 1e12, symbol: 'T' },
19795
19795
  { value: 1e9, symbol: 'B' },
@@ -63360,8 +63360,8 @@ const sortBonds = (sortConfig, bonds) => {
63360
63360
  bValue = remainingPercentage(b);
63361
63361
  }
63362
63362
  else if (sortConfig.key === 'terms') {
63363
- aValue = vestingTime(a.vestingTerm).days;
63364
- bValue = vestingTime(b.vestingTerm).days;
63363
+ aValue = getTimePeriods(a.vestingTerm, true).days;
63364
+ bValue = getTimePeriods(b.vestingTerm, true).days;
63365
63365
  }
63366
63366
  else {
63367
63367
  aValue = (_f = (_e = findHighestTrueBondPrice(TIERS_WEIGHT[main.LaunchBondTiers.Legend], a === null || a === void 0 ? void 0 : a.trueBondPrices)) === null || _e === void 0 ? void 0 : _e.bonusWithFee) !== null && _f !== void 0 ? _f : 0;
@@ -63376,15 +63376,6 @@ const sortBonds = (sortConfig, bonds) => {
63376
63376
  return 0;
63377
63377
  });
63378
63378
  };
63379
- const vestingTime = (vestingTerm) => {
63380
- return getTimePeriods(vestingTerm !== null && vestingTerm !== void 0 ? vestingTerm : 0, true);
63381
- };
63382
- const remainingPercentage = (bond) => {
63383
- var _a, _b, _c, _d;
63384
- const totalMaxPayout = new BigNumber$1((_a = bond.maxTotalPayout) !== null && _a !== void 0 ? _a : '0').div(new BigNumber$1(10).pow((_c = (_b = bond.earnToken.decimals) === null || _b === void 0 ? void 0 : _b[bond.chainId]) !== null && _c !== void 0 ? _c : 18));
63385
- const remainingTokens = new BigNumber$1((_d = bond.tokensRemaining) !== null && _d !== void 0 ? _d : '0');
63386
- return remainingTokens.div(totalMaxPayout).times(100).toNumber();
63387
- };
63388
63379
  const getDiscountColor = (discount) => {
63389
63380
  if (!discount)
63390
63381
  return '';
@@ -63401,7 +63392,7 @@ const calculateARR = (bond, useTiers) => {
63401
63392
  const discount = bonus !== null && bonus !== void 0 ? bonus : 0;
63402
63393
  if (discount < 0)
63403
63394
  return '-';
63404
- const vestingDays = vestingTime(vestingTerm).days;
63395
+ const vestingDays = getTimePeriods(vestingTerm, true).days;
63405
63396
  return `${((discount * 365) / vestingDays).toFixed(2)}%`;
63406
63397
  };
63407
63398
  const isBondSupported = (SDKVersion, bondVersion) => {
@@ -63425,19 +63416,6 @@ const isBondSupported = (SDKVersion, bondVersion) => {
63425
63416
  // If none of the above conditions are met, version1 is less
63426
63417
  return false;
63427
63418
  };
63428
- const getRemainingTokensString = (bond) => {
63429
- const remainingTokensFormat = (bond) => {
63430
- const tokensRemaining = 'tokensRemaining' in bond ? bond.tokensRemaining : '0';
63431
- return formatNumberSI(parseFloat(tokensRemaining !== null && tokensRemaining !== void 0 ? tokensRemaining : '0'), 0);
63432
- };
63433
- const remainingTokensUsd = (bond) => {
63434
- const tokensRemaining = 'tokensRemaining' in bond ? bond.tokensRemaining : '0';
63435
- const payoutTokenPrice = 'payoutTokenPrice' in bond ? bond.payoutTokenPrice : 0;
63436
- const tokens = new BigNumber$1(tokensRemaining !== null && tokensRemaining !== void 0 ? tokensRemaining : '0');
63437
- return tokens.times(payoutTokenPrice !== null && payoutTokenPrice !== void 0 ? payoutTokenPrice : '0');
63438
- };
63439
- return `${remainingTokensFormat(bond)} ${bond.earnToken.symbol} ($${formatNumberSI(remainingTokensUsd(bond).toNumber())})`;
63440
- };
63441
63419
  /**
63442
63420
  * Finds the highest TrueBondPrices element where userPoints is higher than points in the array.
63443
63421
  * @param userPoints - The user's points as a string representing a BigNumber.
@@ -63574,19 +63552,36 @@ const discountEarnTokenPriceForUser = (bond, useTiers, userTier) => {
63574
63552
  const trueBondPriceWithFee = getBalanceNumber(new BigNumber$1(trueBondPrice !== null && trueBondPrice !== void 0 ? trueBondPrice : '0').times((100 + fee) / 100));
63575
63553
  return getFirstNonZeroDigits(principalTokenPrice * trueBondPriceWithFee);
63576
63554
  };
63577
- const maxBuy = (bond, allowLowValueBonds) => {
63578
- var _a, _b, _c, _d, _e, _f;
63555
+ const SAFETY_THRESHOLD = 5; // in USD
63556
+ const getSafetyAvailable = (bond, allowLowValueBonds) => {
63557
+ var _a, _b, _c;
63579
63558
  const available = new BigNumber$1((_a = bond === null || bond === void 0 ? void 0 : bond.tokensRemaining) !== null && _a !== void 0 ? _a : '0');
63580
- const threshold = allowLowValueBonds ? 0 : 5;
63581
63559
  const payoutTokenPrice = new BigNumber$1((_b = bond === null || bond === void 0 ? void 0 : bond.payoutTokenPrice) !== null && _b !== void 0 ? _b : 0);
63560
+ const threshold = allowLowValueBonds ? 0 : SAFETY_THRESHOLD;
63582
63561
  const thresholdToShow = payoutTokenPrice.gt(0) ? new BigNumber$1(threshold).div(payoutTokenPrice) : new BigNumber$1(0);
63583
- let safeAvailable = available.minus(thresholdToShow);
63562
+ const feeInPayoutAdjuster = (100 - ((_c = bond === null || bond === void 0 ? void 0 : bond.feeInPayout) !== null && _c !== void 0 ? _c : 0)) / 100;
63563
+ let safeAvailable = available.times(feeInPayoutAdjuster).minus(thresholdToShow);
63584
63564
  if (safeAvailable.lt(0))
63585
63565
  safeAvailable = new BigNumber$1(0);
63586
- const singlePurchaseLimit = new BigNumber$1((_c = bond === null || bond === void 0 ? void 0 : bond.maxPayout) !== null && _c !== void 0 ? _c : 0).div(new BigNumber$1(10).pow((_f = (_e = (_d = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _d === void 0 ? void 0 : _d.decimals) === null || _e === void 0 ? void 0 : _e[bond === null || bond === void 0 ? void 0 : bond.chainId]) !== null && _f !== void 0 ? _f : 18));
63587
63566
  if (available.isZero())
63588
63567
  return new BigNumber$1(0);
63589
- return singlePurchaseLimit.lt(safeAvailable) ? singlePurchaseLimit : safeAvailable;
63568
+ return safeAvailable;
63569
+ };
63570
+ const getSafetyPurchaseLimit = (bond, allowLowValueBonds) => {
63571
+ var _a, _b, _c, _d, _e, _f;
63572
+ const threshold = allowLowValueBonds ? 0 : SAFETY_THRESHOLD;
63573
+ const payoutTokenPrice = new BigNumber$1((_a = bond === null || bond === void 0 ? void 0 : bond.payoutTokenPrice) !== null && _a !== void 0 ? _a : 0);
63574
+ const thresholdToShow = payoutTokenPrice.gt(0) ? new BigNumber$1(threshold).div(payoutTokenPrice) : new BigNumber$1(0);
63575
+ const feeInPayoutAdjuster = (100 - ((_b = bond === null || bond === void 0 ? void 0 : bond.feeInPayout) !== null && _b !== void 0 ? _b : 0)) / 100;
63576
+ return new BigNumber$1((_c = bond === null || bond === void 0 ? void 0 : bond.maxPayout) !== null && _c !== void 0 ? _c : 0)
63577
+ .div(new BigNumber$1(10).pow((_f = (_e = (_d = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _d === void 0 ? void 0 : _d.decimals) === null || _e === void 0 ? void 0 : _e[bond === null || bond === void 0 ? void 0 : bond.chainId]) !== null && _f !== void 0 ? _f : 18))
63578
+ .times(feeInPayoutAdjuster)
63579
+ .minus(thresholdToShow);
63580
+ };
63581
+ const getMaxBuy = (bond, allowLowValueBonds) => {
63582
+ const safeAvailable = getSafetyAvailable(bond, allowLowValueBonds);
63583
+ const safePurchaseLimit = getSafetyPurchaseLimit(bond, allowLowValueBonds);
63584
+ return safePurchaseLimit.lt(safeAvailable) ? safePurchaseLimit : safeAvailable;
63590
63585
  };
63591
63586
  function formatNumber$1(input) {
63592
63587
  const number = new BigNumber$1(input);
@@ -63619,7 +63614,7 @@ const youSpendUSD = (bond, inputValue) => {
63619
63614
  var _a;
63620
63615
  return (parseFloat(inputValue) * parseFloat((_a = bond === null || bond === void 0 ? void 0 : bond.principalTokenPrice) !== null && _a !== void 0 ? _a : '0')).toString();
63621
63616
  };
63622
- // receives depositAmount and returns the payoutTokens the user will receive. IT DOES SUBTRACT FEE
63617
+ // receives depositAmount and returns the payoutTokens the user will receive. IT DOES SUBTRACT FEE IN PAYOUT
63623
63618
  const getPayoutAmount = (bond, inputValue, userPoints) => {
63624
63619
  var _a, _b;
63625
63620
  if (!inputValue || !bond || !userPoints || !bond.trueBondPrices)
@@ -63633,26 +63628,60 @@ const getPayoutAmount = (bond, inputValue, userPoints) => {
63633
63628
  return billValue.toNumber();
63634
63629
  };
63635
63630
  const youGetUSD = (bond, inputValue, userPoints) => {
63636
- var _a, _b, _c, _d;
63637
- if (!bond.trueBondPrices)
63638
- return '0';
63639
- const bigValue = new BigNumber$1(inputValue).times(new BigNumber$1(10).pow(18));
63640
- const trueBondPrice = (_b = (_a = findHighestTrueBondPrice(userPoints, bond === null || bond === void 0 ? void 0 : bond.trueBondPrices)) === null || _a === void 0 ? void 0 : _a.trueBondPrice) !== null && _b !== void 0 ? _b : 0;
63641
- const fee = (_c = bond === null || bond === void 0 ? void 0 : bond.feeInPayout) !== null && _c !== void 0 ? _c : 0;
63642
- const reverseFee = new BigNumber$1(fee / 100 / (1 - fee / 100));
63643
- const trueBondPriceWithFee = new BigNumber$1(trueBondPrice).plus(new BigNumber$1(trueBondPrice).times(reverseFee));
63644
- const billValue = bigValue.div(new BigNumber$1(trueBondPriceWithFee));
63645
- return (billValue.toNumber() * parseFloat((_d = bond === null || bond === void 0 ? void 0 : bond.payoutTokenPrice) !== null && _d !== void 0 ? _d : '0')).toString();
63631
+ var _a;
63632
+ if (!inputValue || !bond || !userPoints || !bond.trueBondPrices)
63633
+ return 0;
63634
+ const payoutAmount = getPayoutAmount(bond, inputValue, userPoints);
63635
+ return payoutAmount * parseFloat((_a = bond === null || bond === void 0 ? void 0 : bond.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0');
63646
63636
  };
63647
63637
  const getRawBonus$1 = (bond, inputValue, userPoints) => {
63648
63638
  if (!bond || !inputValue || !userPoints)
63649
63639
  return '0';
63650
- const premiumUSD = parseFloat(youGetUSD(bond, inputValue, userPoints)) - parseFloat(youSpendUSD(bond, inputValue));
63640
+ const premiumUSD = youGetUSD(bond, inputValue, userPoints) - parseFloat(youSpendUSD(bond, inputValue));
63651
63641
  return premiumUSD.toString();
63652
63642
  };
63653
63643
  const getBonusColor = (premiumString) => {
63654
63644
  return parseFloat(premiumString) < 0 ? 'premium-negative' : 'premium-positive';
63655
63645
  };
63646
+ /**
63647
+ * Calculates the principal token amount needed to receive a target payout amount.
63648
+ * This is the reverse of getRawPayoutAmount function (does NOT include fees).
63649
+ *
63650
+ * @param bond - The bond data
63651
+ * @param targetPayoutAmount - The desired payout amount in payout tokens
63652
+ * @param userPoints - User's tier points
63653
+ * @returns The principal token amount needed, or '0' if calculation cannot be performed
63654
+ */
63655
+ const getPrincipalAmount = (bond, targetPayoutAmount, userPoints) => {
63656
+ var _a, _b;
63657
+ if (!targetPayoutAmount || !bond || !userPoints || !bond.trueBondPrices)
63658
+ return '0';
63659
+ const billValue = new BigNumber$1(targetPayoutAmount);
63660
+ const fee = (_a = bond === null || bond === void 0 ? void 0 : bond.feeInPayout) !== null && _a !== void 0 ? _a : 0;
63661
+ const trueBondPriceObject = findHighestTrueBondPrice(userPoints, bond === null || bond === void 0 ? void 0 : bond.trueBondPrices);
63662
+ const trueBondPrice = new BigNumber$1((_b = trueBondPriceObject === null || trueBondPriceObject === void 0 ? void 0 : trueBondPriceObject.trueBondPrice) !== null && _b !== void 0 ? _b : '0');
63663
+ if (trueBondPrice.isZero())
63664
+ return '0';
63665
+ const reverseFee = new BigNumber$1(fee / 100 / (1 - fee / 100));
63666
+ const trueBondPriceWithFee = trueBondPrice.plus(trueBondPrice.times(reverseFee));
63667
+ // Reverse the formula: bigValue = billValue * (trueBondPrice + trueBondPrice * reverseFee)
63668
+ const bigValue = billValue.times(trueBondPriceWithFee);
63669
+ // Convert from 18 decimals back to regular amount
63670
+ const inputValue = bigValue.div(new BigNumber$1(10).pow(18));
63671
+ return inputValue.toString();
63672
+ };
63673
+ const getRemainingTokensString = (bond, allowLowValueBonds) => {
63674
+ var _a;
63675
+ const remainingTokens = getSafetyAvailable(bond, allowLowValueBonds).toNumber();
63676
+ const remainingTokensUsd = remainingTokens * parseFloat((_a = bond.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0');
63677
+ return `${formatNumberSI(remainingTokens, 0)} ${bond.earnToken.symbol} ($${formatNumberSI(remainingTokensUsd, 0)})`;
63678
+ };
63679
+ const remainingPercentage = (bond) => {
63680
+ var _a, _b, _c, _d;
63681
+ const totalMaxPayout = new BigNumber$1((_a = bond.maxTotalPayout) !== null && _a !== void 0 ? _a : '0').div(new BigNumber$1(10).pow((_c = (_b = bond.earnToken.decimals) === null || _b === void 0 ? void 0 : _b[bond.chainId]) !== null && _c !== void 0 ? _c : 18));
63682
+ const remainingTokens = new BigNumber$1((_d = bond.tokensRemaining) !== null && _d !== void 0 ? _d : '0');
63683
+ return remainingTokens.div(totalMaxPayout).times(100).toNumber();
63684
+ };
63656
63685
 
63657
63686
  function useBondsList() {
63658
63687
  const queryClient = useQueryClient();
@@ -76610,7 +76639,7 @@ const PreTgeActions = ({ userBond }) => {
76610
76639
  };
76611
76640
 
76612
76641
  const UserBondRowPreTGE = ({ userBond }) => {
76613
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
76642
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
76614
76643
  const saleFinalized = userBond.finalized;
76615
76644
  const hasRedeemed = (_a = userBond === null || userBond === void 0 ? void 0 : userBond.accountInfo) === null || _a === void 0 ? void 0 : _a.hasRedeemed;
76616
76645
  const isRedeemable = !hasRedeemed && saleFinalized;
@@ -76618,23 +76647,23 @@ const UserBondRowPreTGE = ({ userBond }) => {
76618
76647
  const depositAmount = getBalanceNumber(new BigNumber$1((_d = (_c = userBond === null || userBond === void 0 ? void 0 : userBond.accountInfo) === null || _c === void 0 ? void 0 : _c.depositAmount) !== null && _d !== void 0 ? _d : '0'), (_f = (_e = userBond === null || userBond === void 0 ? void 0 : userBond.lpToken) === null || _e === void 0 ? void 0 : _e.decimals) === null || _f === void 0 ? void 0 : _f[userBond === null || userBond === void 0 ? void 0 : userBond.chainId]);
76619
76648
  const truePricePaid = getBalanceNumber(new BigNumber$1((_h = (_g = userBond === null || userBond === void 0 ? void 0 : userBond.accountInfo) === null || _g === void 0 ? void 0 : _g.truePricePaid) !== null && _h !== void 0 ? _h : '0'), (_k = (_j = userBond === null || userBond === void 0 ? void 0 : userBond.lpToken) === null || _j === void 0 ? void 0 : _j.decimals) === null || _k === void 0 ? void 0 : _k[userBond === null || userBond === void 0 ? void 0 : userBond.chainId]);
76620
76649
  const initialRelease = userBond === null || userBond === void 0 ? void 0 : userBond.initialRelease;
76621
- const vestingTimePeriods = getTimePeriods((_l = userBond.vestingTerm) !== null && _l !== void 0 ? _l : 0, false);
76650
+ const vestingTimePeriods = getTimePeriods(userBond.vestingTerm, false);
76622
76651
  const vestingString = hasRedeemed
76623
76652
  ? getPendingVestingString(userBond === null || userBond === void 0 ? void 0 : userBond.userOwnedBillsData)
76624
76653
  : initialRelease === 1
76625
76654
  ? `0 D`
76626
76655
  : `${vestingTimePeriods.months} Months`;
76627
- const userAllocation = depositAmount / ((_m = userBond === null || userBond === void 0 ? void 0 : userBond.initPrice) !== null && _m !== void 0 ? _m : 0);
76656
+ const userAllocation = depositAmount / ((_l = userBond === null || userBond === void 0 ? void 0 : userBond.initPrice) !== null && _l !== void 0 ? _l : 0);
76628
76657
  const initialReleaseTokens = !hasRedeemed && saleFinalized && (userBond === null || userBond === void 0 ? void 0 : userBond.initialRelease) ? userAllocation * (userBond === null || userBond === void 0 ? void 0 : userBond.initialRelease) : 0;
76629
76658
  // pendingRewards variable follows the naming of the SC, but it actually means currently claimable tokens
76630
- const pendingRewards = getBalanceNumber(new BigNumber$1((_p = (_o = userBond === null || userBond === void 0 ? void 0 : userBond.userOwnedBillsData) === null || _o === void 0 ? void 0 : _o.pendingRewards) !== null && _p !== void 0 ? _p : '0'), (_r = (_q = userBond === null || userBond === void 0 ? void 0 : userBond.earnToken) === null || _q === void 0 ? void 0 : _q.decimals) === null || _r === void 0 ? void 0 : _r[userBond.chainId]);
76659
+ const pendingRewards = getBalanceNumber(new BigNumber$1((_o = (_m = userBond === null || userBond === void 0 ? void 0 : userBond.userOwnedBillsData) === null || _m === void 0 ? void 0 : _m.pendingRewards) !== null && _o !== void 0 ? _o : '0'), (_q = (_p = userBond === null || userBond === void 0 ? void 0 : userBond.earnToken) === null || _p === void 0 ? void 0 : _p.decimals) === null || _q === void 0 ? void 0 : _q[userBond.chainId]);
76631
76660
  // payout variable follows the naming of the SC, but it actually means total tokens vested
76632
- const payout = getBalanceNumber(new BigNumber$1((_t = (_s = userBond === null || userBond === void 0 ? void 0 : userBond.userOwnedBillsData) === null || _s === void 0 ? void 0 : _s.payout) !== null && _t !== void 0 ? _t : '0'), (_v = (_u = userBond === null || userBond === void 0 ? void 0 : userBond.earnToken) === null || _u === void 0 ? void 0 : _u.decimals) === null || _v === void 0 ? void 0 : _v[userBond.chainId]);
76661
+ const payout = getBalanceNumber(new BigNumber$1((_s = (_r = userBond === null || userBond === void 0 ? void 0 : userBond.userOwnedBillsData) === null || _r === void 0 ? void 0 : _r.payout) !== null && _s !== void 0 ? _s : '0'), (_u = (_t = userBond === null || userBond === void 0 ? void 0 : userBond.earnToken) === null || _t === void 0 ? void 0 : _t.decimals) === null || _u === void 0 ? void 0 : _u[userBond.chainId]);
76633
76662
  const claimableAmount = hasRedeemed ? pendingRewards : initialReleaseTokens;
76634
- const claimableUSD = claimableAmount * ((_w = userBond.initPrice) !== null && _w !== void 0 ? _w : 0);
76663
+ const claimableUSD = claimableAmount * ((_v = userBond.initPrice) !== null && _v !== void 0 ? _v : 0);
76635
76664
  const pendingAmount = hasRedeemed ? payout : depositAmount / truePricePaid;
76636
- const pendingUSD = pendingAmount * ((_x = userBond === null || userBond === void 0 ? void 0 : userBond.earnTokenPrice) !== null && _x !== void 0 ? _x : 0);
76637
- return (jsxs("div", { className: "your-bonds", onClick: () => null, children: [jsxs("div", { className: "token-info-container", children: [jsx$2(TokenInfoAndName, { tokenSymbol: userBond.earnToken.symbol, chain: userBond.chainId, tag: (_y = userBond.tags) === null || _y === void 0 ? void 0 : _y[0], vestEnds: isRedeemable ? 'Claim now!' : !hasRedeemed ? `Claim in ${redeemableIn}` : `Ends in ${vestingString}`, isHotBond: true }), jsx$2("div", { className: "tooltip-column", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (userBond === null || userBond === void 0 ? void 0 : userBond.earnToken.address[userBond === null || userBond === void 0 ? void 0 : userBond.chainId]) || '', earnTokenSymbol: (userBond === null || userBond === void 0 ? void 0 : userBond.earnToken.symbol) || '', bondContract: ((_z = userBond === null || userBond === void 0 ? void 0 : userBond.contractAddress) === null || _z === void 0 ? void 0 : _z[userBond === null || userBond === void 0 ? void 0 : userBond.chainId]) || '', projectLink: userBond === null || userBond === void 0 ? void 0 : userBond.projectLink, twitter: userBond === null || userBond === void 0 ? void 0 : userBond.twitter, audit: userBond === null || userBond === void 0 ? void 0 : userBond.audit, chain: userBond === null || userBond === void 0 ? void 0 : userBond.chainId }), width: "205px", placement: "bottomRight", transformTip: "translate(5%, 0%)", children: jsx$2(Flex$1, { sx: {
76665
+ const pendingUSD = pendingAmount * ((_w = userBond === null || userBond === void 0 ? void 0 : userBond.earnTokenPrice) !== null && _w !== void 0 ? _w : 0);
76666
+ return (jsxs("div", { className: "your-bonds", onClick: () => null, children: [jsxs("div", { className: "token-info-container", children: [jsx$2(TokenInfoAndName, { tokenSymbol: userBond.earnToken.symbol, chain: userBond.chainId, tag: (_x = userBond.tags) === null || _x === void 0 ? void 0 : _x[0], vestEnds: isRedeemable ? 'Claim now!' : !hasRedeemed ? `Claim in ${redeemableIn}` : `Ends in ${vestingString}`, isHotBond: true }), jsx$2("div", { className: "tooltip-column", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (userBond === null || userBond === void 0 ? void 0 : userBond.earnToken.address[userBond === null || userBond === void 0 ? void 0 : userBond.chainId]) || '', earnTokenSymbol: (userBond === null || userBond === void 0 ? void 0 : userBond.earnToken.symbol) || '', bondContract: ((_y = userBond === null || userBond === void 0 ? void 0 : userBond.contractAddress) === null || _y === void 0 ? void 0 : _y[userBond === null || userBond === void 0 ? void 0 : userBond.chainId]) || '', projectLink: userBond === null || userBond === void 0 ? void 0 : userBond.projectLink, twitter: userBond === null || userBond === void 0 ? void 0 : userBond.twitter, audit: userBond === null || userBond === void 0 ? void 0 : userBond.audit, chain: userBond === null || userBond === void 0 ? void 0 : userBond.chainId }), width: "205px", placement: "bottomRight", transformTip: "translate(5%, 0%)", children: jsx$2(Flex$1, { sx: {
76638
76667
  opacity: 0.8,
76639
76668
  }, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] }), jsxs("div", { className: "your-bonds-columns-container", children: [jsx$2(Flex$1, { sx: { display: ['none', 'none', 'none', 'flex'], width: '125px' } }), jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Claimable" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(claimableAmount, 3), jsxs("div", { className: "your-bonds-content-tokens-usd-amount", children: ["($", formatUSDNumber$1(claimableUSD), ")"] })] })] }), jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Pending" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(pendingAmount, 3), jsxs("div", { className: "your-bonds-content-tokens-usd-amount", children: ["($", formatUSDNumber$1(pendingUSD), ")"] })] })] }), jsx$2("div", { className: "your-bonds-content hide-mobile", children: vestingString }), jsx$2("div", { className: "your-bonds-column-button", children: jsx$2(PreTgeActions, { userBond: userBond }) })] })] }));
76640
76669
  };
@@ -76869,80 +76898,2453 @@ var ABI_DEPOSIT = [
76869
76898
 
76870
76899
  var ABI_DEPOSIT_SIG = [
76871
76900
  {
76901
+ inputs: [
76902
+ ],
76903
+ name: "BondTooLarge",
76904
+ type: "error"
76905
+ },
76906
+ {
76907
+ inputs: [
76908
+ ],
76909
+ name: "BondTooSmall",
76910
+ type: "error"
76911
+ },
76912
+ {
76913
+ inputs: [
76914
+ ],
76915
+ name: "ControlVariableTooLow",
76916
+ type: "error"
76917
+ },
76918
+ {
76919
+ inputs: [
76920
+ ],
76921
+ name: "DebtMustBeZero",
76922
+ type: "error"
76923
+ },
76924
+ {
76925
+ inputs: [
76926
+ ],
76927
+ name: "DecrementTooLarge",
76928
+ type: "error"
76929
+ },
76930
+ {
76931
+ inputs: [
76932
+ ],
76933
+ name: "IncrementTooLarge",
76934
+ type: "error"
76935
+ },
76936
+ {
76937
+ inputs: [
76938
+ ],
76939
+ name: "InsufficientTier",
76940
+ type: "error"
76941
+ },
76942
+ {
76943
+ inputs: [
76944
+ ],
76945
+ name: "InvalidAddress",
76946
+ type: "error"
76947
+ },
76948
+ {
76949
+ inputs: [
76950
+ ],
76951
+ name: "InvalidBCV",
76952
+ type: "error"
76953
+ },
76954
+ {
76955
+ inputs: [
76956
+ ],
76957
+ name: "InvalidBondId",
76958
+ type: "error"
76959
+ },
76960
+ {
76961
+ inputs: [
76962
+ ],
76963
+ name: "InvalidExtraDiscount",
76964
+ type: "error"
76965
+ },
76966
+ {
76967
+ inputs: [
76968
+ ],
76969
+ name: "InvalidFee",
76970
+ type: "error"
76971
+ },
76972
+ {
76973
+ inputs: [
76974
+ ],
76975
+ name: "InvalidMinPoints",
76976
+ type: "error"
76977
+ },
76978
+ {
76979
+ inputs: [
76980
+ ],
76981
+ name: "InvalidPoints",
76982
+ type: "error"
76983
+ },
76984
+ {
76985
+ inputs: [
76986
+ ],
76987
+ name: "InvalidPointsLens",
76988
+ type: "error"
76989
+ },
76990
+ {
76991
+ inputs: [
76992
+ ],
76993
+ name: "InvalidSValue",
76994
+ type: "error"
76995
+ },
76996
+ {
76997
+ inputs: [
76998
+ ],
76999
+ name: "InvalidSignature",
77000
+ type: "error"
77001
+ },
77002
+ {
77003
+ inputs: [
77004
+ ],
77005
+ name: "InvalidSignatureLength",
77006
+ type: "error"
77007
+ },
77008
+ {
77009
+ inputs: [
77010
+ ],
77011
+ name: "InvalidUpdateInterval",
77012
+ type: "error"
77013
+ },
77014
+ {
77015
+ inputs: [
77016
+ ],
77017
+ name: "LengthMismatch",
77018
+ type: "error"
77019
+ },
77020
+ {
77021
+ inputs: [
77022
+ ],
77023
+ name: "MaxCapacityReached",
77024
+ type: "error"
77025
+ },
77026
+ {
77027
+ inputs: [
77028
+ ],
77029
+ name: "MaxTotalPayoutExceeded",
77030
+ type: "error"
77031
+ },
77032
+ {
77033
+ inputs: [
77034
+ ],
77035
+ name: "NoTierAccess",
77036
+ type: "error"
77037
+ },
77038
+ {
77039
+ inputs: [
77040
+ ],
77041
+ name: "NotApproved",
77042
+ type: "error"
77043
+ },
77044
+ {
77045
+ inputs: [
77046
+ ],
77047
+ name: "NothingToClaim",
77048
+ type: "error"
77049
+ },
77050
+ {
77051
+ inputs: [
77052
+ ],
77053
+ name: "PayoutTokenAddressMismatch",
77054
+ type: "error"
77055
+ },
77056
+ {
77057
+ inputs: [
77058
+ ],
77059
+ name: "SignatureExpired",
77060
+ type: "error"
77061
+ },
77062
+ {
77063
+ inputs: [
77064
+ ],
77065
+ name: "SlippageExceeded",
77066
+ type: "error"
77067
+ },
77068
+ {
77069
+ inputs: [
77070
+ ],
77071
+ name: "TargetMustBeAboveZero",
77072
+ type: "error"
77073
+ },
77074
+ {
77075
+ inputs: [
77076
+ ],
77077
+ name: "Unauthorized",
77078
+ type: "error"
77079
+ },
77080
+ {
77081
+ inputs: [
77082
+ ],
77083
+ name: "UnauthorizedSigner",
77084
+ type: "error"
77085
+ },
77086
+ {
77087
+ inputs: [
77088
+ ],
77089
+ name: "UpdateIntervalNotElapsed",
77090
+ type: "error"
77091
+ },
77092
+ {
77093
+ inputs: [
77094
+ ],
77095
+ name: "VestingTooShort",
77096
+ type: "error"
77097
+ },
77098
+ {
77099
+ inputs: [
77100
+ ],
77101
+ name: "ZeroAddress",
77102
+ type: "error"
77103
+ },
77104
+ {
77105
+ inputs: [
77106
+ ],
77107
+ name: "ZeroSignatureLength",
77108
+ type: "error"
77109
+ },
77110
+ {
77111
+ anonymous: false,
76872
77112
  inputs: [
76873
77113
  {
77114
+ indexed: false,
76874
77115
  internalType: "uint256",
76875
- name: "_amount",
77116
+ name: "minBCVUpdateInterval",
77117
+ type: "uint256"
77118
+ }
77119
+ ],
77120
+ name: "BCVUpdateIntervalChanged",
77121
+ type: "event"
77122
+ },
77123
+ {
77124
+ anonymous: false,
77125
+ inputs: [
77126
+ {
77127
+ indexed: true,
77128
+ internalType: "uint256",
77129
+ name: "billId",
76876
77130
  type: "uint256"
76877
77131
  },
76878
77132
  {
77133
+ indexed: true,
77134
+ internalType: "address",
77135
+ name: "recipient",
77136
+ type: "address"
77137
+ },
77138
+ {
77139
+ indexed: false,
76879
77140
  internalType: "uint256",
76880
- name: "_maxPrice",
77141
+ name: "payout",
77142
+ type: "uint256"
77143
+ },
77144
+ {
77145
+ indexed: false,
77146
+ internalType: "uint256",
77147
+ name: "remaining",
77148
+ type: "uint256"
77149
+ }
77150
+ ],
77151
+ name: "BillClaimed",
77152
+ type: "event"
77153
+ },
77154
+ {
77155
+ anonymous: false,
77156
+ inputs: [
77157
+ {
77158
+ indexed: false,
77159
+ internalType: "uint256",
77160
+ name: "deposit",
77161
+ type: "uint256"
77162
+ },
77163
+ {
77164
+ indexed: false,
77165
+ internalType: "uint256",
77166
+ name: "payout",
77167
+ type: "uint256"
77168
+ },
77169
+ {
77170
+ indexed: false,
77171
+ internalType: "uint256",
77172
+ name: "expires",
77173
+ type: "uint256"
77174
+ },
77175
+ {
77176
+ indexed: true,
77177
+ internalType: "uint256",
77178
+ name: "billId",
77179
+ type: "uint256"
77180
+ }
77181
+ ],
77182
+ name: "BillCreated",
77183
+ type: "event"
77184
+ },
77185
+ {
77186
+ anonymous: false,
77187
+ inputs: [
77188
+ {
77189
+ components: [
77190
+ {
77191
+ internalType: "uint256",
77192
+ name: "controlVariable",
77193
+ type: "uint256"
77194
+ },
77195
+ {
77196
+ internalType: "uint256",
77197
+ name: "vestingTerm",
77198
+ type: "uint256"
77199
+ },
77200
+ {
77201
+ internalType: "uint256",
77202
+ name: "minimumPrice",
77203
+ type: "uint256"
77204
+ },
77205
+ {
77206
+ internalType: "uint256",
77207
+ name: "maxPayout",
77208
+ type: "uint256"
77209
+ },
77210
+ {
77211
+ internalType: "uint256",
77212
+ name: "maxDebt",
77213
+ type: "uint256"
77214
+ },
77215
+ {
77216
+ internalType: "uint256",
77217
+ name: "maxTotalPayout",
77218
+ type: "uint256"
77219
+ },
77220
+ {
77221
+ internalType: "uint256",
77222
+ name: "initialDebt",
77223
+ type: "uint256"
77224
+ }
77225
+ ],
77226
+ indexed: false,
77227
+ internalType: "struct IApeBond.BondTerms",
77228
+ name: "billTerms",
77229
+ type: "tuple"
77230
+ },
77231
+ {
77232
+ indexed: false,
77233
+ internalType: "uint256",
77234
+ name: "lastDecay",
77235
+ type: "uint256"
77236
+ }
77237
+ ],
77238
+ name: "BillInitialized",
77239
+ type: "event"
77240
+ },
77241
+ {
77242
+ anonymous: false,
77243
+ inputs: [
77244
+ {
77245
+ indexed: false,
77246
+ internalType: "uint256",
77247
+ name: "internalPrice",
77248
+ type: "uint256"
77249
+ },
77250
+ {
77251
+ indexed: false,
77252
+ internalType: "uint256",
77253
+ name: "debtRatio",
77254
+ type: "uint256"
77255
+ }
77256
+ ],
77257
+ name: "BondPriceChanged",
77258
+ type: "event"
77259
+ },
77260
+ {
77261
+ anonymous: false,
77262
+ inputs: [
77263
+ {
77264
+ indexed: false,
77265
+ internalType: "uint256",
77266
+ name: "initialBCV",
77267
+ type: "uint256"
77268
+ },
77269
+ {
77270
+ indexed: false,
77271
+ internalType: "uint256",
77272
+ name: "newBCV",
76881
77273
  type: "uint256"
77274
+ }
77275
+ ],
77276
+ name: "ControlVariableAdjustment",
77277
+ type: "event"
77278
+ },
77279
+ {
77280
+ anonymous: false,
77281
+ inputs: [
77282
+ {
77283
+ indexed: false,
77284
+ internalType: "address",
77285
+ name: "oldFeeInPrincipalRecipient",
77286
+ type: "address"
76882
77287
  },
76883
77288
  {
77289
+ indexed: false,
76884
77290
  internalType: "address",
76885
- name: "_depositor",
77291
+ name: "newFeeInPrincipalRecipient",
76886
77292
  type: "address"
76887
77293
  },
76888
77294
  {
76889
- internalType: "bytes",
76890
- name: "_tierProofSignature",
76891
- type: "bytes"
77295
+ indexed: false,
77296
+ internalType: "address",
77297
+ name: "oldFeeInPayoutRecipient",
77298
+ type: "address"
77299
+ },
77300
+ {
77301
+ indexed: false,
77302
+ internalType: "address",
77303
+ name: "newFeeInPayoutRecipient",
77304
+ type: "address"
76892
77305
  }
76893
77306
  ],
76894
- name: "deposit",
76895
- outputs: [
77307
+ name: "FeeRecipientsChanged",
77308
+ type: "event"
77309
+ },
77310
+ {
77311
+ anonymous: false,
77312
+ inputs: [
77313
+ {
77314
+ indexed: false,
77315
+ internalType: "uint8",
77316
+ name: "version",
77317
+ type: "uint8"
77318
+ }
77319
+ ],
77320
+ name: "Initialized",
77321
+ type: "event"
77322
+ },
77323
+ {
77324
+ anonymous: false,
77325
+ inputs: [
76896
77326
  {
77327
+ indexed: false,
76897
77328
  internalType: "uint256",
76898
- name: "",
77329
+ name: "newMaxTotalPayout",
76899
77330
  type: "uint256"
76900
77331
  }
76901
77332
  ],
76902
- stateMutability: "nonpayable",
76903
- type: "function"
76904
- }
76905
- ];
76906
-
76907
- // returns the checksummed address if the address is valid, otherwise returns false
76908
- function isAddress(value) {
76909
- try {
76910
- // Alphabetical letters must be made lowercase for getAddress to work.
76911
- // See documentation here: https://docs.ethers.io/v5/api/utils/address/
76912
- return getAddress(value.toLowerCase());
76913
- }
76914
- catch (_a) {
76915
- return false;
76916
- }
76917
- }
76918
-
76919
- const getNativeTicker = (chain) => {
76920
- var _a;
76921
- if (!chain)
76922
- return undefined;
76923
- return (_a = main.WNATIVE[chain]) === null || _a === void 0 ? void 0 : _a.symbol.substring(1);
76924
- };
76925
- const getTokenSymbol = (token) => {
76926
- const nativeSymbols = ['BNB', 'ETH', 'POL', 'IOTA'];
76927
- return nativeSymbols.includes(token === null || token === void 0 ? void 0 : token.symbol) ? `w${token === null || token === void 0 ? void 0 : token.symbol}` : token === null || token === void 0 ? void 0 : token.symbol;
76928
- };
76929
- const getSymbol = (token, chainId) => {
76930
- if (!token)
76931
- return '';
76932
- return token === 'NATIVE' ? getNativeTicker(chainId) : getTokenSymbol(token);
76933
- };
76934
-
76935
- const TokenRow = ({ token, chainId, handleTokenSelect, tokenBalance, }) => {
76936
- var _a, _b;
76937
- const symbol = getSymbol(token, chainId);
76938
- const tokenAddress = token === 'NATIVE' ? 'NATIVE' : token.address[chainId];
76939
- const { address } = useEVMAccount();
76940
- const { publicKey: accountSolana } = useSOLAccount();
76941
- const accountToUse = chainId === main.ChainId.SOL ? accountSolana === null || accountSolana === void 0 ? void 0 : accountSolana.toString() : address;
76942
- const splited = typeof token !== 'string' ? (_a = token === null || token === void 0 ? void 0 : token.symbol) === null || _a === void 0 ? void 0 : _a.split('-') : undefined;
76943
- return (jsxs(Flex, { sx: { p: '8px', justifyContent: 'space-between', cursor: 'pointer', '&:hover': { background: 'white4' } }, onClick: () => handleTokenSelect(tokenAddress !== null && tokenAddress !== void 0 ? tokenAddress : ''), children: [jsxs(Flex, { children: [lodashExports.isArray(splited) ? (jsx$2(TokenImage, { symbol: splited[0], symbol2: splited[1], size: 28, chain: chainId })) : (jsx$2(TokenImage, { symbol: getSymbol(token, chainId), size: 28, chain: chainId })), jsx$2(Flex, { sx: { mx: '8px', lineHeight: '28px', fontSize: '14px' }, children: symbol })] }), accountToUse && (jsx$2(Flex, { sx: { fontSize: '14px' }, children: tokenBalance === '0' ? ('0') : !tokenBalance ? (jsx$2(Spinner, { size: 15 })) : (jsx$2(Fragment$1, { children: (_b = new BigNumber$1(tokenBalance !== null && tokenBalance !== void 0 ? tokenBalance : '0')) === null || _b === void 0 ? void 0 : _b.toPrecision(5) })) }))] }));
76944
- };
76945
-
77333
+ name: "MaxTotalPayoutChanged",
77334
+ type: "event"
77335
+ },
77336
+ {
77337
+ anonymous: false,
77338
+ inputs: [
77339
+ {
77340
+ indexed: false,
77341
+ internalType: "uint256",
77342
+ name: "minBCVUpdateInterval",
77343
+ type: "uint256"
77344
+ }
77345
+ ],
77346
+ name: "MinBCVUpdateIntervalChanged",
77347
+ type: "event"
77348
+ },
77349
+ {
77350
+ anonymous: false,
77351
+ inputs: [
77352
+ {
77353
+ indexed: true,
77354
+ internalType: "address",
77355
+ name: "previousOwner",
77356
+ type: "address"
77357
+ },
77358
+ {
77359
+ indexed: true,
77360
+ internalType: "address",
77361
+ name: "newOwner",
77362
+ type: "address"
77363
+ }
77364
+ ],
77365
+ name: "OwnershipTransferred",
77366
+ type: "event"
77367
+ },
77368
+ {
77369
+ anonymous: false,
77370
+ inputs: [
77371
+ {
77372
+ indexed: false,
77373
+ internalType: "address",
77374
+ name: "account",
77375
+ type: "address"
77376
+ }
77377
+ ],
77378
+ name: "Paused",
77379
+ type: "event"
77380
+ },
77381
+ {
77382
+ anonymous: false,
77383
+ inputs: [
77384
+ {
77385
+ indexed: true,
77386
+ internalType: "bytes32",
77387
+ name: "role",
77388
+ type: "bytes32"
77389
+ },
77390
+ {
77391
+ indexed: true,
77392
+ internalType: "bytes32",
77393
+ name: "previousAdminRole",
77394
+ type: "bytes32"
77395
+ },
77396
+ {
77397
+ indexed: true,
77398
+ internalType: "bytes32",
77399
+ name: "newAdminRole",
77400
+ type: "bytes32"
77401
+ }
77402
+ ],
77403
+ name: "RoleAdminChanged",
77404
+ type: "event"
77405
+ },
77406
+ {
77407
+ anonymous: false,
77408
+ inputs: [
77409
+ {
77410
+ indexed: true,
77411
+ internalType: "bytes32",
77412
+ name: "role",
77413
+ type: "bytes32"
77414
+ },
77415
+ {
77416
+ indexed: true,
77417
+ internalType: "address",
77418
+ name: "account",
77419
+ type: "address"
77420
+ },
77421
+ {
77422
+ indexed: true,
77423
+ internalType: "address",
77424
+ name: "sender",
77425
+ type: "address"
77426
+ }
77427
+ ],
77428
+ name: "RoleGranted",
77429
+ type: "event"
77430
+ },
77431
+ {
77432
+ anonymous: false,
77433
+ inputs: [
77434
+ {
77435
+ indexed: true,
77436
+ internalType: "bytes32",
77437
+ name: "role",
77438
+ type: "bytes32"
77439
+ },
77440
+ {
77441
+ indexed: true,
77442
+ internalType: "address",
77443
+ name: "account",
77444
+ type: "address"
77445
+ },
77446
+ {
77447
+ indexed: true,
77448
+ internalType: "address",
77449
+ name: "sender",
77450
+ type: "address"
77451
+ }
77452
+ ],
77453
+ name: "RoleRevoked",
77454
+ type: "event"
77455
+ },
77456
+ {
77457
+ anonymous: false,
77458
+ inputs: [
77459
+ {
77460
+ indexed: false,
77461
+ internalType: "uint256",
77462
+ name: "principalFee",
77463
+ type: "uint256"
77464
+ },
77465
+ {
77466
+ indexed: false,
77467
+ internalType: "uint256",
77468
+ name: "payoutFee",
77469
+ type: "uint256"
77470
+ }
77471
+ ],
77472
+ name: "SetFee",
77473
+ type: "event"
77474
+ },
77475
+ {
77476
+ anonymous: false,
77477
+ inputs: [
77478
+ {
77479
+ indexed: false,
77480
+ internalType: "bool",
77481
+ name: "_active",
77482
+ type: "bool"
77483
+ },
77484
+ {
77485
+ indexed: false,
77486
+ internalType: "address",
77487
+ name: "_pointsLens",
77488
+ type: "address"
77489
+ },
77490
+ {
77491
+ indexed: false,
77492
+ internalType: "address",
77493
+ name: "_authorizedSigner",
77494
+ type: "address"
77495
+ },
77496
+ {
77497
+ indexed: false,
77498
+ internalType: "uint256",
77499
+ name: "_minPoints",
77500
+ type: "uint256"
77501
+ }
77502
+ ],
77503
+ name: "SetTierAccessExtensionData",
77504
+ type: "event"
77505
+ },
77506
+ {
77507
+ anonymous: false,
77508
+ inputs: [
77509
+ {
77510
+ indexed: false,
77511
+ internalType: "bool",
77512
+ name: "_active",
77513
+ type: "bool"
77514
+ },
77515
+ {
77516
+ indexed: false,
77517
+ internalType: "address",
77518
+ name: "_pointsLens",
77519
+ type: "address"
77520
+ },
77521
+ {
77522
+ indexed: false,
77523
+ internalType: "address",
77524
+ name: "_authorizedSigner",
77525
+ type: "address"
77526
+ },
77527
+ {
77528
+ indexed: false,
77529
+ internalType: "uint256[]",
77530
+ name: "_points",
77531
+ type: "uint256[]"
77532
+ },
77533
+ {
77534
+ indexed: false,
77535
+ internalType: "uint256[]",
77536
+ name: "_extraDiscount",
77537
+ type: "uint256[]"
77538
+ }
77539
+ ],
77540
+ name: "SetTierBoostedDiscountExtensionData",
77541
+ type: "event"
77542
+ },
77543
+ {
77544
+ anonymous: false,
77545
+ inputs: [
77546
+ {
77547
+ indexed: false,
77548
+ internalType: "enum ApeBond.PARAMETER",
77549
+ name: "parameter",
77550
+ type: "uint8"
77551
+ },
77552
+ {
77553
+ indexed: false,
77554
+ internalType: "uint256",
77555
+ name: "input",
77556
+ type: "uint256"
77557
+ }
77558
+ ],
77559
+ name: "TermsSet",
77560
+ type: "event"
77561
+ },
77562
+ {
77563
+ anonymous: false,
77564
+ inputs: [
77565
+ {
77566
+ indexed: false,
77567
+ internalType: "address",
77568
+ name: "account",
77569
+ type: "address"
77570
+ }
77571
+ ],
77572
+ name: "Unpaused",
77573
+ type: "event"
77574
+ },
77575
+ {
77576
+ anonymous: false,
77577
+ inputs: [
77578
+ {
77579
+ indexed: true,
77580
+ internalType: "address",
77581
+ name: "owner",
77582
+ type: "address"
77583
+ },
77584
+ {
77585
+ indexed: true,
77586
+ internalType: "address",
77587
+ name: "approvedAccount",
77588
+ type: "address"
77589
+ },
77590
+ {
77591
+ indexed: false,
77592
+ internalType: "bool",
77593
+ name: "approved",
77594
+ type: "bool"
77595
+ }
77596
+ ],
77597
+ name: "UpdateClaimApproval",
77598
+ type: "event"
77599
+ },
77600
+ {
77601
+ inputs: [
77602
+ ],
77603
+ name: "AUTOMATION_ROLE",
77604
+ outputs: [
77605
+ {
77606
+ internalType: "bytes32",
77607
+ name: "",
77608
+ type: "bytes32"
77609
+ }
77610
+ ],
77611
+ stateMutability: "view",
77612
+ type: "function"
77613
+ },
77614
+ {
77615
+ inputs: [
77616
+ ],
77617
+ name: "DEFAULT_ADMIN_ROLE",
77618
+ outputs: [
77619
+ {
77620
+ internalType: "bytes32",
77621
+ name: "",
77622
+ type: "bytes32"
77623
+ }
77624
+ ],
77625
+ stateMutability: "view",
77626
+ type: "function"
77627
+ },
77628
+ {
77629
+ inputs: [
77630
+ ],
77631
+ name: "DOMAIN_SEPARATOR",
77632
+ outputs: [
77633
+ {
77634
+ internalType: "bytes32",
77635
+ name: "",
77636
+ type: "bytes32"
77637
+ }
77638
+ ],
77639
+ stateMutability: "view",
77640
+ type: "function"
77641
+ },
77642
+ {
77643
+ inputs: [
77644
+ ],
77645
+ name: "OPERATIONS_ROLE",
77646
+ outputs: [
77647
+ {
77648
+ internalType: "bytes32",
77649
+ name: "",
77650
+ type: "bytes32"
77651
+ }
77652
+ ],
77653
+ stateMutability: "view",
77654
+ type: "function"
77655
+ },
77656
+ {
77657
+ inputs: [
77658
+ ],
77659
+ name: "PERCENTAGE_BASE",
77660
+ outputs: [
77661
+ {
77662
+ internalType: "uint256",
77663
+ name: "",
77664
+ type: "uint256"
77665
+ }
77666
+ ],
77667
+ stateMutability: "view",
77668
+ type: "function"
77669
+ },
77670
+ {
77671
+ inputs: [
77672
+ ],
77673
+ name: "TIER_PROOF_TYPEHASH",
77674
+ outputs: [
77675
+ {
77676
+ internalType: "bytes32",
77677
+ name: "",
77678
+ type: "bytes32"
77679
+ }
77680
+ ],
77681
+ stateMutability: "view",
77682
+ type: "function"
77683
+ },
77684
+ {
77685
+ inputs: [
77686
+ ],
77687
+ name: "VERSION",
77688
+ outputs: [
77689
+ {
77690
+ internalType: "string",
77691
+ name: "",
77692
+ type: "string"
77693
+ }
77694
+ ],
77695
+ stateMutability: "view",
77696
+ type: "function"
77697
+ },
77698
+ {
77699
+ inputs: [
77700
+ ],
77701
+ name: "allIssuedBillIds",
77702
+ outputs: [
77703
+ {
77704
+ internalType: "uint256[]",
77705
+ name: "",
77706
+ type: "uint256[]"
77707
+ }
77708
+ ],
77709
+ stateMutability: "view",
77710
+ type: "function"
77711
+ },
77712
+ {
77713
+ inputs: [
77714
+ {
77715
+ internalType: "uint256[]",
77716
+ name: "_billIds",
77717
+ type: "uint256[]"
77718
+ }
77719
+ ],
77720
+ name: "batchClaim",
77721
+ outputs: [
77722
+ {
77723
+ internalType: "uint256",
77724
+ name: "payout",
77725
+ type: "uint256"
77726
+ }
77727
+ ],
77728
+ stateMutability: "nonpayable",
77729
+ type: "function"
77730
+ },
77731
+ {
77732
+ inputs: [
77733
+ {
77734
+ internalType: "uint256[]",
77735
+ name: "_billIds",
77736
+ type: "uint256[]"
77737
+ }
77738
+ ],
77739
+ name: "batchRedeem",
77740
+ outputs: [
77741
+ {
77742
+ internalType: "uint256",
77743
+ name: "payout",
77744
+ type: "uint256"
77745
+ }
77746
+ ],
77747
+ stateMutability: "nonpayable",
77748
+ type: "function"
77749
+ },
77750
+ {
77751
+ inputs: [
77752
+ {
77753
+ internalType: "uint256",
77754
+ name: "",
77755
+ type: "uint256"
77756
+ }
77757
+ ],
77758
+ name: "billInfo",
77759
+ outputs: [
77760
+ {
77761
+ internalType: "uint256",
77762
+ name: "payout",
77763
+ type: "uint256"
77764
+ },
77765
+ {
77766
+ internalType: "uint256",
77767
+ name: "payoutClaimed",
77768
+ type: "uint256"
77769
+ },
77770
+ {
77771
+ internalType: "uint256",
77772
+ name: "vesting",
77773
+ type: "uint256"
77774
+ },
77775
+ {
77776
+ internalType: "uint256",
77777
+ name: "vestingTerm",
77778
+ type: "uint256"
77779
+ },
77780
+ {
77781
+ internalType: "uint256",
77782
+ name: "vestingStartTimestamp",
77783
+ type: "uint256"
77784
+ },
77785
+ {
77786
+ internalType: "uint256",
77787
+ name: "lastClaimTimestamp",
77788
+ type: "uint256"
77789
+ },
77790
+ {
77791
+ internalType: "uint256",
77792
+ name: "truePricePaid",
77793
+ type: "uint256"
77794
+ }
77795
+ ],
77796
+ stateMutability: "view",
77797
+ type: "function"
77798
+ },
77799
+ {
77800
+ inputs: [
77801
+ ],
77802
+ name: "billNft",
77803
+ outputs: [
77804
+ {
77805
+ internalType: "contract IBondNft",
77806
+ name: "",
77807
+ type: "address"
77808
+ }
77809
+ ],
77810
+ stateMutability: "view",
77811
+ type: "function"
77812
+ },
77813
+ {
77814
+ inputs: [
77815
+ {
77816
+ internalType: "bytes",
77817
+ name: "_tierProofSignature",
77818
+ type: "bytes"
77819
+ },
77820
+ {
77821
+ internalType: "address",
77822
+ name: "_user",
77823
+ type: "address"
77824
+ }
77825
+ ],
77826
+ name: "billPrice",
77827
+ outputs: [
77828
+ {
77829
+ internalType: "uint256",
77830
+ name: "_price",
77831
+ type: "uint256"
77832
+ }
77833
+ ],
77834
+ stateMutability: "view",
77835
+ type: "function"
77836
+ },
77837
+ {
77838
+ inputs: [
77839
+ {
77840
+ internalType: "uint256",
77841
+ name: "_billId",
77842
+ type: "uint256"
77843
+ }
77844
+ ],
77845
+ name: "claim",
77846
+ outputs: [
77847
+ {
77848
+ internalType: "uint256",
77849
+ name: "",
77850
+ type: "uint256"
77851
+ }
77852
+ ],
77853
+ stateMutability: "nonpayable",
77854
+ type: "function"
77855
+ },
77856
+ {
77857
+ inputs: [
77858
+ {
77859
+ internalType: "uint256",
77860
+ name: "_billId",
77861
+ type: "uint256"
77862
+ }
77863
+ ],
77864
+ name: "claimablePayout",
77865
+ outputs: [
77866
+ {
77867
+ internalType: "uint256",
77868
+ name: "claimablePayout_",
77869
+ type: "uint256"
77870
+ }
77871
+ ],
77872
+ stateMutability: "view",
77873
+ type: "function"
77874
+ },
77875
+ {
77876
+ inputs: [
77877
+ ],
77878
+ name: "currentDebt",
77879
+ outputs: [
77880
+ {
77881
+ internalType: "uint256",
77882
+ name: "",
77883
+ type: "uint256"
77884
+ }
77885
+ ],
77886
+ stateMutability: "view",
77887
+ type: "function"
77888
+ },
77889
+ {
77890
+ inputs: [
77891
+ ],
77892
+ name: "customTreasury",
77893
+ outputs: [
77894
+ {
77895
+ internalType: "contract IBondTreasury",
77896
+ name: "",
77897
+ type: "address"
77898
+ }
77899
+ ],
77900
+ stateMutability: "view",
77901
+ type: "function"
77902
+ },
77903
+ {
77904
+ inputs: [
77905
+ ],
77906
+ name: "debtDecay",
77907
+ outputs: [
77908
+ {
77909
+ internalType: "uint256",
77910
+ name: "decay_",
77911
+ type: "uint256"
77912
+ }
77913
+ ],
77914
+ stateMutability: "view",
77915
+ type: "function"
77916
+ },
77917
+ {
77918
+ inputs: [
77919
+ ],
77920
+ name: "debtRatio",
77921
+ outputs: [
77922
+ {
77923
+ internalType: "uint256",
77924
+ name: "debtRatio_",
77925
+ type: "uint256"
77926
+ }
77927
+ ],
77928
+ stateMutability: "view",
77929
+ type: "function"
77930
+ },
77931
+ {
77932
+ inputs: [
77933
+ {
77934
+ internalType: "uint256",
77935
+ name: "_amount",
77936
+ type: "uint256"
77937
+ },
77938
+ {
77939
+ internalType: "uint256",
77940
+ name: "_maxPrice",
77941
+ type: "uint256"
77942
+ },
77943
+ {
77944
+ internalType: "address",
77945
+ name: "_depositor",
77946
+ type: "address"
77947
+ },
77948
+ {
77949
+ internalType: "bytes",
77950
+ name: "_tierProofSignature",
77951
+ type: "bytes"
77952
+ }
77953
+ ],
77954
+ name: "deposit",
77955
+ outputs: [
77956
+ {
77957
+ internalType: "uint256",
77958
+ name: "",
77959
+ type: "uint256"
77960
+ }
77961
+ ],
77962
+ stateMutability: "nonpayable",
77963
+ type: "function"
77964
+ },
77965
+ {
77966
+ inputs: [
77967
+ ],
77968
+ name: "feeInPayout",
77969
+ outputs: [
77970
+ {
77971
+ internalType: "uint256",
77972
+ name: "",
77973
+ type: "uint256"
77974
+ }
77975
+ ],
77976
+ stateMutability: "view",
77977
+ type: "function"
77978
+ },
77979
+ {
77980
+ inputs: [
77981
+ ],
77982
+ name: "feeInPayoutRecipient",
77983
+ outputs: [
77984
+ {
77985
+ internalType: "address",
77986
+ name: "",
77987
+ type: "address"
77988
+ }
77989
+ ],
77990
+ stateMutability: "view",
77991
+ type: "function"
77992
+ },
77993
+ {
77994
+ inputs: [
77995
+ ],
77996
+ name: "feeInPrincipal",
77997
+ outputs: [
77998
+ {
77999
+ internalType: "uint256",
78000
+ name: "",
78001
+ type: "uint256"
78002
+ }
78003
+ ],
78004
+ stateMutability: "view",
78005
+ type: "function"
78006
+ },
78007
+ {
78008
+ inputs: [
78009
+ ],
78010
+ name: "feeInPrincipalRecipient",
78011
+ outputs: [
78012
+ {
78013
+ internalType: "address",
78014
+ name: "",
78015
+ type: "address"
78016
+ }
78017
+ ],
78018
+ stateMutability: "view",
78019
+ type: "function"
78020
+ },
78021
+ {
78022
+ inputs: [
78023
+ {
78024
+ internalType: "address",
78025
+ name: "user",
78026
+ type: "address"
78027
+ }
78028
+ ],
78029
+ name: "getBillIds",
78030
+ outputs: [
78031
+ {
78032
+ internalType: "uint256[]",
78033
+ name: "",
78034
+ type: "uint256[]"
78035
+ }
78036
+ ],
78037
+ stateMutability: "view",
78038
+ type: "function"
78039
+ },
78040
+ {
78041
+ inputs: [
78042
+ {
78043
+ internalType: "address",
78044
+ name: "user",
78045
+ type: "address"
78046
+ },
78047
+ {
78048
+ internalType: "uint256",
78049
+ name: "start",
78050
+ type: "uint256"
78051
+ },
78052
+ {
78053
+ internalType: "uint256",
78054
+ name: "end",
78055
+ type: "uint256"
78056
+ }
78057
+ ],
78058
+ name: "getBillIdsInRange",
78059
+ outputs: [
78060
+ {
78061
+ internalType: "uint256[]",
78062
+ name: "",
78063
+ type: "uint256[]"
78064
+ }
78065
+ ],
78066
+ stateMutability: "view",
78067
+ type: "function"
78068
+ },
78069
+ {
78070
+ inputs: [
78071
+ {
78072
+ internalType: "uint256",
78073
+ name: "billId",
78074
+ type: "uint256"
78075
+ }
78076
+ ],
78077
+ name: "getBillInfo",
78078
+ outputs: [
78079
+ {
78080
+ components: [
78081
+ {
78082
+ internalType: "uint256",
78083
+ name: "payout",
78084
+ type: "uint256"
78085
+ },
78086
+ {
78087
+ internalType: "uint256",
78088
+ name: "payoutClaimed",
78089
+ type: "uint256"
78090
+ },
78091
+ {
78092
+ internalType: "uint256",
78093
+ name: "vesting",
78094
+ type: "uint256"
78095
+ },
78096
+ {
78097
+ internalType: "uint256",
78098
+ name: "vestingTerm",
78099
+ type: "uint256"
78100
+ },
78101
+ {
78102
+ internalType: "uint256",
78103
+ name: "vestingStartTimestamp",
78104
+ type: "uint256"
78105
+ },
78106
+ {
78107
+ internalType: "uint256",
78108
+ name: "lastClaimTimestamp",
78109
+ type: "uint256"
78110
+ },
78111
+ {
78112
+ internalType: "uint256",
78113
+ name: "truePricePaid",
78114
+ type: "uint256"
78115
+ }
78116
+ ],
78117
+ internalType: "struct IApeBond.Bill",
78118
+ name: "",
78119
+ type: "tuple"
78120
+ }
78121
+ ],
78122
+ stateMutability: "view",
78123
+ type: "function"
78124
+ },
78125
+ {
78126
+ inputs: [
78127
+ ],
78128
+ name: "getMaxTotalPayout",
78129
+ outputs: [
78130
+ {
78131
+ internalType: "uint256",
78132
+ name: "",
78133
+ type: "uint256"
78134
+ }
78135
+ ],
78136
+ stateMutability: "view",
78137
+ type: "function"
78138
+ },
78139
+ {
78140
+ inputs: [
78141
+ {
78142
+ internalType: "bytes32",
78143
+ name: "role",
78144
+ type: "bytes32"
78145
+ }
78146
+ ],
78147
+ name: "getRoleAdmin",
78148
+ outputs: [
78149
+ {
78150
+ internalType: "bytes32",
78151
+ name: "",
78152
+ type: "bytes32"
78153
+ }
78154
+ ],
78155
+ stateMutability: "view",
78156
+ type: "function"
78157
+ },
78158
+ {
78159
+ inputs: [
78160
+ {
78161
+ internalType: "bytes32",
78162
+ name: "role",
78163
+ type: "bytes32"
78164
+ },
78165
+ {
78166
+ internalType: "uint256",
78167
+ name: "index",
78168
+ type: "uint256"
78169
+ }
78170
+ ],
78171
+ name: "getRoleMember",
78172
+ outputs: [
78173
+ {
78174
+ internalType: "address",
78175
+ name: "",
78176
+ type: "address"
78177
+ }
78178
+ ],
78179
+ stateMutability: "view",
78180
+ type: "function"
78181
+ },
78182
+ {
78183
+ inputs: [
78184
+ {
78185
+ internalType: "bytes32",
78186
+ name: "role",
78187
+ type: "bytes32"
78188
+ }
78189
+ ],
78190
+ name: "getRoleMemberCount",
78191
+ outputs: [
78192
+ {
78193
+ internalType: "uint256",
78194
+ name: "",
78195
+ type: "uint256"
78196
+ }
78197
+ ],
78198
+ stateMutability: "view",
78199
+ type: "function"
78200
+ },
78201
+ {
78202
+ inputs: [
78203
+ {
78204
+ internalType: "bytes32",
78205
+ name: "role",
78206
+ type: "bytes32"
78207
+ },
78208
+ {
78209
+ internalType: "address",
78210
+ name: "account",
78211
+ type: "address"
78212
+ }
78213
+ ],
78214
+ name: "grantRole",
78215
+ outputs: [
78216
+ ],
78217
+ stateMutability: "nonpayable",
78218
+ type: "function"
78219
+ },
78220
+ {
78221
+ inputs: [
78222
+ {
78223
+ internalType: "bytes32",
78224
+ name: "role",
78225
+ type: "bytes32"
78226
+ },
78227
+ {
78228
+ internalType: "address",
78229
+ name: "account",
78230
+ type: "address"
78231
+ }
78232
+ ],
78233
+ name: "hasRole",
78234
+ outputs: [
78235
+ {
78236
+ internalType: "bool",
78237
+ name: "",
78238
+ type: "bool"
78239
+ }
78240
+ ],
78241
+ stateMutability: "view",
78242
+ type: "function"
78243
+ },
78244
+ {
78245
+ inputs: [
78246
+ {
78247
+ internalType: "address",
78248
+ name: "_user",
78249
+ type: "address"
78250
+ },
78251
+ {
78252
+ internalType: "bytes",
78253
+ name: "_tierProofSignature",
78254
+ type: "bytes"
78255
+ }
78256
+ ],
78257
+ name: "hasTierAccess",
78258
+ outputs: [
78259
+ {
78260
+ internalType: "bool",
78261
+ name: "",
78262
+ type: "bool"
78263
+ }
78264
+ ],
78265
+ stateMutability: "view",
78266
+ type: "function"
78267
+ },
78268
+ {
78269
+ inputs: [
78270
+ {
78271
+ internalType: "contract IBondTreasury",
78272
+ name: "_customTreasury",
78273
+ type: "address"
78274
+ },
78275
+ {
78276
+ components: [
78277
+ {
78278
+ internalType: "address",
78279
+ name: "payoutToken",
78280
+ type: "address"
78281
+ },
78282
+ {
78283
+ internalType: "address",
78284
+ name: "principalToken",
78285
+ type: "address"
78286
+ },
78287
+ {
78288
+ internalType: "address",
78289
+ name: "initialOwner",
78290
+ type: "address"
78291
+ },
78292
+ {
78293
+ internalType: "contract IVestingCurve",
78294
+ name: "vestingCurve",
78295
+ type: "address"
78296
+ },
78297
+ {
78298
+ internalType: "uint256",
78299
+ name: "feeInPrincipal",
78300
+ type: "uint256"
78301
+ },
78302
+ {
78303
+ internalType: "uint256",
78304
+ name: "feeInPayout",
78305
+ type: "uint256"
78306
+ }
78307
+ ],
78308
+ internalType: "struct IApeBond.BondCreationDetails",
78309
+ name: "_billCreationDetails",
78310
+ type: "tuple"
78311
+ },
78312
+ {
78313
+ components: [
78314
+ {
78315
+ internalType: "uint256",
78316
+ name: "controlVariable",
78317
+ type: "uint256"
78318
+ },
78319
+ {
78320
+ internalType: "uint256",
78321
+ name: "vestingTerm",
78322
+ type: "uint256"
78323
+ },
78324
+ {
78325
+ internalType: "uint256",
78326
+ name: "minimumPrice",
78327
+ type: "uint256"
78328
+ },
78329
+ {
78330
+ internalType: "uint256",
78331
+ name: "maxPayout",
78332
+ type: "uint256"
78333
+ },
78334
+ {
78335
+ internalType: "uint256",
78336
+ name: "maxDebt",
78337
+ type: "uint256"
78338
+ },
78339
+ {
78340
+ internalType: "uint256",
78341
+ name: "maxTotalPayout",
78342
+ type: "uint256"
78343
+ },
78344
+ {
78345
+ internalType: "uint256",
78346
+ name: "initialDebt",
78347
+ type: "uint256"
78348
+ }
78349
+ ],
78350
+ internalType: "struct IApeBond.BondTerms",
78351
+ name: "_billTerms",
78352
+ type: "tuple"
78353
+ },
78354
+ {
78355
+ components: [
78356
+ {
78357
+ internalType: "address",
78358
+ name: "feeInPrincipalRecipient",
78359
+ type: "address"
78360
+ },
78361
+ {
78362
+ internalType: "address",
78363
+ name: "feeInPayoutRecipient",
78364
+ type: "address"
78365
+ },
78366
+ {
78367
+ internalType: "address",
78368
+ name: "automationAddress",
78369
+ type: "address"
78370
+ },
78371
+ {
78372
+ internalType: "address",
78373
+ name: "billNft",
78374
+ type: "address"
78375
+ }
78376
+ ],
78377
+ internalType: "struct IApeBond.BondAccounts",
78378
+ name: "_billAccounts",
78379
+ type: "tuple"
78380
+ },
78381
+ {
78382
+ internalType: "address[]",
78383
+ name: "_billOperators",
78384
+ type: "address[]"
78385
+ }
78386
+ ],
78387
+ name: "initialize",
78388
+ outputs: [
78389
+ ],
78390
+ stateMutability: "nonpayable",
78391
+ type: "function"
78392
+ },
78393
+ {
78394
+ inputs: [
78395
+ ],
78396
+ name: "lastBCVUpdateTimestamp",
78397
+ outputs: [
78398
+ {
78399
+ internalType: "uint256",
78400
+ name: "",
78401
+ type: "uint256"
78402
+ }
78403
+ ],
78404
+ stateMutability: "view",
78405
+ type: "function"
78406
+ },
78407
+ {
78408
+ inputs: [
78409
+ ],
78410
+ name: "lastDecay",
78411
+ outputs: [
78412
+ {
78413
+ internalType: "uint256",
78414
+ name: "",
78415
+ type: "uint256"
78416
+ }
78417
+ ],
78418
+ stateMutability: "view",
78419
+ type: "function"
78420
+ },
78421
+ {
78422
+ inputs: [
78423
+ ],
78424
+ name: "maxPayout",
78425
+ outputs: [
78426
+ {
78427
+ internalType: "uint256",
78428
+ name: "",
78429
+ type: "uint256"
78430
+ }
78431
+ ],
78432
+ stateMutability: "view",
78433
+ type: "function"
78434
+ },
78435
+ {
78436
+ inputs: [
78437
+ ],
78438
+ name: "minBCVUpdateInterval",
78439
+ outputs: [
78440
+ {
78441
+ internalType: "uint256",
78442
+ name: "",
78443
+ type: "uint256"
78444
+ }
78445
+ ],
78446
+ stateMutability: "view",
78447
+ type: "function"
78448
+ },
78449
+ {
78450
+ inputs: [
78451
+ ],
78452
+ name: "owner",
78453
+ outputs: [
78454
+ {
78455
+ internalType: "address",
78456
+ name: "",
78457
+ type: "address"
78458
+ }
78459
+ ],
78460
+ stateMutability: "view",
78461
+ type: "function"
78462
+ },
78463
+ {
78464
+ inputs: [
78465
+ ],
78466
+ name: "pause",
78467
+ outputs: [
78468
+ ],
78469
+ stateMutability: "nonpayable",
78470
+ type: "function"
78471
+ },
78472
+ {
78473
+ inputs: [
78474
+ ],
78475
+ name: "paused",
78476
+ outputs: [
78477
+ {
78478
+ internalType: "bool",
78479
+ name: "",
78480
+ type: "bool"
78481
+ }
78482
+ ],
78483
+ stateMutability: "view",
78484
+ type: "function"
78485
+ },
78486
+ {
78487
+ inputs: [
78488
+ {
78489
+ internalType: "uint256",
78490
+ name: "_amount",
78491
+ type: "uint256"
78492
+ },
78493
+ {
78494
+ internalType: "bytes",
78495
+ name: "_tierProofSignature",
78496
+ type: "bytes"
78497
+ },
78498
+ {
78499
+ internalType: "address",
78500
+ name: "_user",
78501
+ type: "address"
78502
+ }
78503
+ ],
78504
+ name: "payoutFor",
78505
+ outputs: [
78506
+ {
78507
+ internalType: "uint256",
78508
+ name: "_payout",
78509
+ type: "uint256"
78510
+ },
78511
+ {
78512
+ internalType: "uint256",
78513
+ name: "_feeInPrincipalAmount",
78514
+ type: "uint256"
78515
+ },
78516
+ {
78517
+ internalType: "uint256",
78518
+ name: "_feeInPayoutAmount",
78519
+ type: "uint256"
78520
+ }
78521
+ ],
78522
+ stateMutability: "view",
78523
+ type: "function"
78524
+ },
78525
+ {
78526
+ inputs: [
78527
+ {
78528
+ internalType: "uint256",
78529
+ name: "_amount",
78530
+ type: "uint256"
78531
+ }
78532
+ ],
78533
+ name: "payoutFor",
78534
+ outputs: [
78535
+ {
78536
+ internalType: "uint256",
78537
+ name: "_payout",
78538
+ type: "uint256"
78539
+ },
78540
+ {
78541
+ internalType: "uint256",
78542
+ name: "_feeInPrincipalAmount",
78543
+ type: "uint256"
78544
+ },
78545
+ {
78546
+ internalType: "uint256",
78547
+ name: "_feeInPayoutAmount",
78548
+ type: "uint256"
78549
+ }
78550
+ ],
78551
+ stateMutability: "view",
78552
+ type: "function"
78553
+ },
78554
+ {
78555
+ inputs: [
78556
+ ],
78557
+ name: "payoutToken",
78558
+ outputs: [
78559
+ {
78560
+ internalType: "contract IERC20MetadataUpgradeable",
78561
+ name: "",
78562
+ type: "address"
78563
+ }
78564
+ ],
78565
+ stateMutability: "view",
78566
+ type: "function"
78567
+ },
78568
+ {
78569
+ inputs: [
78570
+ ],
78571
+ name: "payoutTokenInitialSupply",
78572
+ outputs: [
78573
+ {
78574
+ internalType: "uint256",
78575
+ name: "",
78576
+ type: "uint256"
78577
+ }
78578
+ ],
78579
+ stateMutability: "view",
78580
+ type: "function"
78581
+ },
78582
+ {
78583
+ inputs: [
78584
+ {
78585
+ internalType: "uint256",
78586
+ name: "_billId",
78587
+ type: "uint256"
78588
+ }
78589
+ ],
78590
+ name: "pendingPayout",
78591
+ outputs: [
78592
+ {
78593
+ internalType: "uint256",
78594
+ name: "pendingPayout_",
78595
+ type: "uint256"
78596
+ }
78597
+ ],
78598
+ stateMutability: "view",
78599
+ type: "function"
78600
+ },
78601
+ {
78602
+ inputs: [
78603
+ {
78604
+ internalType: "uint256",
78605
+ name: "_billId",
78606
+ type: "uint256"
78607
+ }
78608
+ ],
78609
+ name: "pendingVesting",
78610
+ outputs: [
78611
+ {
78612
+ internalType: "uint256",
78613
+ name: "pendingVesting_",
78614
+ type: "uint256"
78615
+ }
78616
+ ],
78617
+ stateMutability: "view",
78618
+ type: "function"
78619
+ },
78620
+ {
78621
+ inputs: [
78622
+ ],
78623
+ name: "principalToken",
78624
+ outputs: [
78625
+ {
78626
+ internalType: "contract IERC20MetadataUpgradeable",
78627
+ name: "",
78628
+ type: "address"
78629
+ }
78630
+ ],
78631
+ stateMutability: "view",
78632
+ type: "function"
78633
+ },
78634
+ {
78635
+ inputs: [
78636
+ {
78637
+ internalType: "uint256",
78638
+ name: "_billId",
78639
+ type: "uint256"
78640
+ }
78641
+ ],
78642
+ name: "redeem",
78643
+ outputs: [
78644
+ {
78645
+ internalType: "uint256",
78646
+ name: "",
78647
+ type: "uint256"
78648
+ }
78649
+ ],
78650
+ stateMutability: "nonpayable",
78651
+ type: "function"
78652
+ },
78653
+ {
78654
+ inputs: [
78655
+ {
78656
+ internalType: "address",
78657
+ name: "",
78658
+ type: "address"
78659
+ },
78660
+ {
78661
+ internalType: "address",
78662
+ name: "",
78663
+ type: "address"
78664
+ }
78665
+ ],
78666
+ name: "redeemerApproved",
78667
+ outputs: [
78668
+ {
78669
+ internalType: "bool",
78670
+ name: "",
78671
+ type: "bool"
78672
+ }
78673
+ ],
78674
+ stateMutability: "view",
78675
+ type: "function"
78676
+ },
78677
+ {
78678
+ inputs: [
78679
+ ],
78680
+ name: "renounceOwnership",
78681
+ outputs: [
78682
+ ],
78683
+ stateMutability: "nonpayable",
78684
+ type: "function"
78685
+ },
78686
+ {
78687
+ inputs: [
78688
+ {
78689
+ internalType: "bytes32",
78690
+ name: "role",
78691
+ type: "bytes32"
78692
+ },
78693
+ {
78694
+ internalType: "address",
78695
+ name: "account",
78696
+ type: "address"
78697
+ }
78698
+ ],
78699
+ name: "renounceRole",
78700
+ outputs: [
78701
+ ],
78702
+ stateMutability: "nonpayable",
78703
+ type: "function"
78704
+ },
78705
+ {
78706
+ inputs: [
78707
+ {
78708
+ internalType: "bytes32",
78709
+ name: "role",
78710
+ type: "bytes32"
78711
+ },
78712
+ {
78713
+ internalType: "address",
78714
+ name: "account",
78715
+ type: "address"
78716
+ }
78717
+ ],
78718
+ name: "revokeRole",
78719
+ outputs: [
78720
+ ],
78721
+ stateMutability: "nonpayable",
78722
+ type: "function"
78723
+ },
78724
+ {
78725
+ inputs: [
78726
+ {
78727
+ internalType: "uint256",
78728
+ name: "_target",
78729
+ type: "uint256"
78730
+ }
78731
+ ],
78732
+ name: "setBCV",
78733
+ outputs: [
78734
+ ],
78735
+ stateMutability: "nonpayable",
78736
+ type: "function"
78737
+ },
78738
+ {
78739
+ inputs: [
78740
+ {
78741
+ internalType: "uint256",
78742
+ name: "_newBCVUpdateInterval",
78743
+ type: "uint256"
78744
+ }
78745
+ ],
78746
+ name: "setBCVUpdateInterval",
78747
+ outputs: [
78748
+ ],
78749
+ stateMutability: "nonpayable",
78750
+ type: "function"
78751
+ },
78752
+ {
78753
+ inputs: [
78754
+ {
78755
+ internalType: "enum ApeBond.PARAMETER",
78756
+ name: "_parameter",
78757
+ type: "uint8"
78758
+ },
78759
+ {
78760
+ internalType: "uint256",
78761
+ name: "_input",
78762
+ type: "uint256"
78763
+ }
78764
+ ],
78765
+ name: "setBondTerms",
78766
+ outputs: [
78767
+ ],
78768
+ stateMutability: "nonpayable",
78769
+ type: "function"
78770
+ },
78771
+ {
78772
+ inputs: [
78773
+ {
78774
+ internalType: "address",
78775
+ name: "approvedAccount",
78776
+ type: "address"
78777
+ },
78778
+ {
78779
+ internalType: "bool",
78780
+ name: "approved",
78781
+ type: "bool"
78782
+ }
78783
+ ],
78784
+ name: "setClaimApproval",
78785
+ outputs: [
78786
+ ],
78787
+ stateMutability: "nonpayable",
78788
+ type: "function"
78789
+ },
78790
+ {
78791
+ inputs: [
78792
+ {
78793
+ internalType: "uint256",
78794
+ name: "_feeInPrincipal",
78795
+ type: "uint256"
78796
+ },
78797
+ {
78798
+ internalType: "uint256",
78799
+ name: "_feeInPayout",
78800
+ type: "uint256"
78801
+ }
78802
+ ],
78803
+ name: "setFee",
78804
+ outputs: [
78805
+ ],
78806
+ stateMutability: "nonpayable",
78807
+ type: "function"
78808
+ },
78809
+ {
78810
+ inputs: [
78811
+ {
78812
+ internalType: "address",
78813
+ name: "_feeInPrincipalRecipient",
78814
+ type: "address"
78815
+ },
78816
+ {
78817
+ internalType: "address",
78818
+ name: "_feeInPayoutRecipient",
78819
+ type: "address"
78820
+ }
78821
+ ],
78822
+ name: "setFeeRecipients",
78823
+ outputs: [
78824
+ ],
78825
+ stateMutability: "nonpayable",
78826
+ type: "function"
78827
+ },
78828
+ {
78829
+ inputs: [
78830
+ {
78831
+ internalType: "uint256",
78832
+ name: "_maxTotalPayout",
78833
+ type: "uint256"
78834
+ }
78835
+ ],
78836
+ name: "setMaxTotalPayout",
78837
+ outputs: [
78838
+ ],
78839
+ stateMutability: "nonpayable",
78840
+ type: "function"
78841
+ },
78842
+ {
78843
+ inputs: [
78844
+ {
78845
+ internalType: "uint256",
78846
+ name: "_target",
78847
+ type: "uint256"
78848
+ }
78849
+ ],
78850
+ name: "setMinPrice",
78851
+ outputs: [
78852
+ ],
78853
+ stateMutability: "nonpayable",
78854
+ type: "function"
78855
+ },
78856
+ {
78857
+ inputs: [
78858
+ {
78859
+ internalType: "bool",
78860
+ name: "_active",
78861
+ type: "bool"
78862
+ },
78863
+ {
78864
+ internalType: "address",
78865
+ name: "_pointsLens",
78866
+ type: "address"
78867
+ },
78868
+ {
78869
+ internalType: "address",
78870
+ name: "_authorizedSigner",
78871
+ type: "address"
78872
+ },
78873
+ {
78874
+ internalType: "uint256",
78875
+ name: "_minPoints",
78876
+ type: "uint256"
78877
+ }
78878
+ ],
78879
+ name: "setTierAccessExtensionData",
78880
+ outputs: [
78881
+ ],
78882
+ stateMutability: "nonpayable",
78883
+ type: "function"
78884
+ },
78885
+ {
78886
+ inputs: [
78887
+ {
78888
+ internalType: "bool",
78889
+ name: "_active",
78890
+ type: "bool"
78891
+ },
78892
+ {
78893
+ internalType: "address",
78894
+ name: "_pointsLens",
78895
+ type: "address"
78896
+ },
78897
+ {
78898
+ internalType: "address",
78899
+ name: "_authorizedSigner",
78900
+ type: "address"
78901
+ },
78902
+ {
78903
+ internalType: "uint256[]",
78904
+ name: "_points",
78905
+ type: "uint256[]"
78906
+ },
78907
+ {
78908
+ internalType: "uint256[]",
78909
+ name: "_extraDiscount",
78910
+ type: "uint256[]"
78911
+ }
78912
+ ],
78913
+ name: "setTierBoostedDiscountExtensionData",
78914
+ outputs: [
78915
+ ],
78916
+ stateMutability: "nonpayable",
78917
+ type: "function"
78918
+ },
78919
+ {
78920
+ inputs: [
78921
+ {
78922
+ internalType: "bytes4",
78923
+ name: "interfaceId",
78924
+ type: "bytes4"
78925
+ }
78926
+ ],
78927
+ name: "supportsInterface",
78928
+ outputs: [
78929
+ {
78930
+ internalType: "bool",
78931
+ name: "",
78932
+ type: "bool"
78933
+ }
78934
+ ],
78935
+ stateMutability: "view",
78936
+ type: "function"
78937
+ },
78938
+ {
78939
+ inputs: [
78940
+ ],
78941
+ name: "terms",
78942
+ outputs: [
78943
+ {
78944
+ internalType: "uint256",
78945
+ name: "controlVariable",
78946
+ type: "uint256"
78947
+ },
78948
+ {
78949
+ internalType: "uint256",
78950
+ name: "vestingTerm",
78951
+ type: "uint256"
78952
+ },
78953
+ {
78954
+ internalType: "uint256",
78955
+ name: "minimumPrice",
78956
+ type: "uint256"
78957
+ },
78958
+ {
78959
+ internalType: "uint256",
78960
+ name: "maxPayout",
78961
+ type: "uint256"
78962
+ },
78963
+ {
78964
+ internalType: "uint256",
78965
+ name: "maxDebt",
78966
+ type: "uint256"
78967
+ },
78968
+ {
78969
+ internalType: "uint256",
78970
+ name: "maxTotalPayout",
78971
+ type: "uint256"
78972
+ },
78973
+ {
78974
+ internalType: "uint256",
78975
+ name: "initialDebt",
78976
+ type: "uint256"
78977
+ }
78978
+ ],
78979
+ stateMutability: "view",
78980
+ type: "function"
78981
+ },
78982
+ {
78983
+ inputs: [
78984
+ ],
78985
+ name: "tierAccessExtensionData",
78986
+ outputs: [
78987
+ {
78988
+ internalType: "bool",
78989
+ name: "active",
78990
+ type: "bool"
78991
+ },
78992
+ {
78993
+ internalType: "address",
78994
+ name: "pointsLens",
78995
+ type: "address"
78996
+ },
78997
+ {
78998
+ internalType: "uint256",
78999
+ name: "minPoints",
79000
+ type: "uint256"
79001
+ },
79002
+ {
79003
+ internalType: "address",
79004
+ name: "authorizedSigner",
79005
+ type: "address"
79006
+ }
79007
+ ],
79008
+ stateMutability: "view",
79009
+ type: "function"
79010
+ },
79011
+ {
79012
+ inputs: [
79013
+ {
79014
+ internalType: "address",
79015
+ name: "_user",
79016
+ type: "address"
79017
+ },
79018
+ {
79019
+ internalType: "bytes",
79020
+ name: "_tierProofSignature",
79021
+ type: "bytes"
79022
+ }
79023
+ ],
79024
+ name: "tierBoostedDiscount",
79025
+ outputs: [
79026
+ {
79027
+ internalType: "uint256",
79028
+ name: "discount",
79029
+ type: "uint256"
79030
+ }
79031
+ ],
79032
+ stateMutability: "view",
79033
+ type: "function"
79034
+ },
79035
+ {
79036
+ inputs: [
79037
+ ],
79038
+ name: "tierBoostedDiscountExtensionData",
79039
+ outputs: [
79040
+ {
79041
+ internalType: "bool",
79042
+ name: "active",
79043
+ type: "bool"
79044
+ },
79045
+ {
79046
+ internalType: "address",
79047
+ name: "pointsLens",
79048
+ type: "address"
79049
+ },
79050
+ {
79051
+ internalType: "address",
79052
+ name: "authorizedSigner",
79053
+ type: "address"
79054
+ }
79055
+ ],
79056
+ stateMutability: "view",
79057
+ type: "function"
79058
+ },
79059
+ {
79060
+ inputs: [
79061
+ ],
79062
+ name: "totalDebt",
79063
+ outputs: [
79064
+ {
79065
+ internalType: "uint256",
79066
+ name: "",
79067
+ type: "uint256"
79068
+ }
79069
+ ],
79070
+ stateMutability: "view",
79071
+ type: "function"
79072
+ },
79073
+ {
79074
+ inputs: [
79075
+ ],
79076
+ name: "totalPayoutGiven",
79077
+ outputs: [
79078
+ {
79079
+ internalType: "uint256",
79080
+ name: "",
79081
+ type: "uint256"
79082
+ }
79083
+ ],
79084
+ stateMutability: "view",
79085
+ type: "function"
79086
+ },
79087
+ {
79088
+ inputs: [
79089
+ ],
79090
+ name: "totalPrincipalBilled",
79091
+ outputs: [
79092
+ {
79093
+ internalType: "uint256",
79094
+ name: "",
79095
+ type: "uint256"
79096
+ }
79097
+ ],
79098
+ stateMutability: "view",
79099
+ type: "function"
79100
+ },
79101
+ {
79102
+ inputs: [
79103
+ {
79104
+ internalType: "address",
79105
+ name: "newOwner",
79106
+ type: "address"
79107
+ }
79108
+ ],
79109
+ name: "transferOwnership",
79110
+ outputs: [
79111
+ ],
79112
+ stateMutability: "nonpayable",
79113
+ type: "function"
79114
+ },
79115
+ {
79116
+ inputs: [
79117
+ {
79118
+ internalType: "address",
79119
+ name: "_token",
79120
+ type: "address"
79121
+ },
79122
+ {
79123
+ internalType: "uint256",
79124
+ name: "_amount",
79125
+ type: "uint256"
79126
+ }
79127
+ ],
79128
+ name: "transferStuckToken",
79129
+ outputs: [
79130
+ ],
79131
+ stateMutability: "nonpayable",
79132
+ type: "function"
79133
+ },
79134
+ {
79135
+ inputs: [
79136
+ {
79137
+ internalType: "bytes",
79138
+ name: "_tierProofSignature",
79139
+ type: "bytes"
79140
+ },
79141
+ {
79142
+ internalType: "address",
79143
+ name: "_user",
79144
+ type: "address"
79145
+ }
79146
+ ],
79147
+ name: "trueBillPrice",
79148
+ outputs: [
79149
+ {
79150
+ internalType: "uint256",
79151
+ name: "price_",
79152
+ type: "uint256"
79153
+ }
79154
+ ],
79155
+ stateMutability: "view",
79156
+ type: "function"
79157
+ },
79158
+ {
79159
+ inputs: [
79160
+ ],
79161
+ name: "trueBillPrice",
79162
+ outputs: [
79163
+ {
79164
+ internalType: "uint256",
79165
+ name: "price_",
79166
+ type: "uint256"
79167
+ }
79168
+ ],
79169
+ stateMutability: "view",
79170
+ type: "function"
79171
+ },
79172
+ {
79173
+ inputs: [
79174
+ ],
79175
+ name: "trueBondPrices",
79176
+ outputs: [
79177
+ {
79178
+ components: [
79179
+ {
79180
+ internalType: "uint256",
79181
+ name: "trueBondPrice",
79182
+ type: "uint256"
79183
+ },
79184
+ {
79185
+ internalType: "uint256",
79186
+ name: "extraDiscount",
79187
+ type: "uint256"
79188
+ },
79189
+ {
79190
+ internalType: "uint256",
79191
+ name: "points",
79192
+ type: "uint256"
79193
+ }
79194
+ ],
79195
+ internalType: "struct ApeBond.TrueBondPricePerTier[]",
79196
+ name: "_trueBondPricePerTier",
79197
+ type: "tuple[]"
79198
+ }
79199
+ ],
79200
+ stateMutability: "view",
79201
+ type: "function"
79202
+ },
79203
+ {
79204
+ inputs: [
79205
+ ],
79206
+ name: "unpause",
79207
+ outputs: [
79208
+ ],
79209
+ stateMutability: "nonpayable",
79210
+ type: "function"
79211
+ },
79212
+ {
79213
+ inputs: [
79214
+ ],
79215
+ name: "userBillIds",
79216
+ outputs: [
79217
+ {
79218
+ internalType: "uint256[]",
79219
+ name: "",
79220
+ type: "uint256[]"
79221
+ }
79222
+ ],
79223
+ stateMutability: "view",
79224
+ type: "function"
79225
+ },
79226
+ {
79227
+ inputs: [
79228
+ {
79229
+ internalType: "uint256",
79230
+ name: "_billId",
79231
+ type: "uint256"
79232
+ },
79233
+ {
79234
+ internalType: "uint256",
79235
+ name: "_timestamp",
79236
+ type: "uint256"
79237
+ }
79238
+ ],
79239
+ name: "vestedPayoutAtTime",
79240
+ outputs: [
79241
+ {
79242
+ internalType: "uint256",
79243
+ name: "vestedPayout_",
79244
+ type: "uint256"
79245
+ }
79246
+ ],
79247
+ stateMutability: "view",
79248
+ type: "function"
79249
+ },
79250
+ {
79251
+ inputs: [
79252
+ ],
79253
+ name: "vestingCurve",
79254
+ outputs: [
79255
+ {
79256
+ internalType: "contract IVestingCurve",
79257
+ name: "",
79258
+ type: "address"
79259
+ }
79260
+ ],
79261
+ stateMutability: "view",
79262
+ type: "function"
79263
+ },
79264
+ {
79265
+ inputs: [
79266
+ {
79267
+ internalType: "uint256",
79268
+ name: "_billId",
79269
+ type: "uint256"
79270
+ }
79271
+ ],
79272
+ name: "vestingPayout",
79273
+ outputs: [
79274
+ {
79275
+ internalType: "uint256",
79276
+ name: "vestingPayout_",
79277
+ type: "uint256"
79278
+ }
79279
+ ],
79280
+ stateMutability: "view",
79281
+ type: "function"
79282
+ },
79283
+ {
79284
+ inputs: [
79285
+ {
79286
+ internalType: "uint256",
79287
+ name: "_billId",
79288
+ type: "uint256"
79289
+ }
79290
+ ],
79291
+ name: "vestingPeriod",
79292
+ outputs: [
79293
+ {
79294
+ internalType: "uint256",
79295
+ name: "vestingStart_",
79296
+ type: "uint256"
79297
+ },
79298
+ {
79299
+ internalType: "uint256",
79300
+ name: "vestingEnd_",
79301
+ type: "uint256"
79302
+ }
79303
+ ],
79304
+ stateMutability: "view",
79305
+ type: "function"
79306
+ }
79307
+ ];
79308
+
79309
+ // returns the checksummed address if the address is valid, otherwise returns false
79310
+ function isAddress(value) {
79311
+ try {
79312
+ // Alphabetical letters must be made lowercase for getAddress to work.
79313
+ // See documentation here: https://docs.ethers.io/v5/api/utils/address/
79314
+ return getAddress(value.toLowerCase());
79315
+ }
79316
+ catch (_a) {
79317
+ return false;
79318
+ }
79319
+ }
79320
+
79321
+ const getNativeTicker = (chain) => {
79322
+ var _a;
79323
+ if (!chain)
79324
+ return undefined;
79325
+ return (_a = main.WNATIVE[chain]) === null || _a === void 0 ? void 0 : _a.symbol.substring(1);
79326
+ };
79327
+ const getTokenSymbol = (token) => {
79328
+ const nativeSymbols = ['BNB', 'ETH', 'POL', 'IOTA'];
79329
+ return nativeSymbols.includes(token === null || token === void 0 ? void 0 : token.symbol) ? `w${token === null || token === void 0 ? void 0 : token.symbol}` : token === null || token === void 0 ? void 0 : token.symbol;
79330
+ };
79331
+ const getSymbol = (token, chainId) => {
79332
+ if (!token)
79333
+ return '';
79334
+ return token === 'NATIVE' ? getNativeTicker(chainId) : getTokenSymbol(token);
79335
+ };
79336
+
79337
+ const TokenRow = ({ token, chainId, handleTokenSelect, tokenBalance, }) => {
79338
+ var _a, _b;
79339
+ const symbol = getSymbol(token, chainId);
79340
+ const tokenAddress = token === 'NATIVE' ? 'NATIVE' : token.address[chainId];
79341
+ const { address } = useEVMAccount();
79342
+ const { publicKey: accountSolana } = useSOLAccount();
79343
+ const accountToUse = chainId === main.ChainId.SOL ? accountSolana === null || accountSolana === void 0 ? void 0 : accountSolana.toString() : address;
79344
+ const splited = typeof token !== 'string' ? (_a = token === null || token === void 0 ? void 0 : token.symbol) === null || _a === void 0 ? void 0 : _a.split('-') : undefined;
79345
+ return (jsxs(Flex, { sx: { p: '8px', justifyContent: 'space-between', cursor: 'pointer', '&:hover': { background: 'white4' } }, onClick: () => handleTokenSelect(tokenAddress !== null && tokenAddress !== void 0 ? tokenAddress : ''), children: [jsxs(Flex, { children: [lodashExports.isArray(splited) ? (jsx$2(TokenImage, { symbol: splited[0], symbol2: splited[1], size: 28, chain: chainId })) : (jsx$2(TokenImage, { symbol: getSymbol(token, chainId), size: 28, chain: chainId })), jsx$2(Flex, { sx: { mx: '8px', lineHeight: '28px', fontSize: '14px' }, children: symbol })] }), accountToUse && (jsx$2(Flex, { sx: { fontSize: '14px' }, children: tokenBalance === '0' ? ('0') : !tokenBalance ? (jsx$2(Spinner, { size: 15 })) : (jsx$2(Fragment$1, { children: (_b = new BigNumber$1(tokenBalance !== null && tokenBalance !== void 0 ? tokenBalance : '0')) === null || _b === void 0 ? void 0 : _b.toPrecision(5) })) }))] }));
79346
+ };
79347
+
76946
79348
  // Use devnet or your custom cluster URL
76947
79349
  const SOLANA_RPC_URL = getRPC(main.ChainId.SOL);
76948
79350
  const connection = new Connection(SOLANA_RPC_URL, 'confirmed');
@@ -78934,7 +81336,7 @@ const BonusComponent = ({ trueBondPrices, minTier, bonus, airdropTooltip, toolti
78934
81336
  }, children: [(_a = highestPointsElement === null || highestPointsElement === void 0 ? void 0 : highestPointsElement.bonusWithFee) === null || _a === void 0 ? void 0 : _a.toFixed(2), "%"] })] })] }) })) : (jsx$2(Flex, { sx: { height: '20px', width: '20px' }, children: jsx$2(TooltipBubble, { body: 'This bond is currently on cooldown and has no bonus. Please check back soon.', width: "205px", placement: "bottomRight", transformTip: "translate(10%, 0%)", children: jsx$2(Svg, { icon: "Timer", width: "20px", color: "#81CFEA" }) }) })) })) : baseTrueBondPrice ? (jsx$2(Flex, { sx: { alignItems: 'center', minWidth: '20px' }, className: `${getDiscountColor(+(baseTrueBondPrice === null || baseTrueBondPrice === void 0 ? void 0 : baseTrueBondPrice.bonusWithFee))}`, children: (baseTrueBondPrice === null || baseTrueBondPrice === void 0 ? void 0 : baseTrueBondPrice.bonusWithFee) > 0 ? (`${(_b = baseTrueBondPrice === null || baseTrueBondPrice === void 0 ? void 0 : baseTrueBondPrice.bonusWithFee) === null || _b === void 0 ? void 0 : _b.toFixed(2)}%`) : (jsx$2(Flex, { sx: { height: '20px', width: '20px' }, children: jsx$2(TooltipBubble, { body: 'This bond is currently on cooldown and has no bonus. Please check back soon.', width: "205px", placement: "bottomRight", transformTip: "translate(10%, 0%)", children: jsx$2(Svg, { icon: "Timer", width: "20px", color: "#81CFEA" }) }) })) })) : (jsxs(Flex, { sx: { color: bonus && 'success', alignItems: 'center', minWidth: '20px' }, children: [bonus || '-', airdropTooltip && (jsx$2(TooltipBubble, { body: jsx$2(Fragment$1, { children: airdropTooltip }), width: "230px", placement: isMobile ? 'bottomRight' : 'bottomLeft', transformTip: isMobile ? 'translate(9%, 6%)' : 'translate(-3%, 6%)', children: jsx$2(Flex, { sx: { width: '20px', height: '20px', alignItems: 'center', ml: '5px' }, children: jsx$2("img", { src: "https://res.cloudinary.com/dswmrqgwy/image/upload/v1750345773/airdrop_qvh4ow.png", alt: "airdrop-img", style: { width: '20px', height: '20px' } }) }) }))] })) }));
78935
81337
  };
78936
81338
 
78937
- const BondCards = ({ bondData }) => {
81339
+ const BondCards = ({ bondData, isDoingMaxBuy }) => {
78938
81340
  var _a, _b, _c;
78939
81341
  const isMobile = useIsMobile();
78940
81342
  const SDKConfig = useSDKConfig();
@@ -78971,7 +81373,14 @@ const BondCards = ({ bondData }) => {
78971
81373
  borderBottomLeftRadius: 'normal',
78972
81374
  },
78973
81375
  background: MCColorMapping.white3[bondData.marketingCampaign],
78974
- }, children: [jsxs("div", { className: "bond-card-title", children: ["Max Buy", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.MaxBuy((_b = bondData === null || bondData === void 0 ? void 0 : bondData.earnToken) === null || _b === void 0 ? void 0 : _b.symbol) }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs(Flex, { className: "bond-card-content", sx: { alignItems: 'center' }, children: [jsx$2("div", { style: { paddingRight: '3px' }, children: jsx$2(TokenImage, { symbol: (_c = bondData.showcaseTokenName) !== null && _c !== void 0 ? _c : bondData.earnToken.symbol, size: 22, chain: bondData.chainId }) }), formatNumberSI(maxBuy(bondData, SDKConfig.showLowValueBonds).toFixed(0), 2)] })] }), jsxs("div", { className: "bond-card-block", sx: {
81376
+ border: isDoingMaxBuy && '2px solid green !important',
81377
+ position: 'relative',
81378
+ }, children: [isDoingMaxBuy && (jsx$2(Flex, { sx: {
81379
+ position: 'absolute',
81380
+ top: '0px',
81381
+ right: '0px',
81382
+ transform: ['translate(50%,-50%)', 'translate(50%,-50%)', 'translate(50%,-50%)', 'translate(-50%,-50%)'],
81383
+ }, children: jsx$2(Svg, { icon: "success", width: isMobile ? 16 : 20 }) })), jsxs("div", { className: "bond-card-title", children: ["Max Buy", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.MaxBuy((_b = bondData === null || bondData === void 0 ? void 0 : bondData.earnToken) === null || _b === void 0 ? void 0 : _b.symbol) }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs(Flex, { className: "bond-card-content", sx: { alignItems: 'center' }, children: [jsx$2("div", { style: { paddingRight: '3px' }, children: jsx$2(TokenImage, { symbol: (_c = bondData.showcaseTokenName) !== null && _c !== void 0 ? _c : bondData.earnToken.symbol, size: 22, chain: bondData.chainId }) }), formatNumberSI(getMaxBuy(bondData, SDKConfig.showLowValueBonds), 0)] })] }), jsxs("div", { className: "bond-card-block", sx: {
78975
81384
  borderRadius: ['0px', '0px', '0px', 'normal'],
78976
81385
  '&:first-of-type': {
78977
81386
  borderTopRightRadius: 'normal',
@@ -78991,7 +81400,7 @@ const BondCards = ({ bondData }) => {
78991
81400
  };
78992
81401
 
78993
81402
  const Estimations = ({ depositAmount, bondData, youSpendString, isZap, fetchingZapQuote, zapError, }) => {
78994
- var _a, _b, _c;
81403
+ var _a, _b;
78995
81404
  const { data: userPoints } = useTierPoints();
78996
81405
  const trueBondPrice = findHighestTrueBondPrice(userPoints, bondData === null || bondData === void 0 ? void 0 : bondData.trueBondPrices);
78997
81406
  const SDKConfig = useSDKConfig();
@@ -79001,7 +81410,7 @@ const Estimations = ({ depositAmount, bondData, youSpendString, isZap, fetchingZ
79001
81410
  const bonusString = getRawBonus$1(bondData, depositAmount, '0');
79002
81411
  // const fee = getFeeAmount(bondData, depositAmount, userPoints ?? '0')
79003
81412
  // const feeUSD = fee * parseFloat(bondData?.payoutTokenPrice ?? '0')
79004
- const estimatedOutputAmount = getPayoutAmount(bondData, depositAmount, userPoints !== null && userPoints !== void 0 ? userPoints : '0');
81413
+ const estimatedOutputAmount = getPayoutAmount(bondData, depositAmount, userPoints);
79005
81414
  const estimatedOutputUSD = estimatedOutputAmount * parseFloat((_a = bondData === null || bondData === void 0 ? void 0 : bondData.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0');
79006
81415
  const noTierAmount = getRawBonus$1(bondData, depositAmount, '0');
79007
81416
  const boostAmount = parseFloat(getRawBonus$1(bondData, depositAmount, userPoints !== null && userPoints !== void 0 ? userPoints : '0')) - parseFloat(noTierAmount);
@@ -79025,7 +81434,7 @@ const Estimations = ({ depositAmount, bondData, youSpendString, isZap, fetchingZ
79025
81434
  background: '#9960C5',
79026
81435
  opacity: 0.2,
79027
81436
  borderRadius: 'normal',
79028
- } }), jsxs(Flex, { className: "row-container premium", sx: { zIndex: 1 }, children: [jsx$2("img", { src: `https://ape.bond/images/launch/${tierName === null || tierName === void 0 ? void 0 : tierName.toLowerCase()}.png`, alt: "minTier", style: { width: '21px', height: '21px', marginRight: '3px', zIndex: 1 } }), jsx$2(Flex, { sx: { color: 'success', mr: '3px', fontWeight: 700 }, children: `+${(_b = trueBondPrice === null || trueBondPrice === void 0 ? void 0 : trueBondPrice.boost) !== null && _b !== void 0 ? _b : 0}%` }), "Boost:", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Boost }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex, { className: "row-container premium-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), isZap && fetchingZapQuote ? (jsx$2(Dots, {})) : isZap && zapError ? ('-') : (jsxs(Flex, { className: `row-container premium-val premium-positive`, children: ["$ ", formatNumberSI(boostAmount)] }))] })), jsxs(Flex, { className: "text-container row", children: [jsxs(Flex, { className: "row-container get", children: ["You Get (over ", vestingTime((_c = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _c !== void 0 ? _c : 0).days, " days):"] }), isZap && fetchingZapQuote ? (jsx$2(Dots, {})) : isZap && zapError ? ('-') : (jsxs(Flex, { className: "row-container get-val", children: [formatNumberSI(estimatedOutputAmount, 4), " ", bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, " = $", ' ', formatNumberSI(estimatedOutputUSD, 2)] }))] })] }));
81437
+ } }), jsxs(Flex, { className: "row-container premium", sx: { zIndex: 1 }, children: [jsx$2("img", { src: `https://ape.bond/images/launch/${tierName === null || tierName === void 0 ? void 0 : tierName.toLowerCase()}.png`, alt: "minTier", style: { width: '21px', height: '21px', marginRight: '3px', zIndex: 1 } }), jsx$2(Flex, { sx: { color: 'success', mr: '3px', fontWeight: 700 }, children: `+${(_b = trueBondPrice === null || trueBondPrice === void 0 ? void 0 : trueBondPrice.boost) !== null && _b !== void 0 ? _b : 0}%` }), "Boost:", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Boost }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex, { className: "row-container premium-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), isZap && fetchingZapQuote ? (jsx$2(Dots, {})) : isZap && zapError ? ('-') : (jsxs(Flex, { className: `row-container premium-val premium-positive`, children: ["$ ", formatNumberSI(boostAmount)] }))] })), jsxs(Flex, { className: "text-container row", children: [jsxs(Flex, { className: "row-container get", children: ["You Get (over ", getTimePeriods(bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm, true).days, " days):"] }), isZap && fetchingZapQuote ? (jsx$2(Dots, {})) : isZap && zapError ? ('-') : (jsxs(Flex, { className: "row-container get-val", children: [formatNumberSI(estimatedOutputAmount, 4), " ", bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, " = $", ' ', formatNumberSI(estimatedOutputUSD, 2)] }))] })] }));
79029
81438
  };
79030
81439
 
79031
81440
  const ProjectDescription = ({ description, isProjectView }) => {
@@ -79243,7 +81652,7 @@ const LoadingSpinner = ({ isLoading, size }) => {
79243
81652
 
79244
81653
  const stepDelay = 1000;
79245
81654
  const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback, loadingTx, txCallback, bondData, inputToken, inputValue, depositAmount, buyTxHash, rateChanged, }) => {
79246
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
81655
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
79247
81656
  // Hooks
79248
81657
  const { chain } = useEVMAccount();
79249
81658
  const { data: userPoints } = useTierPoints();
@@ -79368,14 +81777,14 @@ const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback,
79368
81777
  borderRadius: 'normal',
79369
81778
  color: 'textDisabledButton',
79370
81779
  justifyContent: 'center',
79371
- }, children: [bondData.earnToken.symbol, " (", getTimePeriods((_f = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _f !== void 0 ? _f : 0).months, " Mo)"] }), jsxs(Flex, { sx: { width: '100%', background: 'white3', p: '10px', borderRadius: 'normal', mt: '10px' }, children: [jsx$2(TokenImage, { symbol: bondData.earnToken.symbol, size: 40, chain: txChain }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', alignItems: 'center' }, children: [jsxs(Flex, { sx: { flexDirection: 'column', fontSize: '12px', ml: '10px' }, children: [jsxs(Flex, { sx: { color: 'textDisabledButton', fontWeight: 400, textDecoration: 'line-through' }, children: ["$", bondData.tgePrice] }), jsxs(Flex, { sx: { color: 'green', fontWeight: 600 }, children: ["$", bondData.initPrice] })] }), jsxs(Flex, { sx: {
81780
+ }, children: [bondData.earnToken.symbol, " (", getTimePeriods(bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm).months, " Mo)"] }), jsxs(Flex, { sx: { width: '100%', background: 'white3', p: '10px', borderRadius: 'normal', mt: '10px' }, children: [jsx$2(TokenImage, { symbol: bondData.earnToken.symbol, size: 40, chain: txChain }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', alignItems: 'center' }, children: [jsxs(Flex, { sx: { flexDirection: 'column', fontSize: '12px', ml: '10px' }, children: [jsxs(Flex, { sx: { color: 'textDisabledButton', fontWeight: 400, textDecoration: 'line-through' }, children: ["$", bondData.tgePrice] }), jsxs(Flex, { sx: { color: 'green', fontWeight: 600 }, children: ["$", bondData.initPrice] })] }), jsxs(Flex, { sx: {
79372
81781
  p: '5px',
79373
81782
  borderRadius: 'normal',
79374
81783
  border: '1px solid var(--theme-ui-colors-success)',
79375
81784
  background: 'rgba(56, 166, 17, 0.13)',
79376
81785
  color: 'success',
79377
81786
  lineHeight: '18px',
79378
- }, children: [(_g = trueBondPrice === null || trueBondPrice === void 0 ? void 0 : trueBondPrice.bonusWithFee) === null || _g === void 0 ? void 0 : _g.toFixed(2), " % Bonus"] })] })] }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', mt: '10px' }, children: [jsxs(Flex, { sx: { p: '10px', borderRadius: 'normal', background: 'white3', alignItems: 'center', width: '45%' }, children: [lodashExports.isArray(splited) ? (jsx$2(TokenImage, { symbol: splited[0], symbol2: splited[1], size: 20, chain: txChain })) : (jsx$2(TokenImage, { symbol: getSymbol(inputToken, txChain), size: 20, chain: txChain })), jsx$2(Flex, { sx: { fontSize: '14px', fontWeight: 600, mx: '5px' }, children: (_h = formatNumberSI(inputValue, 4)) !== null && _h !== void 0 ? _h : '0' }), jsxs(Flex, { sx: { color: 'textDisabledButton', fontSize: '12px', fontWeight: 400 }, children: ["(", (inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) && inputValue
81787
+ }, children: [(_f = trueBondPrice === null || trueBondPrice === void 0 ? void 0 : trueBondPrice.bonusWithFee) === null || _f === void 0 ? void 0 : _f.toFixed(2), " % Bonus"] })] })] }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', mt: '10px' }, children: [jsxs(Flex, { sx: { p: '10px', borderRadius: 'normal', background: 'white3', alignItems: 'center', width: '45%' }, children: [lodashExports.isArray(splited) ? (jsx$2(TokenImage, { symbol: splited[0], symbol2: splited[1], size: 20, chain: txChain })) : (jsx$2(TokenImage, { symbol: getSymbol(inputToken, txChain), size: 20, chain: txChain })), jsx$2(Flex, { sx: { fontSize: '14px', fontWeight: 600, mx: '5px' }, children: (_g = formatNumberSI(inputValue, 4)) !== null && _g !== void 0 ? _g : '0' }), jsxs(Flex, { sx: { color: 'textDisabledButton', fontSize: '12px', fontWeight: 400 }, children: ["(", (inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) && inputValue
79379
81788
  ? `$${formatNumberSI((inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) * parseFloat(inputValue))}`
79380
81789
  : '0.00', ")"] })] }), jsx$2(Svg, { icon: 'arrow', direction: 'right', width: '10px' }), jsxs(Flex, { sx: { p: '10px', borderRadius: 'normal', background: 'white3', alignItems: 'center', width: '45%' }, children: [jsx$2(TokenImage, { symbol: getSymbol(bondData.earnToken, txChain), chain: txChain, size: 20 }), jsx$2(Flex, { sx: { fontSize: '14px', fontWeight: 600, mx: '5px' }, children: formatNumberSI(preTGEEstimatedOutput, 4) }), jsxs(Flex, { sx: { color: 'textDisabledButton', fontSize: '12px', fontWeight: 400 }, children: ["($", formatNumberSI(preTGEEstimatedOutputUSD), ")"] })] })] })] })) : (jsxs(Flex, { sx: { width: '100%', flexDirection: 'column', mt: '20px' }, children: [jsxs(Flex, { sx: {
79381
81790
  width: '100%',
@@ -79384,14 +81793,14 @@ const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback,
79384
81793
  borderRadius: 'normal',
79385
81794
  color: 'textDisabledButton',
79386
81795
  justifyContent: 'center',
79387
- }, children: [bondData.earnToken.symbol, " (", getVestingTermsString(bondData), ")"] }), jsxs(Flex, { sx: { width: '100%', background: 'white3', p: '10px', borderRadius: 'normal', mt: '10px' }, children: [jsx$2(TokenImage, { symbol: bondData.earnToken.symbol, size: 40, chain: txChain }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', alignItems: 'center' }, children: [jsxs(Flex, { sx: { flexDirection: 'column', fontSize: '12px', ml: '10px' }, children: [jsxs(Flex, { sx: { color: 'textDisabledButton', fontWeight: 400, textDecoration: 'line-through' }, children: ["$", earnTokenPrice(bondData)] }), jsxs(Flex, { sx: { color: 'green', fontWeight: 600 }, children: ["$", discountEarnTokenPriceForUser(bondData, SDKConfig.useTiers, (_j = getUserTier(userPoints)) !== null && _j !== void 0 ? _j : undefined)] })] }), jsxs(Flex, { sx: {
81796
+ }, children: [bondData.earnToken.symbol, " (", getVestingTermsString(bondData), ")"] }), jsxs(Flex, { sx: { width: '100%', background: 'white3', p: '10px', borderRadius: 'normal', mt: '10px' }, children: [jsx$2(TokenImage, { symbol: bondData.earnToken.symbol, size: 40, chain: txChain }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', alignItems: 'center' }, children: [jsxs(Flex, { sx: { flexDirection: 'column', fontSize: '12px', ml: '10px' }, children: [jsxs(Flex, { sx: { color: 'textDisabledButton', fontWeight: 400, textDecoration: 'line-through' }, children: ["$", earnTokenPrice(bondData)] }), jsxs(Flex, { sx: { color: 'green', fontWeight: 600 }, children: ["$", discountEarnTokenPriceForUser(bondData, SDKConfig.useTiers, (_h = getUserTier(userPoints)) !== null && _h !== void 0 ? _h : undefined)] })] }), jsxs(Flex, { sx: {
79388
81797
  p: '5px',
79389
81798
  borderRadius: 'normal',
79390
81799
  border: '1px solid var(--theme-ui-colors-success)',
79391
81800
  background: 'rgba(56, 166, 17, 0.13)',
79392
81801
  color: 'success',
79393
81802
  lineHeight: '18px',
79394
- }, children: [(_k = trueBondPrice === null || trueBondPrice === void 0 ? void 0 : trueBondPrice.bonusWithFee) === null || _k === void 0 ? void 0 : _k.toFixed(2), " % Bonus"] })] })] }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', mt: '10px' }, children: [jsxs(Flex, { sx: { p: '10px', borderRadius: 'normal', background: 'white3', alignItems: 'center', width: '45%' }, children: [lodashExports.isArray(splited) ? (jsx$2(TokenImage, { symbol: splited[0], symbol2: splited[1], size: 20, chain: txChain })) : (jsx$2(TokenImage, { symbol: getSymbol(inputToken, txChain), size: 20, chain: txChain })), jsx$2(Flex, { sx: { fontSize: '14px', fontWeight: 600, mx: '5px' }, children: (_l = formatNumberSI(inputValue, 4)) !== null && _l !== void 0 ? _l : '0' }), jsxs(Flex, { sx: { color: 'textDisabledButton', fontSize: '12px', fontWeight: 400 }, children: ["(", (inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) && inputValue
81803
+ }, children: [(_j = trueBondPrice === null || trueBondPrice === void 0 ? void 0 : trueBondPrice.bonusWithFee) === null || _j === void 0 ? void 0 : _j.toFixed(2), " % Bonus"] })] })] }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', mt: '10px' }, children: [jsxs(Flex, { sx: { p: '10px', borderRadius: 'normal', background: 'white3', alignItems: 'center', width: '45%' }, children: [lodashExports.isArray(splited) ? (jsx$2(TokenImage, { symbol: splited[0], symbol2: splited[1], size: 20, chain: txChain })) : (jsx$2(TokenImage, { symbol: getSymbol(inputToken, txChain), size: 20, chain: txChain })), jsx$2(Flex, { sx: { fontSize: '14px', fontWeight: 600, mx: '5px' }, children: (_k = formatNumberSI(inputValue, 4)) !== null && _k !== void 0 ? _k : '0' }), jsxs(Flex, { sx: { color: 'textDisabledButton', fontSize: '12px', fontWeight: 400 }, children: ["(", (inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) && inputValue
79395
81804
  ? `$${formatNumberSI((inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) * parseFloat(inputValue))}`
79396
81805
  : '0.00', ")"] })] }), jsx$2(Svg, { icon: 'arrow', direction: 'right', width: '10px' }), jsxs(Flex, { sx: { p: '10px', borderRadius: 'normal', background: 'white3', alignItems: 'center', width: '45%' }, children: [jsx$2(TokenImage, { symbol: getSymbol(bondData.earnToken, txChain), chain: txChain, size: 20 }), jsx$2(Flex, { sx: { fontSize: '14px', fontWeight: 600, mx: '5px' }, children: formatNumberSI(estimatedOutputAmount, 4) }), jsxs(Flex, { sx: { color: 'textDisabledButton', fontSize: '12px', fontWeight: 400 }, children: ["($", formatNumberSI(estimatedOutputUSD), ")"] })] })] })] })), jsx$2(Flex, { sx: { mt: '20px' }, children: hasToSwitchChain ? (jsxs(Button, { load: loadingSwitchChain, disabled: loadingSwitchChain, onClick: handleSwitchChain, fullWidth: true, children: ["switch to ", NETWORK_LABEL[txChain]] })) : !hasToApprove ? (jsx$2(Button, { load: loadingTx || verifyingTx, disabled: loadingTx || verifyingTx, onClick: txCallback, fullWidth: true, children: "buy" })) : (jsx$2(Button, { className: "action-button", load: approvalState === ApprovalState.PENDING || approveLoading, disabled: approvalState === ApprovalState.PENDING || approveLoading, onClick: handleApprove, fullWidth: true, children: "Approve" })) })] })] }));
79397
81806
  };
@@ -79432,7 +81841,8 @@ const BuyComponent = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond,
79432
81841
  : ((_c = (_b = (_a = item === null || item === void 0 ? void 0 : item.token) === null || _a === void 0 ? void 0 : _a.address) === null || _b === void 0 ? void 0 : _b[bondChain]) === null || _c === void 0 ? void 0 : _c.toLowerCase()) ===
79433
81842
  ((_e = (_d = inputToken === null || inputToken === void 0 ? void 0 : inputToken.address) === null || _d === void 0 ? void 0 : _d[bondChain]) === null || _e === void 0 ? void 0 : _e.toLowerCase());
79434
81843
  });
79435
- const inputCurrencyBalance = enrichedTokenData === null || enrichedTokenData === void 0 ? void 0 : enrichedTokenData.balance;
81844
+ // const inputCurrencyBalance = enrichedTokenData?.balance
81845
+ const inputCurrencyBalance = '1000000'; //TODO: rollback
79436
81846
  const inputTokenPrice = enrichedTokenData === null || enrichedTokenData === void 0 ? void 0 : enrichedTokenData.price;
79437
81847
  const rateChanged = parseFloat(zapTrueBondPrice !== null && zapTrueBondPrice !== void 0 ? zapTrueBondPrice : '0') > parseFloat(trueBondPrice !== null && trueBondPrice !== void 0 ? trueBondPrice : '0') * 1.01 && isZap;
79438
81848
  // Estimations
@@ -79441,8 +81851,11 @@ const BuyComponent = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond,
79441
81851
  $${formatUSDNumber((parseFloat(inputValue) * (inputTokenPrice !== null && inputTokenPrice !== void 0 ? inputTokenPrice : 0)).toString())}`;
79442
81852
  // Validations
79443
81853
  const zapEnabled = supportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId);
79444
- const exceedsMaxBuy = maxBuy(bondData, SDKConfig.showLowValueBonds).lt(getPayoutAmount(bondData, depositAmount, userPoints !== null && userPoints !== void 0 ? userPoints : '0'));
79445
- const exceedsBalance = new BigNumber$1(inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : '0').lt(inputValue);
81854
+ const exceedsRealMaxBuy = getMaxBuy(bondData, true).lte(getPayoutAmount(bondData, depositAmount, userPoints));
81855
+ const exceedsSafeMaxBuy = getMaxBuy(bondData, false)
81856
+ .times(isZap ? 0.995 : 0.9999)
81857
+ .lte(getPayoutAmount(bondData, depositAmount, userPoints));
81858
+ const exceedsBalance = new BigNumber$1(inputCurrencyBalance ).lt(inputValue);
79446
81859
  // Loading State
79447
81860
  const [loadingTx, setLoadingTx] = useState(false);
79448
81861
  const { addToastError } = usePopups();
@@ -79453,6 +81866,36 @@ const BuyComponent = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond,
79453
81866
  setInputValue('');
79454
81867
  setInputTokenString(newInputToken);
79455
81868
  }, []);
81869
+ const handleMaxButton = useCallback(() => {
81870
+ var _a, _b, _c, _d, _e;
81871
+ const balance = new BigNumber$1(inputCurrencyBalance );
81872
+ const principalDecimals = (_c = (_b = (_a = bondData === null || bondData === void 0 ? void 0 : bondData.lpToken) === null || _a === void 0 ? void 0 : _a.decimals) === null || _b === void 0 ? void 0 : _b[bondData === null || bondData === void 0 ? void 0 : bondData.chainId]) !== null && _c !== void 0 ? _c : 18;
81873
+ const maxBuyAmount = getMaxBuy(bondData, SDKConfig.showLowValueBonds);
81874
+ if (!isZap) {
81875
+ const maxPossibleUserPurchase = getPayoutAmount(bondData, balance.toString(), userPoints);
81876
+ if (maxPossibleUserPurchase > maxBuyAmount.toNumber()) {
81877
+ console.log('user balance exceeds max buy limit, setting to max buy');
81878
+ const principalForMaxBuy = getPrincipalAmount(bondData, maxBuyAmount.toString(), userPoints);
81879
+ setInputValue(new BigNumber$1(principalForMaxBuy).toFixed(principalDecimals));
81880
+ }
81881
+ else {
81882
+ console.log('balance is ok, can be used');
81883
+ setInputValue(balance.toFixed(principalDecimals));
81884
+ }
81885
+ }
81886
+ else {
81887
+ const principalForMaxBuy = getPrincipalAmount(bondData, maxBuyAmount.toString(), userPoints);
81888
+ const principalForMaxBuyUSD = new BigNumber$1(principalForMaxBuy).times((_d = bondData === null || bondData === void 0 ? void 0 : bondData.principalTokenPrice) !== null && _d !== void 0 ? _d : 0);
81889
+ const maxBuyAmountInSelectedToken = principalForMaxBuyUSD.div(inputTokenPrice !== null && inputTokenPrice !== void 0 ? inputTokenPrice : 0);
81890
+ const decimals = (enrichedTokenData === null || enrichedTokenData === void 0 ? void 0 : enrichedTokenData.token) === 'NATIVE' ? 18 : ((_e = enrichedTokenData === null || enrichedTokenData === void 0 ? void 0 : enrichedTokenData.token.decimals[bondData === null || bondData === void 0 ? void 0 : bondData.chainId]) !== null && _e !== void 0 ? _e : 18);
81891
+ if (balance.gte(maxBuyAmountInSelectedToken)) {
81892
+ setInputValue(maxBuyAmountInSelectedToken.toFixed(decimals));
81893
+ }
81894
+ else {
81895
+ setInputValue(balance.toFixed(decimals));
81896
+ }
81897
+ }
81898
+ }, [bondData, isZap, userPoints, SDKConfig.showLowValueBonds, inputTokenPrice, enrichedTokenData === null || enrichedTokenData === void 0 ? void 0 : enrichedTokenData.token]);
79456
81899
  const handleOpenZapModal = () => {
79457
81900
  var _a;
79458
81901
  onOpenZapModal();
@@ -79638,7 +82081,7 @@ const BuyComponent = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond,
79638
82081
  const [hasChecked, setHasChecked] = useState(false);
79639
82082
  useEffect(() => {
79640
82083
  if (zapListFetched && !hasChecked) {
79641
- if (parseFloat(inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : '0') < 0.0001) {
82084
+ if (parseFloat(inputCurrencyBalance ) < 0.0001) {
79642
82085
  setInputTokenString(sortedZapList[0].token === 'NATIVE' ? 'NATIVE' : sortedZapList[0].token.address[bondChain]);
79643
82086
  }
79644
82087
  setHasChecked(true);
@@ -79654,18 +82097,18 @@ const BuyComponent = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond,
79654
82097
  }
79655
82098
  /* eslint-disable react-hooks/exhaustive-deps */
79656
82099
  }, [rateChanged]);
79657
- return bondData ? (jsx$2(Flex, { className: "modal-content", sx: Object.assign({}, MCBuyComponentStyles[bondData === null || bondData === void 0 ? void 0 : bondData.marketingCampaign]), children: jsxs(Flex, { className: "modaltable-container", children: [jsx$2(BondModalHeader, { bondData: bondData, onDismiss: onDismiss, showProjectInfoButton: (SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.referenceId) === 'apebond' }), jsx$2(ProjectDescription, { description: bondData.shortDescription, isProjectView: true }), jsx$2(Flex, { sx: { width: '100%', display: isProjectView ? ['flex', 'flex', 'flex', 'none'] : 'flex' }, children: jsx$2(BondCards, { bondData: bondData }) }), jsx$2(Estimations, { depositAmount: depositAmount, bondData: bondData, youSpendString: youSpendString, isZap: isZap, fetchingZapQuote: fetchingZapQuote, zapError: zapError }), jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleValueBtn: () => { var _a; return setInputValue((_a = new BigNumber$1(inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, handleCurrencySelect: handleCurrencySelect, bondChainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId, enableZap: zapEnabled, bondPrincipalToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, tokenBalance: inputCurrencyBalance, selectedTokenPrice: inputTokenPrice, inputDisabled: isUserRestricted, marketingCampaign: bondData === null || bondData === void 0 ? void 0 : bondData.marketingCampaign }), SDKConfig.useTiers && jsx$2(GetUpToComponent, { bond: bondData, depositAmount: depositAmount }), (bondData === null || bondData === void 0 ? void 0 : bondData.warningCard) && (jsx$2(Flex, { sx: {
82100
+ return bondData ? (jsx$2(Flex, { className: "modal-content", sx: Object.assign({}, MCBuyComponentStyles[bondData === null || bondData === void 0 ? void 0 : bondData.marketingCampaign]), children: jsxs(Flex, { className: "modaltable-container", children: [jsx$2(BondModalHeader, { bondData: bondData, onDismiss: onDismiss, showProjectInfoButton: (SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.referenceId) === 'apebond' }), jsx$2(ProjectDescription, { description: bondData.shortDescription, isProjectView: true }), jsx$2(Flex, { sx: { width: '100%', display: isProjectView ? ['flex', 'flex', 'flex', 'none'] : 'flex' }, children: jsx$2(BondCards, { bondData: bondData, isDoingMaxBuy: exceedsSafeMaxBuy && !exceedsRealMaxBuy }) }), jsx$2(Estimations, { depositAmount: depositAmount, bondData: bondData, youSpendString: youSpendString, isZap: isZap, fetchingZapQuote: fetchingZapQuote, zapError: zapError }), jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleValueBtn: handleMaxButton, handleCurrencySelect: handleCurrencySelect, bondChainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId, enableZap: zapEnabled, bondPrincipalToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, tokenBalance: inputCurrencyBalance, selectedTokenPrice: inputTokenPrice, inputDisabled: isUserRestricted, marketingCampaign: bondData === null || bondData === void 0 ? void 0 : bondData.marketingCampaign }), SDKConfig.useTiers && jsx$2(GetUpToComponent, { bond: bondData, depositAmount: depositAmount }), (bondData === null || bondData === void 0 ? void 0 : bondData.warningCard) && (jsx$2(Flex, { sx: {
79658
82101
  width: '100%',
79659
82102
  background: '#DE62F366',
79660
82103
  // justifyContent: 'center',
79661
82104
  mt: '10px',
79662
82105
  borderRadius: 'normal',
79663
82106
  p: '2px 10px',
79664
- }, children: jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400, display: 'flex', alignItems: 'center', gap: '10px' }, children: [jsx$2(SafeHTMLComponent, { html: bondData === null || bondData === void 0 ? void 0 : bondData.warningCard }), (bondData === null || bondData === void 0 ? void 0 : bondData.chainId) === main.ChainId.SONIC && (bondData === null || bondData === void 0 ? void 0 : bondData.earnToken.symbol.toLowerCase()) === 'moon' && (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Text, { sx: { textTransform: 'none' }, children: "Open the 'cog' icon menu in the top right and set the Slippage Tolerance to 5% or more." }), width: "315px", placement: "topRight", transformTip: "translate(9%, -10%)", children: jsx$2(Svg, { icon: "questionCircle", width: 14, color: "textDisabledButton" }) }))] }) })), jsxs(Flex, { className: "modaltable-container button-container", children: [account && (jsx$2(Flex, { className: "button-container get", children: jsx$2(Button, { className: "action-button", onClick: () => bondData.billVersion === main.BillVersion.V4 && SDKConfig.useTiers && zapEnabled
79665
- ? window.open('http://ape.bond/tier-staking', '_blank')
82107
+ }, children: jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400, display: 'flex', alignItems: 'center', gap: '10px' }, children: [jsx$2(SafeHTMLComponent, { html: bondData === null || bondData === void 0 ? void 0 : bondData.warningCard }), (bondData === null || bondData === void 0 ? void 0 : bondData.chainId) === main.ChainId.SONIC && (bondData === null || bondData === void 0 ? void 0 : bondData.earnToken.symbol.toLowerCase()) === 'moon' && (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Text, { sx: { textTransform: 'none' }, children: "Open the 'cog' icon menu in the top right and set the Slippage Tolerance to 5% or more." }), width: "315px", placement: "topRight", transformTip: "translate(9%, -10%)", children: jsx$2(Svg, { icon: "questionCircle", width: 14, color: "textDisabledButton" }) }))] }) })), jsxs(Flex, { className: "modaltable-container button-container", children: [account && (jsx$2(Flex, { className: "button-container get", children: jsx$2(Button, { className: "action-button", onClick: () => bondData.billVersion === main.BillVersion.V4 && SDKConfig.useTiers
82108
+ ? window.open('http://ape.bond/true-yield', '_blank')
79666
82109
  : zapEnabled
79667
82110
  ? handleOpenZapModal()
79668
- : openExternal(), variant: "secondary", fullWidth: true, children: bondData.billVersion === main.BillVersion.V4 && SDKConfig.useTiers && zapEnabled
82111
+ : openExternal(), variant: "secondary", fullWidth: true, sx: { fontSize: ['14px', '14px', '14px', '16px'], height: '100%' }, children: bondData.billVersion === main.BillVersion.V4 && SDKConfig.useTiers
79669
82112
  ? `Get ${!isMobile ? 'your' : ''} Tier`
79670
82113
  : `Get ${getSymbol(bondData === null || bondData === void 0 ? void 0 : bondData.lpToken)}` }) })), jsx$2(Flex, { className: "button-container buy", children: !account ? (jsx$2(ConnectButton, {})) : isUserRestricted ? (jsx$2(Button, { className: "action-button", disabled: true, children: "INSUFFICIENT TIER" })) : (jsx$2(Button, { className: "action-button", load: load || fetchingZapQuote, disabled: load ||
79671
82114
  (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) ||
@@ -79674,13 +82117,13 @@ const BuyComponent = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond,
79674
82117
  parseFloat(inputValue) === 0 ||
79675
82118
  fetchingZapQuote ||
79676
82119
  zapError ||
79677
- exceedsMaxBuy ||
82120
+ exceedsRealMaxBuy ||
79678
82121
  exceedsBalance ||
79679
82122
  (isZap && !zapData) ||
79680
- SDKConfig.blockSales, onClick: handleOpenModal, children: SDKConfig.blockSales
82123
+ SDKConfig.blockSales, onClick: handleOpenModal, sx: { fontSize: ['14px', '14px', '14px', '16px'] }, children: SDKConfig.blockSales
79681
82124
  ? 'Complete KYC to Buy'
79682
- : exceedsMaxBuy
79683
- ? 'Exceeds Max Buy'
82125
+ : exceedsRealMaxBuy
82126
+ ? 'Exceeds Max Buy. Reduce amount'
79684
82127
  : exceedsBalance
79685
82128
  ? 'Exceeds balance'
79686
82129
  : zapError
@@ -80644,14 +83087,18 @@ const BuyComponentSolana = ({ onDismiss, bondAddress, bondChain, isProjectView,
80644
83087
  : ((_c = (_b = (_a = item === null || item === void 0 ? void 0 : item.token) === null || _a === void 0 ? void 0 : _a.address) === null || _b === void 0 ? void 0 : _b[bondChain]) === null || _c === void 0 ? void 0 : _c.toLowerCase()) ===
80645
83088
  ((_e = (_d = inputToken === null || inputToken === void 0 ? void 0 : inputToken.address) === null || _d === void 0 ? void 0 : _d[bondChain]) === null || _e === void 0 ? void 0 : _e.toLowerCase());
80646
83089
  });
80647
- const inputCurrencyBalance = enrichedTokenData === null || enrichedTokenData === void 0 ? void 0 : enrichedTokenData.balance;
83090
+ // const inputCurrencyBalance = enrichedTokenData?.balance
83091
+ const inputCurrencyBalance = '1000000'; //TODO: rollback
80648
83092
  const inputTokenPrice = enrichedTokenData === null || enrichedTokenData === void 0 ? void 0 : enrichedTokenData.price;
80649
83093
  // Estimations - use zapDepositAmount if swapping
80650
83094
  const depositAmount = isZap ? zapDepositAmount : inputValue;
80651
83095
  const youSpendString = `${formatNumber$1(inputValue)} ${getSymbol(inputToken, bondData === null || bondData === void 0 ? void 0 : bondData.chainId)} =
80652
83096
  $${formatUSDNumber((parseFloat(inputValue) * (inputTokenPrice !== null && inputTokenPrice !== void 0 ? inputTokenPrice : 0)).toString())}`;
80653
- const exceedsMaxBuy = maxBuy(bondData).lt(getPayoutAmount(bondData, depositAmount, '0'));
80654
- const exceedsBalance = new BigNumber$1(inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : '0').lt(inputValue);
83097
+ const exceedsRealMaxBuy = getMaxBuy(bondData, true).lte(getPayoutAmount(bondData, depositAmount, '0'));
83098
+ const exceedsSafeMaxBuy = getMaxBuy(bondData, false)
83099
+ .times(isZap ? 0.995 : 0.9999)
83100
+ .lte(getPayoutAmount(bondData, depositAmount, '0'));
83101
+ const exceedsBalance = new BigNumber$1(inputCurrencyBalance ).lt(inputValue);
80655
83102
  // Loading State - include zap loading
80656
83103
  const [loadingTx, setLoadingTx] = useState(false);
80657
83104
  const load = loadingTx || (fetchingZapQuote && !!inputValue);
@@ -80660,6 +83107,37 @@ const BuyComponentSolana = ({ onDismiss, bondAddress, bondChain, isProjectView,
80660
83107
  setInputValue('');
80661
83108
  setInputTokenString(newInputToken);
80662
83109
  }, []);
83110
+ const handleMaxButton = () => {
83111
+ var _a, _b, _c, _d, _e;
83112
+ const balance = new BigNumber$1(inputCurrencyBalance );
83113
+ const principalDecimals = (_c = (_b = (_a = bondData === null || bondData === void 0 ? void 0 : bondData.lpToken) === null || _a === void 0 ? void 0 : _a.decimals) === null || _b === void 0 ? void 0 : _b[bondData === null || bondData === void 0 ? void 0 : bondData.chainId]) !== null && _c !== void 0 ? _c : 18;
83114
+ const maxBuyAmount = getMaxBuy(bondData, SDKConfig.showLowValueBonds);
83115
+ if (!isZap) {
83116
+ const maxPossibleUserPurchase = getPayoutAmount(bondData, balance.toString(), '0');
83117
+ if (maxPossibleUserPurchase > maxBuyAmount.toNumber()) {
83118
+ console.log('user balance exceeds max buy limit, setting to max buy');
83119
+ const principalForMaxBuy = getPrincipalAmount(bondData, maxBuyAmount.toString(), '0');
83120
+ setInputValue(new BigNumber$1(principalForMaxBuy).toFixed(principalDecimals));
83121
+ }
83122
+ else {
83123
+ console.log('balance is ok, can be used');
83124
+ setInputValue(balance.toFixed(principalDecimals));
83125
+ }
83126
+ }
83127
+ else {
83128
+ const principalForMaxBuy = getPrincipalAmount(bondData, maxBuyAmount.toString(), '0');
83129
+ const principalForMaxBuyUSD = new BigNumber$1(principalForMaxBuy).times((_d = bondData === null || bondData === void 0 ? void 0 : bondData.principalTokenPrice) !== null && _d !== void 0 ? _d : 0);
83130
+ const maxBuyAmountInSelectedToken = principalForMaxBuyUSD.div(inputTokenPrice !== null && inputTokenPrice !== void 0 ? inputTokenPrice : 0);
83131
+ const decimals = (enrichedTokenData === null || enrichedTokenData === void 0 ? void 0 : enrichedTokenData.token) === 'NATIVE' ? 18 : ((_e = enrichedTokenData === null || enrichedTokenData === void 0 ? void 0 : enrichedTokenData.token.decimals[bondData === null || bondData === void 0 ? void 0 : bondData.chainId]) !== null && _e !== void 0 ? _e : 18);
83132
+ if (balance.gte(maxBuyAmountInSelectedToken)) {
83133
+ setInputValue(maxBuyAmountInSelectedToken.toFixed(decimals));
83134
+ }
83135
+ else {
83136
+ setInputValue(balance.toFixed(decimals));
83137
+ }
83138
+ }
83139
+ // setInputValue(new BigNumber(inputCurrencyBalance ?? '0')?.toString())
83140
+ };
80663
83141
  const handleBuyCallback = () => __awaiter$9(void 0, void 0, void 0, function* () {
80664
83142
  var _a, _b, _c, _d, _e, _f, _g;
80665
83143
  if (!accountSolana || !bondData || !inputValue || !inputToken || !bondData)
@@ -81109,14 +83587,14 @@ const BuyComponentSolana = ({ onDismiss, bondAddress, bondChain, isProjectView,
81109
83587
  const [hasChecked, setHasChecked] = useState(false);
81110
83588
  useEffect(() => {
81111
83589
  if (zapListFetched && !hasChecked) {
81112
- if (parseFloat(inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : '0') < 0.0001) {
83590
+ if (parseFloat(inputCurrencyBalance ) < 0.0001) {
81113
83591
  setInputTokenString(sortedZapList[0].token === 'NATIVE' ? 'NATIVE' : sortedZapList[0].token.address[bondChain]);
81114
83592
  }
81115
83593
  setHasChecked(true);
81116
83594
  }
81117
83595
  /* eslint-disable react-hooks/exhaustive-deps */
81118
83596
  }, [inputCurrencyBalance, zapListFetched]);
81119
- return bondData ? (jsx$2(Flex, { className: "modal-content", sx: Object.assign({}, MCBuyComponentStyles[bondData === null || bondData === void 0 ? void 0 : bondData.marketingCampaign]), children: jsxs(Flex, { className: "modaltable-container", children: [jsx$2(BondModalHeader, { bondData: bondData, onDismiss: onDismiss }), jsx$2(ProjectDescription, { description: bondData.shortDescription, isProjectView: true }), jsx$2(Flex, { sx: { width: '100%', display: isProjectView ? ['flex', 'flex', 'flex', 'none'] : 'flex' }, children: jsx$2(BondCards, { bondData: bondData }) }), jsx$2(Estimations, { depositAmount: depositAmount, bondData: bondData, youSpendString: youSpendString, isZap: isZap, fetchingZapQuote: fetchingZapQuote, zapError: zapError }), jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleValueBtn: () => { var _a; return setInputValue((_a = new BigNumber$1(inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, handleCurrencySelect: handleCurrencySelect, bondChainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId, enableZap: true, bondPrincipalToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, tokenBalance: inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : undefined, selectedTokenPrice: inputTokenPrice }), (bondData === null || bondData === void 0 ? void 0 : bondData.warningCard) && (jsx$2(Flex, { sx: {
83597
+ return bondData ? (jsx$2(Flex, { className: "modal-content", sx: Object.assign({}, MCBuyComponentStyles[bondData === null || bondData === void 0 ? void 0 : bondData.marketingCampaign]), children: jsxs(Flex, { className: "modaltable-container", children: [jsx$2(BondModalHeader, { bondData: bondData, onDismiss: onDismiss }), jsx$2(ProjectDescription, { description: bondData.shortDescription, isProjectView: true }), jsx$2(Flex, { sx: { width: '100%', display: isProjectView ? ['flex', 'flex', 'flex', 'none'] : 'flex' }, children: jsx$2(BondCards, { bondData: bondData, isDoingMaxBuy: exceedsSafeMaxBuy && !exceedsRealMaxBuy }) }), jsx$2(Estimations, { depositAmount: depositAmount, bondData: bondData, youSpendString: youSpendString, isZap: isZap, fetchingZapQuote: fetchingZapQuote, zapError: zapError }), jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleValueBtn: handleMaxButton, handleCurrencySelect: handleCurrencySelect, bondChainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId, enableZap: true, bondPrincipalToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, tokenBalance: inputCurrencyBalance , selectedTokenPrice: inputTokenPrice }), (bondData === null || bondData === void 0 ? void 0 : bondData.warningCard) && (jsx$2(Flex, { sx: {
81120
83598
  width: '100%',
81121
83599
  background: '#DE62F366',
81122
83600
  justifyContent: 'center',
@@ -81126,20 +83604,20 @@ const BuyComponentSolana = ({ onDismiss, bondAddress, bondChain, isProjectView,
81126
83604
  }, children: jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400, display: 'flex', alignItems: 'center', gap: '10px' }, children: [jsx$2(SafeHTMLComponent, { html: bondData === null || bondData === void 0 ? void 0 : bondData.warningCard }), (bondData === null || bondData === void 0 ? void 0 : bondData.chainId) === main.ChainId.SONIC && (bondData === null || bondData === void 0 ? void 0 : bondData.earnToken.symbol.toLowerCase()) === 'moon' && (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Text, { sx: { textTransform: 'none' }, children: "Open the 'cog' icon menu in the top right and set the Slippage Tolerance to 5% or more." }), width: "315px", placement: "topRight", transformTip: "translate(9%, -10%)", children: jsx$2(Svg, { icon: "questionCircle", width: 14, color: "textDisabledButton" }) }))] }) })), jsx$2(Flex, { className: "modaltable-container button-container", children: jsx$2(Flex, { className: "button-container buy", children: !accountSolana ? (jsx$2(ConnectSolanaWallet, {})) : (jsxs(Flex, { sx: { width: '100%', gap: '10px', flexDirection: ['column', 'column', 'column', 'row'] }, children: [jsxs(Button, { variant: "secondary", onClick: () => {
81127
83605
  var _a, _b;
81128
83606
  return window.open(`https://jumper.exchange/?fromChain=1151111081099710&fromToken=11111111111111111111111111111111&toChain=1151111081099710&toToken=${(_b = (_a = bondData === null || bondData === void 0 ? void 0 : bondData.lpToken) === null || _a === void 0 ? void 0 : _a.address) === null || _b === void 0 ? void 0 : _b[bondData === null || bondData === void 0 ? void 0 : bondData.chainId]}`, '_blank', 'noopener noreferrer');
81129
- }, sx: { width: ['100%', '100%', '100%', '35%'] }, children: ["get ", (_f = bondData === null || bondData === void 0 ? void 0 : bondData.lpToken) === null || _f === void 0 ? void 0 : _f.symbol] }), jsx$2(Button, { className: "action-button", load: load, disabled: load ||
83607
+ }, sx: { width: ['100%', '100%', '100%', '35%'], fontSize: ['14px', '14px', '14px', '16px'] }, children: ["get ", (_f = bondData === null || bondData === void 0 ? void 0 : bondData.lpToken) === null || _f === void 0 ? void 0 : _f.symbol] }), jsx$2(Button, { className: "action-button", load: load, disabled: load ||
81130
83608
  (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) ||
81131
83609
  !accountSolana ||
81132
83610
  !inputValue ||
81133
83611
  parseFloat(inputValue) === 0 ||
81134
83612
  fetchingZapQuote ||
81135
83613
  zapError ||
81136
- exceedsMaxBuy ||
83614
+ exceedsRealMaxBuy ||
81137
83615
  exceedsBalance ||
81138
83616
  (isZap && !jupiterQuote) ||
81139
- SDKConfig.blockSales, onClick: handleOpenModal, sx: { width: ['100%', '100%', '100%', '65%'] }, children: SDKConfig.blockSales
83617
+ SDKConfig.blockSales, onClick: handleOpenModal, sx: { width: ['100%', '100%', '100%', '65%'], fontSize: ['14px', '14px', '14px', '16px'] }, children: SDKConfig.blockSales
81140
83618
  ? 'Complete KYC to Buy'
81141
- : exceedsMaxBuy
81142
- ? 'Exceeds Max Buy'
83619
+ : exceedsRealMaxBuy
83620
+ ? 'Exceeds Max Buy. Reduce amount'
81143
83621
  : exceedsBalance
81144
83622
  ? 'Insufficient balance'
81145
83623
  : zapError
@@ -81239,7 +83717,7 @@ const ModalHandler = ({ onDismiss, bondAddress, bondChain, }) => {
81239
83717
  };
81240
83718
 
81241
83719
  const ParticipationSuccessful = ({ onDismiss, bond, inputAmount, }) => {
81242
- var _a, _b, _c, _d, _e, _f, _g, _h;
83720
+ var _a, _b, _c, _d, _e, _f, _g;
81243
83721
  const { data: tokenPrices } = useTokenPrices();
81244
83722
  const principalTokenPrice = (_b = (_a = tokenPrices === null || tokenPrices === void 0 ? void 0 : tokenPrices[bond === null || bond === void 0 ? void 0 : bond.chainId]) === null || _a === void 0 ? void 0 : _a.find((token) => { var _a, _b, _c; return ((_a = token === null || token === void 0 ? void 0 : token.tokenAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_c = (_b = bond === null || bond === void 0 ? void 0 : bond.lpToken) === null || _b === void 0 ? void 0 : _b.address[bond === null || bond === void 0 ? void 0 : bond.chainId]) === null || _c === void 0 ? void 0 : _c.toLowerCase()); })) === null || _b === void 0 ? void 0 : _b.price;
81245
83723
  const inputValue = parseFloat(inputAmount !== null && inputAmount !== void 0 ? inputAmount : '0');
@@ -81285,7 +83763,7 @@ const ParticipationSuccessful = ({ onDismiss, bond, inputAmount, }) => {
81285
83763
  }, children: [getFirstNonZeroDigits(initialReleaseAmount, 2), " ", bond === null || bond === void 0 ? void 0 : bond.earnToken.symbol, jsxs(Flex, { sx: {
81286
83764
  color: 'textDisabledButton',
81287
83765
  ml: '5px',
81288
- }, children: ["($", initialReleaseUsd.toFixed(2), ")"] })] })] }), initialRelease !== 1 && (jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', mt: '5px' }, children: [jsxs(Flex, { sx: { fontSize: '12px', fontWeight: 400 }, children: ["Vested Tokens", jsx$2(TooltipBubble, { placement: 'bottomLeft', transformTip: 'translate(-6%, 0%)', width: "250px", body: jsx$2(Flex, { sx: { justifyContent: 'center' }, children: `Remaining tokens will vest linearly over ${getTimePeriods((_h = bond.vestingTerm) !== null && _h !== void 0 ? _h : 0).months} months after claiming the initial release.` }), children: jsx$2(Flex, { sx: { alignItems: 'center', height: '100%', ml: '5px' }, children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs(Flex, { sx: {
83766
+ }, children: ["($", initialReleaseUsd.toFixed(2), ")"] })] })] }), initialRelease !== 1 && (jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', mt: '5px' }, children: [jsxs(Flex, { sx: { fontSize: '12px', fontWeight: 400 }, children: ["Vested Tokens", jsx$2(TooltipBubble, { placement: 'bottomLeft', transformTip: 'translate(-6%, 0%)', width: "250px", body: jsx$2(Flex, { sx: { justifyContent: 'center' }, children: `Remaining tokens will vest linearly over ${getTimePeriods(bond.vestingTerm).months} months after claiming the initial release.` }), children: jsx$2(Flex, { sx: { alignItems: 'center', height: '100%', ml: '5px' }, children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs(Flex, { sx: {
81289
83767
  fontSize: '12px',
81290
83768
  fontWeight: 500,
81291
83769
  }, children: [getFirstNonZeroDigits(vestedAmount, 2), " ", bond === null || bond === void 0 ? void 0 : bond.earnToken.symbol, jsxs(Flex, { sx: { color: 'textDisabledButton', ml: '5px' }, children: ["($", vestedAmountUsd.toFixed(2), ")"] })] })] })), jsx$2(Flex, { sx: { mt: '10px' }, children: `Your purchased bond can be found under the "Your Bonds" tab.` })] }), jsx$2(Button, { onClick: onDismiss, sx: { fontSize: '16px', width: '100%', mt: '15px' }, children: "Close" })] })] }));
@@ -81337,7 +83815,7 @@ function formatUTCDate(date, short = false) {
81337
83815
  }
81338
83816
 
81339
83817
  const BondCardsPreTGE = ({ bond }) => {
81340
- var _a, _b, _c, _d, _e, _f, _g, _h;
83818
+ var _a, _b, _c, _d, _e, _f;
81341
83819
  const isMobile = useIsMobile();
81342
83820
  const bonus = (_b = (_a = bond === null || bond === void 0 ? void 0 : bond.trueBondPrices) === null || _a === void 0 ? void 0 : _a[0].bonus) !== null && _b !== void 0 ? _b : 0;
81343
83821
  const airdropBonus = (_c = bond.airdropBonus) !== null && _c !== void 0 ? _c : 0;
@@ -81384,7 +83862,7 @@ const BondCardsPreTGE = ({ bond }) => {
81384
83862
  borderBottomRightRadius: 'normal',
81385
83863
  borderBottomLeftRadius: 'normal',
81386
83864
  },
81387
- }, children: [jsxs("div", { className: "bond-card-title", children: ["Vesting Terms", initialRelease !== 100 && (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsxs(Flex, { children: ["Remaining tokens will vest linearly over ", getTimePeriods((_e = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _e !== void 0 ? _e : 0).months, " months after", ' ', formatUTCDate(new Date(parseInt((_f = bond.startVestingTimestamp) !== null && _f !== void 0 ? _f : '0') * 1000)), " UTC."] }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }))] }), initialRelease === 100 ? `0 D` : `${(_h = getTimePeriods((_g = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _g !== void 0 ? _g : 0)) === null || _h === void 0 ? void 0 : _h.months} Mo`] })] }));
83865
+ }, children: [jsxs("div", { className: "bond-card-title", children: ["Vesting Terms", initialRelease !== 100 && (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsxs(Flex, { children: ["Remaining tokens will vest linearly over ", getTimePeriods(bond === null || bond === void 0 ? void 0 : bond.vestingTerm).months, " months after", ' ', formatUTCDate(new Date(parseInt((_e = bond.startVestingTimestamp) !== null && _e !== void 0 ? _e : '0') * 1000)), " UTC."] }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }))] }), initialRelease === 100 ? `0 D` : `${(_f = getTimePeriods(bond === null || bond === void 0 ? void 0 : bond.vestingTerm)) === null || _f === void 0 ? void 0 : _f.months} Mo`] })] }));
81388
83866
  };
81389
83867
 
81390
83868
  const BuyComponentPreTGE = ({ bondAddress, bondChain, onDismiss, handlePurchasedBond, }) => {
@@ -81586,8 +84064,7 @@ const styles$8 = {
81586
84064
  };
81587
84065
 
81588
84066
  const SmallRecommendationCard = ({ recommendation }) => {
81589
- var _a;
81590
- const vestingTime = getTimePeriods((_a = recommendation.vestingTerm) !== null && _a !== void 0 ? _a : 0, true);
84067
+ const vestingTime = getTimePeriods(recommendation.vestingTerm, true);
81591
84068
  return (jsxs(Flex, { sx: styles$8.smallCardContainer, onClick: () => window.open(`${window.location.origin}/bonds?bondAddress=${recommendation.contractAddress}&bondChain=${recommendation.chainId}`, '_self'), children: [jsxs(Flex, { sx: { alignItems: 'center' }, children: [jsx$2(TokenImage, { symbol: recommendation.payoutTokenName, size: 32, chain: recommendation.chainId }), jsxs(Flex, { sx: { mx: '10px', alignItems: 'center' }, children: [jsx$2(Flex, { sx: { fontSize: '14px', px: '6px' }, children: recommendation.payoutTokenName }), jsxs(Flex, { sx: styles$8.subTitle, children: [vestingTime.days, "D"] })] })] }), jsxs(Flex, { sx: { alignItems: 'center' }, children: [jsx$2(Flex, { sx: styles$8.subTitle, children: "Bonus" }), jsxs(Flex, { sx: { fontSize: '12px', color: recommendation.bonus > 0 ? 'success' : 'error', ml: '6px' }, children: [recommendation.bonus.toFixed(2), "%"] })] })] }));
81592
84069
  };
81593
84070
 
@@ -81940,7 +84417,9 @@ const HotBondCard = ({ bond }) => {
81940
84417
  },
81941
84418
  });
81942
84419
  };
81943
- return (jsx$2(Flex, { sx: styles$7.desktopCard, className: "hot-bond-card", onClick: handleOpenModal, children: jsxs(Flex, { sx: { flexDirection: 'column', width: '100%' }, children: [jsxs(Flex, { sx: { width: '100%', height: '75px' }, children: [jsx$2(Flex, { sx: { width: '66.66%' }, children: jsx$2(TokenInfoAndName, { tokenSymbol: bond.earnToken.symbol, chain: bond.chainId, tag: (_d = bond.tags) === null || _d === void 0 ? void 0 : _d[0], isHotBond: true }) }), jsx$2(Flex, { className: "column column-tokenicons", sx: { width: '33.33% !important', justifyContent: 'center !important', alignItems: 'center' }, children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (_g = (_f = (_e = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _e === void 0 ? void 0 : _e.address) === null || _f === void 0 ? void 0 : _f[bond === null || bond === void 0 ? void 0 : bond.chainId]) !== null && _g !== void 0 ? _g : '', earnTokenSymbol: (_j = (_h = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _h === void 0 ? void 0 : _h.symbol) !== null && _j !== void 0 ? _j : '', bondContract: (_l = (_k = bond === null || bond === void 0 ? void 0 : bond.contractAddress) === null || _k === void 0 ? void 0 : _k[bond === null || bond === void 0 ? void 0 : bond.chainId]) !== null && _l !== void 0 ? _l : '', projectLink: bond === null || bond === void 0 ? void 0 : bond.projectLink, twitter: bond === null || bond === void 0 ? void 0 : bond.twitter, audit: bond === null || bond === void 0 ? void 0 : bond.audit, chain: bond === null || bond === void 0 ? void 0 : bond.chainId }), width: "205px", placement: "bottomRight", transformTip: "translate(11%, 0%)", children: jsx$2(Svg, { icon: "more", width: "20px" }) }) })] }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-around' }, children: [jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', width: '100%' }, children: [jsx$2(Flex, { sx: { opacity: 0.6, fontSize: '12px', fontWeight: 400 }, children: "Bonus" }), jsx$2(Flex, { className: `${getDiscountColor(bonus)}`, sx: { width: '100%', justifyContent: 'center' }, children: bonus !== undefined ? (bonus < 0 ? '0%' : `${bonus === null || bonus === void 0 ? void 0 : bonus.toFixed(2)}%`) : '-' })] }), jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', width: '100%' }, children: [jsx$2(Flex, { sx: { opacity: 0.6, fontSize: '12px', fontWeight: 400, width: '100%', justifyContent: 'center' }, children: "ARR" }), jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center' }, children: calculateARR(bond, SDKConfig.useTiers) })] }), jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', width: '100%' }, children: [jsx$2(Flex, { sx: { opacity: 0.6, fontSize: '12px', fontWeight: 400, width: '100%', justifyContent: 'center' }, children: "Terms" }), jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center' }, children: ((_m = vestingTime(bond === null || bond === void 0 ? void 0 : bond.vestingTerm)) === null || _m === void 0 ? void 0 : _m.days) ? `${(_o = vestingTime(bond === null || bond === void 0 ? void 0 : bond.vestingTerm)) === null || _o === void 0 ? void 0 : _o.days} D` : '-' })] })] })] }) }));
84420
+ return (jsx$2(Flex, { sx: styles$7.desktopCard, className: "hot-bond-card", onClick: handleOpenModal, children: jsxs(Flex, { sx: { flexDirection: 'column', width: '100%' }, children: [jsxs(Flex, { sx: { width: '100%', height: '75px' }, children: [jsx$2(Flex, { sx: { width: '66.66%' }, children: jsx$2(TokenInfoAndName, { tokenSymbol: bond.earnToken.symbol, chain: bond.chainId, tag: (_d = bond.tags) === null || _d === void 0 ? void 0 : _d[0], isHotBond: true }) }), jsx$2(Flex, { className: "column column-tokenicons", sx: { width: '33.33% !important', justifyContent: 'center !important', alignItems: 'center' }, children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (_g = (_f = (_e = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _e === void 0 ? void 0 : _e.address) === null || _f === void 0 ? void 0 : _f[bond === null || bond === void 0 ? void 0 : bond.chainId]) !== null && _g !== void 0 ? _g : '', earnTokenSymbol: (_j = (_h = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _h === void 0 ? void 0 : _h.symbol) !== null && _j !== void 0 ? _j : '', bondContract: (_l = (_k = bond === null || bond === void 0 ? void 0 : bond.contractAddress) === null || _k === void 0 ? void 0 : _k[bond === null || bond === void 0 ? void 0 : bond.chainId]) !== null && _l !== void 0 ? _l : '', projectLink: bond === null || bond === void 0 ? void 0 : bond.projectLink, twitter: bond === null || bond === void 0 ? void 0 : bond.twitter, audit: bond === null || bond === void 0 ? void 0 : bond.audit, chain: bond === null || bond === void 0 ? void 0 : bond.chainId }), width: "205px", placement: "bottomRight", transformTip: "translate(11%, 0%)", children: jsx$2(Svg, { icon: "more", width: "20px" }) }) })] }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-around' }, children: [jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', width: '100%' }, children: [jsx$2(Flex, { sx: { opacity: 0.6, fontSize: '12px', fontWeight: 400 }, children: "Bonus" }), jsx$2(Flex, { className: `${getDiscountColor(bonus)}`, sx: { width: '100%', justifyContent: 'center' }, children: bonus !== undefined ? (bonus < 0 ? '0%' : `${bonus === null || bonus === void 0 ? void 0 : bonus.toFixed(2)}%`) : '-' })] }), jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', width: '100%' }, children: [jsx$2(Flex, { sx: { opacity: 0.6, fontSize: '12px', fontWeight: 400, width: '100%', justifyContent: 'center' }, children: "ARR" }), jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center' }, children: calculateARR(bond, SDKConfig.useTiers) })] }), jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', width: '100%' }, children: [jsx$2(Flex, { sx: { opacity: 0.6, fontSize: '12px', fontWeight: 400, width: '100%', justifyContent: 'center' }, children: "Terms" }), jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center' }, children: ((_m = getTimePeriods(bond === null || bond === void 0 ? void 0 : bond.vestingTerm, true)) === null || _m === void 0 ? void 0 : _m.days)
84421
+ ? `${(_o = getTimePeriods(bond === null || bond === void 0 ? void 0 : bond.vestingTerm, true)) === null || _o === void 0 ? void 0 : _o.days} D`
84422
+ : '-' })] })] })] }) }));
81944
84423
  };
81945
84424
 
81946
84425
  /**
@@ -87211,7 +89690,7 @@ const ActiveBondRows = ({ chain, bonds, hideTitles, showHotBonds }) => {
87211
89690
  marginTop: '0px',
87212
89691
  }, className: "bonds-card-container", children: [[main.ChainId.SOL, main.ChainId.MONAD].includes(chain) && !hideTitles && jsx$2(ChainBanner, { chainId: chain }), bonds === null || bonds === void 0 ? void 0 : bonds.map((bondFromMap, index) => {
87213
89692
  // PRE TGE ROWS
87214
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
89693
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
87215
89694
  if (bondFromMap.billType === 'fcfs') {
87216
89695
  const bond = bondFromMap;
87217
89696
  const totalPrincipalBilled = Math.round(getBalanceNumber(new BigNumber$1((_a = bond === null || bond === void 0 ? void 0 : bond.totalPrincipalBilled) !== null && _a !== void 0 ? _a : '0'), (_c = (_b = bond === null || bond === void 0 ? void 0 : bond.lpToken) === null || _b === void 0 ? void 0 : _b.decimals) === null || _c === void 0 ? void 0 : _c[bond === null || bond === void 0 ? void 0 : bond.chainId])) / ((_d = bond.initPrice) !== null && _d !== void 0 ? _d : 0);
@@ -87233,14 +89712,14 @@ const ActiveBondRows = ({ chain, bonds, hideTitles, showHotBonds }) => {
87233
89712
  ? '-'
87234
89713
  : initialRelease === 100
87235
89714
  ? `0 D`
87236
- : `${getTimePeriods((_u = bond.vestingTerm) !== null && _u !== void 0 ? _u : 0).months} Mo`, projectURL: bond.projectLink, twitterURL: bond.twitter, auditURL: bond.audit, bondSoldOut: saleHasFinished, shortDescription: bond.shortDescription }, `${bond.contractAddress}-${bond.chainId}-${index}`));
89715
+ : `${getTimePeriods(bond.vestingTerm).months} Mo`, projectURL: bond.projectLink, twitterURL: bond.twitter, auditURL: bond.audit, bondSoldOut: saleHasFinished, shortDescription: bond.shortDescription }, `${bond.contractAddress}-${bond.chainId}-${index}`));
87237
89716
  }
87238
89717
  else {
87239
89718
  // POST TGE BONDS AKA NORMAL BONDS
87240
89719
  const bond = bondFromMap;
87241
- const bondAddress = (_v = bond === null || bond === void 0 ? void 0 : bond.contractAddress) === null || _v === void 0 ? void 0 : _v[bond === null || bond === void 0 ? void 0 : bond.chainId];
89720
+ const bondAddress = (_u = bond === null || bond === void 0 ? void 0 : bond.contractAddress) === null || _u === void 0 ? void 0 : _u[bond === null || bond === void 0 ? void 0 : bond.chainId];
87242
89721
  const remainingTokensString = getRemainingTokensString(bond);
87243
- return (jsx$2(BondRow, { bondAddress: bondAddress, bondChain: bond.chainId, marketingCampaign: bond.marketingCampaign, payoutToken: bond.earnToken, billType: bond.billType, tag: (_w = bond.tags) === null || _w === void 0 ? void 0 : _w[0], trueBondPrices: namingPreference === 'Bonus' ? bond.trueBondPrices : undefined, minTier: bond === null || bond === void 0 ? void 0 : bond.minTier, vestingTermString: getVestingTermsString(bond), vestingCliffString: getVestingTermsTooltipString(bond), percentageAvailable: remainingPercentage(bond), remainingTokensString: remainingTokensString, projectURL: bond.projectLink, twitterURL: bond.twitter, auditURL: bond.audit, bonus: namingPreference === 'Discount' ? `${(_x = bond === null || bond === void 0 ? void 0 : bond.discountWithFee) === null || _x === void 0 ? void 0 : _x.toFixed(2)}%` : undefined, shortDescription: bond.shortDescription }, `${bondAddress}-${bond.chainId}-${index}`));
89722
+ return (jsx$2(BondRow, { bondAddress: bondAddress, bondChain: bond.chainId, marketingCampaign: bond.marketingCampaign, payoutToken: bond.earnToken, billType: bond.billType, tag: (_v = bond.tags) === null || _v === void 0 ? void 0 : _v[0], trueBondPrices: namingPreference === 'Bonus' ? bond.trueBondPrices : undefined, minTier: bond === null || bond === void 0 ? void 0 : bond.minTier, vestingTermString: getVestingTermsString(bond), vestingCliffString: getVestingTermsTooltipString(bond), percentageAvailable: remainingPercentage(bond), remainingTokensString: remainingTokensString, projectURL: bond.projectLink, twitterURL: bond.twitter, auditURL: bond.audit, bonus: namingPreference === 'Discount' ? `${(_w = bond === null || bond === void 0 ? void 0 : bond.discountWithFee) === null || _w === void 0 ? void 0 : _w.toFixed(2)}%` : undefined, shortDescription: bond.shortDescription }, `${bondAddress}-${bond.chainId}-${index}`));
87244
89723
  }
87245
89724
  }), showHotBonds && (jsx$2(SwiperProvider, { children: jsx$2(HotBondCards, {}) }))] }, key))] }) }, key));
87246
89725
  };