@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.
- package/dist/index.browser.global.js +669 -4229
- package/dist/index.browser.mjs +669 -4229
- package/dist/index.d.ts +2 -2
- package/dist/index.js +669 -4229
- package/dist/index.mjs +669 -4229
- package/package.json +3 -4
- package/src/data/vesu_pools.json +5342 -8914
- package/src/modules/avnu.ts +6 -4
- package/src/modules/harvests.ts +10 -1
- package/src/strategies/ekubo-cl-vault.tsx +59 -59
- package/src/strategies/vesu-rebalance.tsx +1 -1
package/src/modules/avnu.ts
CHANGED
|
@@ -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
|
-
|
|
46
|
-
excludeSources
|
|
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,
|
package/src/modules/harvests.ts
CHANGED
|
@@ -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
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
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(
|
|
503
|
+
throw new Error(`pool not found [sanity check]: ${pool.id}`);
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
506
|
} catch (e) {
|