@strkfarm/sdk 2.0.0-dev.9 → 2.0.0-staging.2

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.
Files changed (64) hide show
  1. package/dist/index.browser.global.js +111371 -93151
  2. package/dist/index.browser.mjs +27815 -32690
  3. package/dist/index.d.ts +1095 -2011
  4. package/dist/index.js +27425 -32309
  5. package/dist/index.mjs +27590 -32452
  6. package/package.json +6 -5
  7. package/src/data/ekubo-price-fethcer.abi.json +265 -0
  8. package/src/data/universal-vault.abi.json +20 -135
  9. package/src/dataTypes/address.ts +0 -7
  10. package/src/dataTypes/index.ts +3 -2
  11. package/src/dataTypes/mynumber.ts +141 -0
  12. package/src/global.ts +296 -288
  13. package/src/index.browser.ts +6 -5
  14. package/src/interfaces/common.tsx +324 -184
  15. package/src/modules/apollo-client-config.ts +28 -0
  16. package/src/modules/avnu.ts +4 -17
  17. package/src/modules/ekubo-pricer.ts +79 -0
  18. package/src/modules/ekubo-quoter.ts +11 -88
  19. package/src/modules/erc20.ts +21 -67
  20. package/src/modules/harvests.ts +26 -15
  21. package/src/modules/index.ts +11 -13
  22. package/src/modules/lst-apr.ts +0 -36
  23. package/src/modules/pragma.ts +23 -8
  24. package/src/modules/pricer-from-api.ts +150 -14
  25. package/src/modules/pricer.ts +2 -1
  26. package/src/modules/pricerBase.ts +2 -1
  27. package/src/node/deployer.ts +36 -1
  28. package/src/node/pricer-redis.ts +2 -1
  29. package/src/strategies/autoCompounderStrk.ts +1 -1
  30. package/src/strategies/base-strategy.ts +5 -22
  31. package/src/strategies/ekubo-cl-vault.tsx +2904 -2175
  32. package/src/strategies/factory.ts +165 -0
  33. package/src/strategies/index.ts +10 -11
  34. package/src/strategies/registry.ts +268 -0
  35. package/src/strategies/sensei.ts +416 -292
  36. package/src/strategies/universal-adapters/adapter-utils.ts +1 -5
  37. package/src/strategies/universal-adapters/baseAdapter.ts +153 -181
  38. package/src/strategies/universal-adapters/common-adapter.ts +77 -98
  39. package/src/strategies/universal-adapters/index.ts +1 -5
  40. package/src/strategies/universal-adapters/vesu-adapter.ts +218 -220
  41. package/src/strategies/universal-adapters/vesu-supply-only-adapter.ts +51 -58
  42. package/src/strategies/universal-lst-muliplier-strategy.tsx +1952 -992
  43. package/src/strategies/universal-strategy.tsx +1713 -1150
  44. package/src/strategies/vesu-rebalance.tsx +1189 -986
  45. package/src/utils/health-factor-math.ts +5 -11
  46. package/src/utils/index.ts +8 -9
  47. package/src/utils/strategy-utils.ts +57 -0
  48. package/src/data/extended-deposit.abi.json +0 -3613
  49. package/src/modules/ExtendedWrapperSDk/index.ts +0 -62
  50. package/src/modules/ExtendedWrapperSDk/types.ts +0 -311
  51. package/src/modules/ExtendedWrapperSDk/wrapper.ts +0 -395
  52. package/src/modules/midas.ts +0 -159
  53. package/src/modules/token-market-data.ts +0 -202
  54. package/src/strategies/svk-strategy.ts +0 -247
  55. package/src/strategies/universal-adapters/adapter-optimizer.ts +0 -65
  56. package/src/strategies/universal-adapters/avnu-adapter.ts +0 -413
  57. package/src/strategies/universal-adapters/extended-adapter.ts +0 -972
  58. package/src/strategies/universal-adapters/unused-balance-adapter.ts +0 -109
  59. package/src/strategies/universal-adapters/vesu-multiply-adapter.ts +0 -1306
  60. package/src/strategies/vesu-extended-strategy/services/operationService.ts +0 -34
  61. package/src/strategies/vesu-extended-strategy/utils/config.runtime.ts +0 -77
  62. package/src/strategies/vesu-extended-strategy/utils/constants.ts +0 -49
  63. package/src/strategies/vesu-extended-strategy/utils/helper.ts +0 -370
  64. package/src/strategies/vesu-extended-strategy/vesu-extended-strategy.tsx +0 -1379
