@strkfarm/sdk 1.0.42 → 1.0.44

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.
@@ -33,7 +33,8 @@ export class AvnuWrapper {
33
33
  toToken: string,
34
34
  amountWei: string,
35
35
  taker: string,
36
- retry = 0
36
+ retry = 0,
37
+ excludeSources = ['Haiko(Solvers)']
37
38
  ): Promise<Quote> {
38
39
  const MAX_RETRY = 5;
39
40
  logger.verbose(`${AvnuWrapper.name}: getQuotes => Getting quotes for ${fromToken} -> ${toToken}, amount: ${amountWei}, taker: ${taker}, retry: ${retry}`);
@@ -42,8 +43,9 @@ export class AvnuWrapper {
42
43
  buyTokenAddress: toToken,
43
44
  sellAmount: amountWei,
44
45
  takerAddress: taker,
45
- // excludeSources: ['Nostra', 'Haiko(Solvers)']
46
- excludeSources: ['Haiko(Solvers)'] // to resolve InvalidOraclePrice error
46
+ // excludeSources: ['Nostra', 'Haiko(Solvers)']
47
+ excludeSources
48
+ // excludeSources: ['Haiko(Solvers)'] // to resolve InvalidOraclePrice error
47
49
  };
48
50
  assert(fromToken != toToken, "From and to tokens are the same");
49
51
 
@@ -59,7 +61,7 @@ export class AvnuWrapper {
59
61
  }
60
62
 
61
63
  async getSwapInfo(
62
- quote: Quote,
64
+ quote: Pick<Quote, 'quoteId' | 'buyTokenAddress' | 'buyAmount' | 'sellTokenAddress' | 'sellAmount'>,
63
65
  taker: string,
64
66
  integratorFeeBps: number,
65
67
  integratorFeeRecipient: string,
@@ -3,6 +3,7 @@ import { logger } from "@/utils/logger";
3
3
  import { IConfig } from "@/interfaces";
4
4
  import { assert } from "@/utils";
5
5
  import { Contract, num } from "starknet";
6
+ import { ERC20 } from "./erc20";
6
7
 
7
8
  export interface HarvestInfo {
8
9
  rewardsContract: ContractAddr,
@@ -36,8 +37,16 @@ export class Harvests {
36
37
  const contract = new Contract(cls.abi, reward.rewardsContract.address, this.config.provider);
37
38
  const isClaimed = await contract.call('is_claimed', [reward.claim.id]);
38
39
  logger.verbose(`${Harvests.name}: isClaimed: ${isClaimed}`);
39
- if (isClaimed)
40
+ if (isClaimed) {
40
41
  return unClaimed;
42
+ }
43
+ // rewards contract must have enough balance to claim
44
+ const bal = await (new ERC20(this.config)).balanceOf(reward.token, reward.rewardsContract.address, 18);
45
+ if (bal.lessThan(reward.claim.amount)) {
46
+ logger.verbose(`${Harvests.name}: balance: ${bal.toString()}, amount: ${reward.claim.amount.toString()}`);
47
+ continue;
48
+ }
49
+
41
50
  unClaimed.unshift(reward); // to ensure older harvest is first
42
51
  }
43
52
  return unClaimed;
@@ -1626,63 +1626,63 @@ export const EkuboCLVaultStrategies: IStrategyMetadata<CLVaultStrategySettings>[
1626
1626
  },
1627
1627
  ],
1628
1628
  },
1629
- {
1630
- name: "Ekubo USDC/USDT",
1631
- description: (
1632
- <div>
1633
- <p>{_description.replace("{{POOL_NAME}}", "USDC/USDT")}</p>
1634
- <ul
1635
- style={{
1636
- marginLeft: "20px",
1637
- listStyle: "circle",
1638
- fontSize: "12px",
1639
- }}
1640
- >
1641
- <li style={{ marginTop: "10px" }}>
1642
- During withdrawal, you may receive either or both tokens depending
1643
- on market conditions and prevailing prices.
1644
- </li>
1645
- </ul>
1646
- </div>
1647
- ),
1648
- address: ContractAddr.from(
1649
- "0xd647ed735f0db52f2a5502b6e06ed21dc4284a43a36af4b60d3c80fbc56c91"
1650
- ),
1651
- launchBlock: 1385576,
1652
- type: "Other",
1653
- // must be same order as poolKey token0 and token1
1654
- depositTokens: [
1655
- Global.getDefaultTokens().find((t) => t.symbol === "USDC")!,
1656
- Global.getDefaultTokens().find((t) => t.symbol === "USDT")!,
1657
- ],
1658
- protocols: [_protocol],
1659
- auditUrl: AUDIT_URL,
1660
- maxTVL: Web3Number.fromWei("0", 6),
1661
- risk: {
1662
- riskFactor: _riskFactorStable,
1663
- netRisk:
1664
- _riskFactorStable.reduce(
1665
- (acc, curr) => acc + curr.value * curr.weight,
1666
- 0
1667
- ) / _riskFactorStable.reduce((acc, curr) => acc + curr.weight, 0),
1668
- notARisks: getNoRiskTags(_riskFactorStable),
1669
- },
1670
- apyMethodology:
1671
- "APY based on 7-day historical performance, including fees and rewards.",
1672
- additionalInfo: {
1673
- newBounds: {
1674
- lower: -1,
1675
- upper: 1,
1676
- },
1677
- truePrice: 1,
1678
- feeBps: 1000,
1679
- rebalanceConditions: {
1680
- customShouldRebalance: async (currentPrice: number) =>
1681
- currentPrice > 0.99 && currentPrice < 1.01,
1682
- minWaitHours: 6,
1683
- direction: "any",
1684
- },
1685
- },
1686
- faqs: [...faqs],
1687
- },
1629
+ // {
1630
+ // name: "Ekubo USDC/USDT",
1631
+ // description: (
1632
+ // <div>
1633
+ // <p>{_description.replace("{{POOL_NAME}}", "USDC/USDT")}</p>
1634
+ // <ul
1635
+ // style={{
1636
+ // marginLeft: "20px",
1637
+ // listStyle: "circle",
1638
+ // fontSize: "12px",
1639
+ // }}
1640
+ // >
1641
+ // <li style={{ marginTop: "10px" }}>
1642
+ // During withdrawal, you may receive either or both tokens depending
1643
+ // on market conditions and prevailing prices.
1644
+ // </li>
1645
+ // </ul>
1646
+ // </div>
1647
+ // ),
1648
+ // address: ContractAddr.from(
1649
+ // "0xd647ed735f0db52f2a5502b6e06ed21dc4284a43a36af4b60d3c80fbc56c91"
1650
+ // ),
1651
+ // launchBlock: 1385576,
1652
+ // type: "Other",
1653
+ // // must be same order as poolKey token0 and token1
1654
+ // depositTokens: [
1655
+ // Global.getDefaultTokens().find((t) => t.symbol === "USDC")!,
1656
+ // Global.getDefaultTokens().find((t) => t.symbol === "USDT")!,
1657
+ // ],
1658
+ // protocols: [_protocol],
1659
+ // auditUrl: AUDIT_URL,
1660
+ // maxTVL: Web3Number.fromWei("0", 6),
1661
+ // risk: {
1662
+ // riskFactor: _riskFactorStable,
1663
+ // netRisk:
1664
+ // _riskFactorStable.reduce(
1665
+ // (acc, curr) => acc + curr.value * curr.weight,
1666
+ // 0
1667
+ // ) / _riskFactorStable.reduce((acc, curr) => acc + curr.weight, 0),
1668
+ // notARisks: getNoRiskTags(_riskFactorStable),
1669
+ // },
1670
+ // apyMethodology:
1671
+ // "APY based on 7-day historical performance, including fees and rewards.",
1672
+ // additionalInfo: {
1673
+ // newBounds: {
1674
+ // lower: -1,
1675
+ // upper: 1,
1676
+ // },
1677
+ // truePrice: 1,
1678
+ // feeBps: 1000,
1679
+ // rebalanceConditions: {
1680
+ // customShouldRebalance: async (currentPrice: number) =>
1681
+ // currentPrice > 0.99 && currentPrice < 1.01,
1682
+ // minWaitHours: 6,
1683
+ // direction: "any",
1684
+ // },
1685
+ // },
1686
+ // faqs: [...faqs],
1687
+ // },
1688
1688
  ];
@@ -500,7 +500,7 @@ export class VesuRebalance extends BaseStrategy<
500
500
  logger.verbose(
501
501
  `VesuRebalance: Pool ${pool.id} not found in Vesu API, using hardcoded data`
502
502
  );
503
- throw new Error("pool not found [sanity check]");
503
+ throw new Error(`pool not found [sanity check]: ${pool.id}`);
504
504
  }
505
505
  }
506
506
  } catch (e) {