@@ -1,109 +0,0 @@
1
- import { ContractAddr, Web3Number } from "@/dataTypes";
2
- import { APYType, BaseAdapter, BaseAdapterConfig, DepositParams, ManageCall, PositionAmount, PositionAPY, PositionInfo, SupportedPosition, WithdrawParams } from "./baseAdapter";
3
- import { Contract, uint256 } from "starknet";
4
- import erc20Abi from "@/data/erc20.abi.json";
5
- import { ERC20, TokenMarketData } from "@/modules";
6
- import { Protocols } from "@/interfaces";
7
-
8
- export interface UnusedBalanceAdapterConfig extends BaseAdapterConfig {}
9
-
10
- export class UnusedBalanceAdapter extends BaseAdapter<DepositParams, WithdrawParams> {
11
- readonly config: UnusedBalanceAdapterConfig;
12
- readonly tokenMarketData: TokenMarketData;
13
-
14
- constructor(config: UnusedBalanceAdapterConfig) {
15
- super(config, UnusedBalanceAdapter.name, Protocols.NONE);
16
- this.config = config;
17
- this.tokenMarketData = new TokenMarketData(this.config.pricer, this.config.networkConfig);
18
- }
19
-
20
- protected async getAPY(_supportedPosition: SupportedPosition): Promise<PositionAPY> {
21
- const isSupported = this.tokenMarketData.isAPYSupported(this.config.baseToken);
22
- const apy = isSupported ? await this.tokenMarketData.getAPY(this.config.baseToken) : 0;
23
- return { apy: apy, type: isSupported ? APYType.LST : APYType.BASE };
24
- }
25
-
26
- protected async getPosition(supportedPosition: SupportedPosition): Promise<PositionAmount> {
27
- try {
28
- const balance = await (new ERC20(this.config.networkConfig)).balanceOf(supportedPosition.asset.address, this.config.vaultAllocator.address, supportedPosition.asset.decimals);
29
- return {
30
- amount: balance,
31
- remarks: "Unused balance"
32
- }
33
- } catch (_e) {
34
- throw new Error(`${UnusedBalanceAdapter.name}: Failed to get position for ${supportedPosition.asset.symbol}`);
35
- }
36
- }
37
-
38
- async maxDeposit(amount?: Web3Number): Promise<PositionInfo> {
39
- const baseToken = this.config.baseToken;
40
- if (!amount) {
41
- const infinite = new Web3Number('999999999999999999999999999', baseToken.decimals);
42
- return {
43
- tokenInfo: baseToken,
44
- amount: infinite,
45
- usdValue: Number.POSITIVE_INFINITY,
46
- remarks: "Max deposit (infinity)",
47
- apy: await this.getAPY({ asset: baseToken, isDebt: false }),
48
- protocol: this.protocol
49
- };
50
- }
51
- const usdValue = await this.getUSDValue(baseToken, amount);
52
- return {
53
- tokenInfo: baseToken,
54
- amount,
55
- usdValue,
56
- remarks: "Deposit amount",
57
- apy: await this.getAPY({ asset: baseToken, isDebt: false }),
58
- protocol: this.protocol
59
- };
60
- }
61
-
62
- async maxWithdraw(): Promise<PositionInfo> {
63
- const baseToken = this.config.baseToken;
64
- const current = await this.getPosition({ asset: baseToken, isDebt: false });
65
- const usdValue = await this.getUSDValue(baseToken, current.amount);
66
- return {
67
- tokenInfo: baseToken,
68
- amount: current.amount,
69
- usdValue,
70
- remarks: "Max withdraw",
71
- apy: await this.getAPY({ asset: baseToken, isDebt: false }),
72
- protocol: this.protocol
73
- };
74
- }
75
-
76
- protected _getDepositLeaf(): {
77
- target: ContractAddr,
78
- method: string,
79
- packedArguments: bigint[];
80
- sanitizer: ContractAddr,
81
- id: string
82
- }[] {
83
- return [];
84
- }
85
-
86
- protected _getWithdrawLeaf(): {
87
- target: ContractAddr,
88
- method: string,
89
- packedArguments: bigint[];
90
- sanitizer: ContractAddr,
91
- id: string
92
- }[] {
93
- return [];
94
- }
95
-
96
- async getHealthFactor(): Promise<number> {
97
- return Promise.resolve(10);
98
- }
99
-
100
- getDepositCall(params: DepositParams): Promise<ManageCall[]> {
101
- return Promise.resolve([]);
102
- }
103
-
104
- getWithdrawCall(params: WithdrawParams): Promise<ManageCall[]> {
105
- return Promise.resolve([]);
106
- }
107
- }
108
-
109
-