@defisaver/positions-sdk 2.1.7 → 2.1.9
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/cjs/aaveV3/index.js +3 -3
- package/cjs/aaveV3/merit.js +3 -0
- package/cjs/aaveV3/merkl.d.ts +1 -1
- package/cjs/config/contracts.d.ts +20 -0
- package/cjs/config/contracts.js +20 -0
- package/cjs/fluid/index.js +40 -12
- package/cjs/helpers/aaveHelpers/index.d.ts +1 -1
- package/cjs/helpers/aaveHelpers/index.js +6 -4
- package/cjs/helpers/morphoBlueHelpers/index.d.ts +1 -1
- package/cjs/markets/aave/index.js +1 -1
- package/cjs/markets/aave/marketAssets.d.ts +4 -0
- package/cjs/markets/aave/marketAssets.js +5 -1
- package/cjs/markets/compound/index.js +11 -0
- package/cjs/markets/compound/marketsAssets.d.ts +7 -0
- package/cjs/markets/compound/marketsAssets.js +7 -0
- package/cjs/markets/fluid/index.d.ts +4 -0
- package/cjs/markets/fluid/index.js +4 -0
- package/cjs/markets/spark/marketAssets.d.ts +1 -0
- package/cjs/markets/spark/marketAssets.js +1 -0
- package/cjs/services/utils.d.ts +8 -4
- package/cjs/services/utils.js +30 -10
- package/cjs/services/viem.d.ts +54 -15
- package/cjs/services/viem.js +2 -0
- package/cjs/staking/eligibility.js +1 -6
- package/cjs/types/common.d.ts +4 -2
- package/cjs/types/common.js +2 -0
- package/cjs/types/fluid.d.ts +7 -3
- package/cjs/types/fluid.js +4 -0
- package/esm/aaveV3/index.js +4 -4
- package/esm/aaveV3/merit.js +3 -0
- package/esm/aaveV3/merkl.d.ts +1 -1
- package/esm/config/contracts.d.ts +20 -0
- package/esm/config/contracts.js +20 -0
- package/esm/fluid/index.js +40 -12
- package/esm/helpers/aaveHelpers/index.d.ts +1 -1
- package/esm/helpers/aaveHelpers/index.js +7 -5
- package/esm/helpers/morphoBlueHelpers/index.d.ts +1 -1
- package/esm/markets/aave/index.js +1 -1
- package/esm/markets/aave/marketAssets.d.ts +4 -0
- package/esm/markets/aave/marketAssets.js +4 -0
- package/esm/markets/compound/index.js +11 -0
- package/esm/markets/compound/marketsAssets.d.ts +7 -0
- package/esm/markets/compound/marketsAssets.js +7 -0
- package/esm/markets/fluid/index.d.ts +4 -0
- package/esm/markets/fluid/index.js +4 -0
- package/esm/markets/spark/marketAssets.d.ts +1 -0
- package/esm/markets/spark/marketAssets.js +1 -0
- package/esm/services/utils.d.ts +8 -4
- package/esm/services/utils.js +21 -5
- package/esm/services/viem.d.ts +54 -15
- package/esm/services/viem.js +3 -1
- package/esm/staking/eligibility.js +1 -6
- package/esm/types/common.d.ts +4 -2
- package/esm/types/common.js +2 -0
- package/esm/types/fluid.d.ts +7 -3
- package/esm/types/fluid.js +4 -0
- package/package.json +2 -2
- package/src/aaveV3/index.ts +4 -4
- package/src/aaveV3/merit.ts +3 -0
- package/src/config/contracts.ts +20 -0
- package/src/fluid/index.ts +44 -14
- package/src/helpers/aaveHelpers/index.ts +7 -5
- package/src/markets/aave/index.ts +1 -1
- package/src/markets/aave/marketAssets.ts +5 -0
- package/src/markets/compound/index.ts +11 -0
- package/src/markets/compound/marketsAssets.ts +7 -0
- package/src/markets/fluid/index.ts +4 -0
- package/src/markets/spark/marketAssets.ts +1 -0
- package/src/services/utils.ts +25 -9
- package/src/services/viem.ts +3 -1
- package/src/staking/eligibility.ts +1 -7
- package/src/types/common.ts +2 -0
- package/src/types/fluid.ts +4 -0
|
@@ -21,7 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
import Dec from 'decimal.js';
|
|
22
22
|
import { assetAmountInWei, getAssetInfo, getAssetInfoByAddress } from '@defisaver/tokens';
|
|
23
23
|
import { AaveVersions, } from '../../types';
|
|
24
|
-
import {
|
|
24
|
+
import { getNativeAssetFromWrapped, getWrappedNativeAssetFromUnwrapped } from '../../services/utils';
|
|
25
25
|
import { aprToApy, calcLeverageLiqPrice, getAssetsTotal, isLeveragedPos, } from '../../moneymarket';
|
|
26
26
|
import { calculateNetApy } from '../../staking';
|
|
27
27
|
import { borrowOperations } from '../../constants';
|
|
@@ -52,7 +52,7 @@ export const aaveAnyGetSuppliableAsCollAssets = (_a) => {
|
|
|
52
52
|
return aaveAnyGetSuppliableAssets(Object.assign({ usedAssets, eModeCategory, assetsData, selectedMarket, network }, rest)).filter(({ canBeCollateral }) => canBeCollateral);
|
|
53
53
|
};
|
|
54
54
|
export const aaveAnyGetEmodeMutableProps = ({ eModeCategory, eModeCategoriesData, assetsData, }, _asset) => {
|
|
55
|
-
const asset =
|
|
55
|
+
const asset = getNativeAssetFromWrapped(_asset);
|
|
56
56
|
const assetData = assetsData[asset];
|
|
57
57
|
const eModeCategoryData = (eModeCategoriesData === null || eModeCategoriesData === void 0 ? void 0 : eModeCategoriesData[eModeCategory]) || { collateralAssets: [], collateralFactor: '0', liquidationRatio: '0' };
|
|
58
58
|
if (eModeCategory === 0
|
|
@@ -110,7 +110,7 @@ const getApyAfterValuesEstimationInner = (selectedMarket, actions, client, netwo
|
|
|
110
110
|
const params = actions.map(({ action, asset, amount }) => {
|
|
111
111
|
const isDebtAsset = borrowOperations.includes(action);
|
|
112
112
|
const amountInWei = assetAmountInWei(amount, asset);
|
|
113
|
-
const assetInfo = getAssetInfo(
|
|
113
|
+
const assetInfo = getAssetInfo(getWrappedNativeAssetFromUnwrapped(asset), network);
|
|
114
114
|
let liquidityAdded;
|
|
115
115
|
let liquidityTaken;
|
|
116
116
|
if (isDebtAsset) {
|
|
@@ -132,7 +132,7 @@ const getApyAfterValuesEstimationInner = (selectedMarket, actions, client, netwo
|
|
|
132
132
|
const data = yield viewContract.read.getApyAfterValuesEstimation([selectedMarket.providerAddress, params]);
|
|
133
133
|
const rates = {};
|
|
134
134
|
data.forEach((d) => {
|
|
135
|
-
const asset =
|
|
135
|
+
const asset = getNativeAssetFromWrapped(getAssetInfoByAddress(d.reserveAddress, network).symbol);
|
|
136
136
|
rates[asset] = {
|
|
137
137
|
supplyRate: aprToApy(new Dec(d.supplyRate.toString()).div(1e25).toString()),
|
|
138
138
|
borrowRate: aprToApy(new Dec(d.variableBorrowRate.toString()).div(1e25).toString()),
|
|
@@ -151,8 +151,10 @@ export const getAaveUnderlyingSymbol = (_symbol = '') => {
|
|
|
151
151
|
.replace(/^aEth/, '')
|
|
152
152
|
.replace(/^aArb/, '')
|
|
153
153
|
.replace(/^aOpt/, '')
|
|
154
|
+
.replace(/^aLin/, '')
|
|
155
|
+
.replace(/^aPla/, '')
|
|
154
156
|
.replace(/^aBas/, '');
|
|
155
157
|
if (symbol.startsWith('a'))
|
|
156
158
|
symbol = symbol.slice(1);
|
|
157
|
-
return
|
|
159
|
+
return getNativeAssetFromWrapped(symbol);
|
|
158
160
|
};
|
|
@@ -56,4 +56,4 @@ export declare const getRewardsForMarket: (marketId: string, network?: NetworkNu
|
|
|
56
56
|
supplyApy: string;
|
|
57
57
|
borrowApy: string;
|
|
58
58
|
}>;
|
|
59
|
-
export declare const getMorphoUnderlyingSymbol: (_symbol: string) =>
|
|
59
|
+
export declare const getMorphoUnderlyingSymbol: (_symbol: string) => string;
|
|
@@ -39,7 +39,7 @@ export const AAVE_V2 = {
|
|
|
39
39
|
protocolName: 'aave',
|
|
40
40
|
};
|
|
41
41
|
export const AAVE_V3 = (networkId) => ({
|
|
42
|
-
chainIds: [NetworkNumber.Eth, NetworkNumber.Opt, NetworkNumber.Arb, NetworkNumber.Base, NetworkNumber.Linea],
|
|
42
|
+
chainIds: [NetworkNumber.Eth, NetworkNumber.Opt, NetworkNumber.Arb, NetworkNumber.Base, NetworkNumber.Linea, NetworkNumber.Plasma],
|
|
43
43
|
label: networkId === NetworkNumber.Eth ? 'Aave v3 Core' : 'Aave v3',
|
|
44
44
|
shortLabel: 'v3',
|
|
45
45
|
value: AaveVersions.AaveV3,
|
|
@@ -6,12 +6,14 @@ export declare const aaveV3AssetsDefaultMarketOpt: string[];
|
|
|
6
6
|
export declare const aaveV3AssetsDefaultMarketArb: string[];
|
|
7
7
|
export declare const aaveV3AssetsDefaultMarketBase: string[];
|
|
8
8
|
export declare const aaveV3AssetsDefaultMarketLinea: string[];
|
|
9
|
+
export declare const aaveV3AssetsDefaultMarketPlasma: string[];
|
|
9
10
|
export declare const aaveV3AssetsDefaultMarket: {
|
|
10
11
|
readonly 1: string[];
|
|
11
12
|
readonly 10: string[];
|
|
12
13
|
readonly 42161: string[];
|
|
13
14
|
readonly 8453: string[];
|
|
14
15
|
readonly 59144: string[];
|
|
16
|
+
readonly 9745: string[];
|
|
15
17
|
};
|
|
16
18
|
export declare const aaveV3AssetsLidoMarketEth: string[];
|
|
17
19
|
export declare const aaveV3AssetsLidoMarket: {
|
|
@@ -20,6 +22,7 @@ export declare const aaveV3AssetsLidoMarket: {
|
|
|
20
22
|
readonly 42161: readonly [];
|
|
21
23
|
readonly 8453: readonly [];
|
|
22
24
|
readonly 59144: readonly [];
|
|
25
|
+
readonly 9745: readonly [];
|
|
23
26
|
};
|
|
24
27
|
export declare const aaveV3AssetsEtherfiMarketEth: string[];
|
|
25
28
|
export declare const aaveV3AssetsEtherfiMarket: {
|
|
@@ -28,4 +31,5 @@ export declare const aaveV3AssetsEtherfiMarket: {
|
|
|
28
31
|
readonly 42161: readonly [];
|
|
29
32
|
readonly 8453: readonly [];
|
|
30
33
|
readonly 59144: readonly [];
|
|
34
|
+
readonly 9745: readonly [];
|
|
31
35
|
};
|
|
@@ -15,6 +15,7 @@ export const aaveV3AssetsDefaultMarketOpt = [
|
|
|
15
15
|
export const aaveV3AssetsDefaultMarketArb = ['DAI', 'LINK', 'USDC.e', 'WBTC', 'ETH', 'USDT', 'AAVE', 'EURS', 'wstETH', 'MAI', 'rETH', 'LUSD', 'USDC', 'FRAX', 'ARB', 'weETH', 'GHO', 'ezETH', 'rsETH', 'tBTC'];
|
|
16
16
|
export const aaveV3AssetsDefaultMarketBase = ['ETH', 'cbETH', 'USDbC', 'wstETH', 'USDC', 'weETH', 'cbBTC', 'ezETH', 'GHO', 'wrsETH', 'LBTC', 'EURC', 'AAVE', 'tBTC'];
|
|
17
17
|
export const aaveV3AssetsDefaultMarketLinea = ['ETH', 'USDC', 'weETH', 'ezETH', 'USDT', 'wstETH', 'wrsETH', 'WBTC'];
|
|
18
|
+
export const aaveV3AssetsDefaultMarketPlasma = ['ETH', 'USDT', 'sUSDe', 'USDe', 'weETH', 'XAUt'];
|
|
18
19
|
// @dev Keep assets in array, do not assign directly, so we can parse it and edit it programmatically with `scripts/updateMarkets`
|
|
19
20
|
export const aaveV3AssetsDefaultMarket = {
|
|
20
21
|
[NetworkNumber.Eth]: aaveV3AssetsDefaultMarketEth,
|
|
@@ -22,6 +23,7 @@ export const aaveV3AssetsDefaultMarket = {
|
|
|
22
23
|
[NetworkNumber.Arb]: aaveV3AssetsDefaultMarketArb,
|
|
23
24
|
[NetworkNumber.Base]: aaveV3AssetsDefaultMarketBase,
|
|
24
25
|
[NetworkNumber.Linea]: aaveV3AssetsDefaultMarketLinea,
|
|
26
|
+
[NetworkNumber.Plasma]: aaveV3AssetsDefaultMarketPlasma,
|
|
25
27
|
};
|
|
26
28
|
export const aaveV3AssetsLidoMarketEth = ['ETH', 'wstETH', 'USDS', 'USDC', 'ezETH', 'sUSDe', 'GHO', 'rsETH', 'tETH'];
|
|
27
29
|
export const aaveV3AssetsLidoMarket = {
|
|
@@ -30,6 +32,7 @@ export const aaveV3AssetsLidoMarket = {
|
|
|
30
32
|
[NetworkNumber.Arb]: [],
|
|
31
33
|
[NetworkNumber.Base]: [],
|
|
32
34
|
[NetworkNumber.Linea]: [],
|
|
35
|
+
[NetworkNumber.Plasma]: [],
|
|
33
36
|
};
|
|
34
37
|
export const aaveV3AssetsEtherfiMarketEth = ['weETH', 'USDC', 'PYUSD', 'FRAX'];
|
|
35
38
|
export const aaveV3AssetsEtherfiMarket = {
|
|
@@ -38,4 +41,5 @@ export const aaveV3AssetsEtherfiMarket = {
|
|
|
38
41
|
[NetworkNumber.Arb]: [],
|
|
39
42
|
[NetworkNumber.Base]: [],
|
|
40
43
|
[NetworkNumber.Linea]: [],
|
|
44
|
+
[NetworkNumber.Plasma]: [],
|
|
41
45
|
};
|
|
@@ -65,6 +65,17 @@ const BULKER_OPTIONS = {
|
|
|
65
65
|
[CompoundVersions.CompoundV3wstETH]: EMPTY_BULKER_OPTIONS,
|
|
66
66
|
[CompoundVersions.CompoundV3USDS]: EMPTY_BULKER_OPTIONS,
|
|
67
67
|
},
|
|
68
|
+
[NetworkNumber.Plasma]: {
|
|
69
|
+
// Non-existing markets, keeping it because of typescript
|
|
70
|
+
[CompoundVersions.CompoundV3USDC]: EMPTY_BULKER_OPTIONS,
|
|
71
|
+
[CompoundVersions.CompoundV3USDT]: EMPTY_BULKER_OPTIONS,
|
|
72
|
+
[CompoundVersions.CompoundV3ETH]: EMPTY_BULKER_OPTIONS,
|
|
73
|
+
[CompoundVersions.CompoundV3USDbC]: EMPTY_BULKER_OPTIONS,
|
|
74
|
+
[CompoundVersions.CompoundV2]: EMPTY_BULKER_OPTIONS,
|
|
75
|
+
[CompoundVersions.CompoundV3USDCe]: EMPTY_BULKER_OPTIONS,
|
|
76
|
+
[CompoundVersions.CompoundV3wstETH]: EMPTY_BULKER_OPTIONS,
|
|
77
|
+
[CompoundVersions.CompoundV3USDS]: EMPTY_BULKER_OPTIONS,
|
|
78
|
+
},
|
|
68
79
|
};
|
|
69
80
|
export const COMPOUND_V2 = {
|
|
70
81
|
chainIds: [NetworkNumber.Eth],
|
|
@@ -10,6 +10,7 @@ export declare const v3USDCCollAssets: {
|
|
|
10
10
|
readonly 42161: string[];
|
|
11
11
|
readonly 8453: string[];
|
|
12
12
|
readonly 59144: readonly [];
|
|
13
|
+
readonly 9745: readonly [];
|
|
13
14
|
};
|
|
14
15
|
export declare const v3USDCeCollAssetsArb: string[];
|
|
15
16
|
export declare const v3USDCeCollAssets: {
|
|
@@ -18,6 +19,7 @@ export declare const v3USDCeCollAssets: {
|
|
|
18
19
|
readonly 42161: string[];
|
|
19
20
|
readonly 8453: readonly [];
|
|
20
21
|
readonly 59144: readonly [];
|
|
22
|
+
readonly 9745: readonly [];
|
|
21
23
|
};
|
|
22
24
|
export declare const v3ETHCollAssetsEth: string[];
|
|
23
25
|
export declare const v3ETHCollAssetsBase: string[];
|
|
@@ -29,6 +31,7 @@ export declare const v3ETHCollAssets: {
|
|
|
29
31
|
readonly 42161: string[];
|
|
30
32
|
readonly 8453: string[];
|
|
31
33
|
readonly 59144: readonly [];
|
|
34
|
+
readonly 9745: readonly [];
|
|
32
35
|
};
|
|
33
36
|
export declare const v3USDbCCollAssetsBase: string[];
|
|
34
37
|
export declare const v3USDbCCollAssets: {
|
|
@@ -37,6 +40,7 @@ export declare const v3USDbCCollAssets: {
|
|
|
37
40
|
42161: never[];
|
|
38
41
|
8453: string[];
|
|
39
42
|
59144: never[];
|
|
43
|
+
9745: never[];
|
|
40
44
|
};
|
|
41
45
|
export declare const v3USDTCollAssetsEth: string[];
|
|
42
46
|
export declare const v3USDTCollAssetsArb: string[];
|
|
@@ -47,6 +51,7 @@ export declare const v3USDTCollAssets: {
|
|
|
47
51
|
42161: string[];
|
|
48
52
|
8453: never[];
|
|
49
53
|
59144: never[];
|
|
54
|
+
9745: never[];
|
|
50
55
|
};
|
|
51
56
|
export declare const v3USDSCollAssetsEth: string[];
|
|
52
57
|
export declare const v3USDSCollAssetsBase: string[];
|
|
@@ -56,6 +61,7 @@ export declare const v3USDSCollAssets: {
|
|
|
56
61
|
42161: never[];
|
|
57
62
|
8453: string[];
|
|
58
63
|
59144: never[];
|
|
64
|
+
9745: never[];
|
|
59
65
|
};
|
|
60
66
|
export declare const v3wstETHCollAssetsEth: string[];
|
|
61
67
|
export declare const v3wstETHCollAssets: {
|
|
@@ -64,4 +70,5 @@ export declare const v3wstETHCollAssets: {
|
|
|
64
70
|
42161: never[];
|
|
65
71
|
8453: never[];
|
|
66
72
|
59144: never[];
|
|
73
|
+
9745: never[];
|
|
67
74
|
};
|
|
@@ -15,6 +15,7 @@ export const v3USDCCollAssets = {
|
|
|
15
15
|
[NetworkNumber.Arb]: v3USDCCollAssetsArb,
|
|
16
16
|
[NetworkNumber.Base]: v3USDCCollAssetsBase,
|
|
17
17
|
[NetworkNumber.Linea]: [],
|
|
18
|
+
[NetworkNumber.Plasma]: [],
|
|
18
19
|
};
|
|
19
20
|
export const v3USDCeCollAssetsArb = ['ARB', 'ETH', 'GMX', 'WBTC'];
|
|
20
21
|
// @dev Keep assets in array, do not assign directly, so we can parse it and edit it programmatically with `scripts/updateMarkets`
|
|
@@ -24,6 +25,7 @@ export const v3USDCeCollAssets = {
|
|
|
24
25
|
[NetworkNumber.Arb]: v3USDCeCollAssetsArb,
|
|
25
26
|
[NetworkNumber.Base]: [],
|
|
26
27
|
[NetworkNumber.Linea]: [],
|
|
28
|
+
[NetworkNumber.Plasma]: [],
|
|
27
29
|
};
|
|
28
30
|
export const v3ETHCollAssetsEth = ['cbETH', 'wstETH', 'rETH', 'rsETH', 'weETH', 'osETH', 'WBTC', 'ezETH', 'cbBTC', 'rswETH', 'tBTC', 'ETHx', 'tETH', 'pufETH', 'wOETH'];
|
|
29
31
|
export const v3ETHCollAssetsBase = ['cbETH', 'ezETH', 'wstETH', 'USDC', 'weETH', 'wrsETH', 'cbBTC', 'wsuperOETHb'];
|
|
@@ -36,6 +38,7 @@ export const v3ETHCollAssets = {
|
|
|
36
38
|
[NetworkNumber.Arb]: v3ETHCollAssetsArb,
|
|
37
39
|
[NetworkNumber.Base]: v3ETHCollAssetsBase,
|
|
38
40
|
[NetworkNumber.Linea]: [],
|
|
41
|
+
[NetworkNumber.Plasma]: [],
|
|
39
42
|
};
|
|
40
43
|
export const v3USDbCCollAssetsBase = ['ETH', 'cbETH'];
|
|
41
44
|
// @dev Keep assets in array, do not assign directly, so we can parse it and edit it programmatically with `scripts/updateMarkets`
|
|
@@ -45,6 +48,7 @@ export const v3USDbCCollAssets = {
|
|
|
45
48
|
[NetworkNumber.Arb]: [],
|
|
46
49
|
[NetworkNumber.Base]: v3USDbCCollAssetsBase,
|
|
47
50
|
[NetworkNumber.Linea]: [],
|
|
51
|
+
[NetworkNumber.Plasma]: [],
|
|
48
52
|
};
|
|
49
53
|
export const v3USDTCollAssetsEth = ['COMP', 'ETH', 'WBTC', 'UNI', 'LINK', 'wstETH', 'cbBTC', 'tBTC', 'wUSDM', 'sFRAX', 'mETH', 'weETH', 'sdeUSD', 'deUSD'];
|
|
50
54
|
export const v3USDTCollAssetsArb = ['ETH', 'WBTC', 'wstETH', 'ARB', 'GMX'];
|
|
@@ -56,6 +60,7 @@ export const v3USDTCollAssets = {
|
|
|
56
60
|
[NetworkNumber.Arb]: v3USDTCollAssetsArb,
|
|
57
61
|
[NetworkNumber.Base]: [],
|
|
58
62
|
[NetworkNumber.Linea]: [],
|
|
63
|
+
[NetworkNumber.Plasma]: [],
|
|
59
64
|
};
|
|
60
65
|
export const v3USDSCollAssetsEth = ['wstETH', 'ETH', 'sUSDS', 'cbETH', 'tBTC', 'USDe'];
|
|
61
66
|
export const v3USDSCollAssetsBase = ['sUSDS', 'cbBTC'];
|
|
@@ -65,6 +70,7 @@ export const v3USDSCollAssets = {
|
|
|
65
70
|
[NetworkNumber.Arb]: [],
|
|
66
71
|
[NetworkNumber.Base]: v3USDSCollAssetsBase,
|
|
67
72
|
[NetworkNumber.Linea]: [],
|
|
73
|
+
[NetworkNumber.Plasma]: [],
|
|
68
74
|
};
|
|
69
75
|
export const v3wstETHCollAssetsEth = ['rsETH', 'ezETH'];
|
|
70
76
|
export const v3wstETHCollAssets = {
|
|
@@ -73,4 +79,5 @@ export const v3wstETHCollAssets = {
|
|
|
73
79
|
[NetworkNumber.Arb]: [],
|
|
74
80
|
[NetworkNumber.Base]: [],
|
|
75
81
|
[NetworkNumber.Linea]: [],
|
|
82
|
+
[NetworkNumber.Plasma]: [],
|
|
76
83
|
};
|
|
@@ -244,17 +244,21 @@ export declare const FluidFTokens: (networkId: NetworkNumber) => {
|
|
|
244
244
|
wstETH: string;
|
|
245
245
|
GHO: string;
|
|
246
246
|
sUSDS: string;
|
|
247
|
+
USDtb: string;
|
|
247
248
|
} | {
|
|
248
249
|
ETH: string;
|
|
249
250
|
USDC: string;
|
|
250
251
|
USDT: string;
|
|
251
252
|
wstETH: string;
|
|
252
253
|
ARB: string;
|
|
254
|
+
GHO: string;
|
|
255
|
+
sUSDS: string;
|
|
253
256
|
} | {
|
|
254
257
|
ETH: string;
|
|
255
258
|
USDC: string;
|
|
256
259
|
EURC: string;
|
|
257
260
|
wstETH: string;
|
|
258
261
|
sUSDS: string;
|
|
262
|
+
GHO: string;
|
|
259
263
|
};
|
|
260
264
|
export declare const getFTokenAddress: (token: string, networkId: NetworkNumber) => any;
|
|
@@ -2290,6 +2290,7 @@ const FluidMainnetFTokenAddresses = {
|
|
|
2290
2290
|
[FluidMainnetDepositToken.wstETH]: '0x2411802D8BEA09be0aF8fD8D08314a63e706b29C',
|
|
2291
2291
|
[FluidMainnetDepositToken.GHO]: '0x6A29A46E21C730DcA1d8b23d637c101cec605C5B',
|
|
2292
2292
|
[FluidMainnetDepositToken.sUSDS]: '0x2BBE31d63E6813E3AC858C04dae43FB2a72B0D11',
|
|
2293
|
+
[FluidMainnetDepositToken.USDtb]: '0x15e8c742614b5D8Db4083A41Df1A14F5D2bFB400',
|
|
2293
2294
|
};
|
|
2294
2295
|
const FluidArbitrumFTokenAddresses = {
|
|
2295
2296
|
[FluidArbitrumDepositToken.ETH]: '0x45Df0656F8aDf017590009d2f1898eeca4F0a205',
|
|
@@ -2297,6 +2298,8 @@ const FluidArbitrumFTokenAddresses = {
|
|
|
2297
2298
|
[FluidArbitrumDepositToken.USDT]: '0x4A03F37e7d3fC243e3f99341d36f4b829BEe5E03',
|
|
2298
2299
|
[FluidArbitrumDepositToken.wstETH]: '0x66C25Cd75EBdAA7E04816F643d8E46cecd3183c9',
|
|
2299
2300
|
[FluidArbitrumDepositToken.ARB]: '0xbE3860FD4c3facDf8ad57Aa8c1A36D6dc4390a49',
|
|
2301
|
+
[FluidArbitrumDepositToken.GHO]: '0x037dFf1C12805707d7c29F163E0F09fC9102657A',
|
|
2302
|
+
[FluidArbitrumDepositToken.sUSDS]: '0x3459fcc94390C3372c0F7B4cD3F8795F0E5aFE96',
|
|
2300
2303
|
};
|
|
2301
2304
|
const FluidBaseFTokenAddresses = {
|
|
2302
2305
|
[FluidBaseDepositToken.ETH]: '0x9272D6153133175175Bc276512B2336BE3931CE9',
|
|
@@ -2304,6 +2307,7 @@ const FluidBaseFTokenAddresses = {
|
|
|
2304
2307
|
[FluidBaseDepositToken.EURC]: '0x1943FA26360f038230442525Cf1B9125b5DCB401',
|
|
2305
2308
|
[FluidBaseDepositToken.wstETH]: '0x896E39f0E9af61ECA9dD2938E14543506ef2c2b5',
|
|
2306
2309
|
[FluidBaseDepositToken.sUSDS]: '0xf62e339f21d8018940f188F6987Bcdf02A849619',
|
|
2310
|
+
[FluidBaseDepositToken.GHO]: '0x8DdbfFA3CFda2355a23d6B11105AC624BDbE3631',
|
|
2307
2311
|
};
|
|
2308
2312
|
export const FluidFTokens = (networkId) => {
|
|
2309
2313
|
switch (networkId) {
|
package/esm/services/utils.d.ts
CHANGED
|
@@ -2,8 +2,6 @@ import { NetworkNumber } from '../types/common';
|
|
|
2
2
|
export declare const isLayer2Network: (networkId: NetworkNumber) => boolean;
|
|
3
3
|
export declare const addToObjectIf: (condition: any, item: any) => any;
|
|
4
4
|
export declare const addToArrayIf: (condition: any, ...items: any[]) => any[];
|
|
5
|
-
export declare const ethToWeth: (maybeEth: any) => any;
|
|
6
|
-
export declare const wethToEth: (maybeWeth: any) => any;
|
|
7
5
|
export declare const stEthToWstEth: (maybeStEth: any) => any;
|
|
8
6
|
export declare const wstEthToStEth: (maybeStEth: any) => any;
|
|
9
7
|
export declare const getAbiItem: (abi: any, methodName: string) => any;
|
|
@@ -13,8 +11,6 @@ export declare const compareAddresses: (addr1?: string, addr2?: string) => boole
|
|
|
13
11
|
export declare const getWeiAmountForDecimals: (amount: string | number, decimals: number) => string;
|
|
14
12
|
export declare const getEthAmountForDecimals: (amount: string | number, decimals: string | number) => string;
|
|
15
13
|
export declare const handleWbtcLegacy: (asset: string) => string;
|
|
16
|
-
export declare const wethToEthByAddress: (maybeWethAddr: string, chainId?: NetworkNumber) => string;
|
|
17
|
-
export declare const ethToWethByAddress: (maybeEthAddr: string, chainId?: NetworkNumber) => string;
|
|
18
14
|
export declare const bytesToString: (hex: string) => string;
|
|
19
15
|
/**
|
|
20
16
|
* Map an input value from one range (minInput, maxInput) to a value in another range (minOutput, maxOutput)
|
|
@@ -30,3 +26,11 @@ export declare const DEFAULT_TIMEOUT = 2000;
|
|
|
30
26
|
* @param value
|
|
31
27
|
*/
|
|
32
28
|
export declare const convertHybridArraysToObjects: (value: any) => any;
|
|
29
|
+
export declare const ethToWeth: (maybeEth: string) => string;
|
|
30
|
+
export declare const wethToEth: (maybeWeth: string) => string;
|
|
31
|
+
export declare const wethToEthByAddress: (maybeWethAddr: string, chainId?: NetworkNumber) => string;
|
|
32
|
+
export declare const ethToWethByAddress: (maybeEthAddr: string, chainId?: NetworkNumber) => string;
|
|
33
|
+
export declare const xplToWxpl: (maybeXpl: string) => string;
|
|
34
|
+
export declare const wxplToXpl: (maybeWxpl: string) => string;
|
|
35
|
+
export declare const getWrappedNativeAssetFromUnwrapped: (symbol: string) => string;
|
|
36
|
+
export declare const getNativeAssetFromWrapped: (symbol: string) => string;
|
package/esm/services/utils.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import Dec from 'decimal.js';
|
|
2
2
|
import { getAssetInfo, getAssetInfoByAddress } from '@defisaver/tokens';
|
|
3
3
|
import { NetworkNumber } from '../types/common';
|
|
4
|
-
export const isLayer2Network = (networkId) => [NetworkNumber.Opt, NetworkNumber.Arb, NetworkNumber.Base, NetworkNumber.Linea].includes(+networkId);
|
|
4
|
+
export const isLayer2Network = (networkId) => [NetworkNumber.Opt, NetworkNumber.Arb, NetworkNumber.Base, NetworkNumber.Linea, NetworkNumber.Plasma].includes(+networkId);
|
|
5
5
|
export const addToObjectIf = (condition, item) => (condition ? item : {});
|
|
6
6
|
export const addToArrayIf = (condition, ...items) => (condition ? items : []);
|
|
7
|
-
export const ethToWeth = (maybeEth) => maybeEth === null || maybeEth === void 0 ? void 0 : maybeEth.replace(/^ETH$/, 'WETH');
|
|
8
|
-
export const wethToEth = (maybeWeth) => maybeWeth === null || maybeWeth === void 0 ? void 0 : maybeWeth.replace(/^WETH$/, 'ETH');
|
|
9
7
|
export const stEthToWstEth = (maybeStEth) => maybeStEth === null || maybeStEth === void 0 ? void 0 : maybeStEth.replace(/^stETH$/, 'wstETH');
|
|
10
8
|
export const wstEthToStEth = (maybeStEth) => maybeStEth === null || maybeStEth === void 0 ? void 0 : maybeStEth.replace(/^wstETH$/, 'stETH');
|
|
11
9
|
export const getAbiItem = (abi, methodName) => abi.find((i) => i.name === methodName);
|
|
@@ -15,8 +13,6 @@ export const compareAddresses = (addr1 = '', addr2 = '') => addr1.toLowerCase()
|
|
|
15
13
|
export const getWeiAmountForDecimals = (amount, decimals) => new Dec(amount).mul(Math.pow(10, decimals)).floor().toString();
|
|
16
14
|
export const getEthAmountForDecimals = (amount, decimals) => new Dec(amount).div(Math.pow(10, +decimals)).toString();
|
|
17
15
|
export const handleWbtcLegacy = (asset) => (asset === 'WBTC Legacy' ? 'WBTC' : asset);
|
|
18
|
-
export const wethToEthByAddress = (maybeWethAddr, chainId = NetworkNumber.Eth) => getAssetInfo(wethToEth(getAssetInfoByAddress(maybeWethAddr, chainId).symbol), chainId).address;
|
|
19
|
-
export const ethToWethByAddress = (maybeEthAddr, chainId = NetworkNumber.Eth) => getAssetInfo(ethToWeth(getAssetInfoByAddress(maybeEthAddr, chainId).symbol), chainId).address;
|
|
20
16
|
export const bytesToString = (hex) => Buffer.from(hex.replace(/^0x/, ''), 'hex')
|
|
21
17
|
.toString()
|
|
22
18
|
// eslint-disable-next-line no-control-regex
|
|
@@ -69,3 +65,23 @@ export const convertHybridArraysToObjects = (value) => {
|
|
|
69
65
|
}
|
|
70
66
|
return value;
|
|
71
67
|
};
|
|
68
|
+
export const ethToWeth = (maybeEth) => maybeEth === null || maybeEth === void 0 ? void 0 : maybeEth.replace(/^ETH$/, 'WETH');
|
|
69
|
+
export const wethToEth = (maybeWeth) => maybeWeth === null || maybeWeth === void 0 ? void 0 : maybeWeth.replace(/^WETH$/, 'ETH');
|
|
70
|
+
export const wethToEthByAddress = (maybeWethAddr, chainId = NetworkNumber.Eth) => getAssetInfo(wethToEth(getAssetInfoByAddress(maybeWethAddr, chainId).symbol), chainId).address;
|
|
71
|
+
export const ethToWethByAddress = (maybeEthAddr, chainId = NetworkNumber.Eth) => getAssetInfo(ethToWeth(getAssetInfoByAddress(maybeEthAddr, chainId).symbol), chainId).address;
|
|
72
|
+
export const xplToWxpl = (maybeXpl) => maybeXpl === null || maybeXpl === void 0 ? void 0 : maybeXpl.replace(/^XPL$/, 'WXPL');
|
|
73
|
+
export const wxplToXpl = (maybeWxpl) => maybeWxpl === null || maybeWxpl === void 0 ? void 0 : maybeWxpl.replace(/^WXPL$/, 'XPL');
|
|
74
|
+
export const getWrappedNativeAssetFromUnwrapped = (symbol) => {
|
|
75
|
+
if (symbol === 'ETH')
|
|
76
|
+
return 'WETH';
|
|
77
|
+
if (symbol === 'XPL')
|
|
78
|
+
return 'WXPL';
|
|
79
|
+
return symbol;
|
|
80
|
+
};
|
|
81
|
+
export const getNativeAssetFromWrapped = (symbol) => {
|
|
82
|
+
if (symbol === 'WETH')
|
|
83
|
+
return 'ETH';
|
|
84
|
+
if (symbol === 'WXPL')
|
|
85
|
+
return 'XPL';
|
|
86
|
+
return symbol;
|
|
87
|
+
};
|
package/esm/services/viem.d.ts
CHANGED
|
@@ -7,14 +7,11 @@ export declare const getViemChain: (network: NetworkNumber) => {
|
|
|
7
7
|
readonly apiUrl: "https://api.etherscan.io/api";
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
|
-
blockTime
|
|
10
|
+
blockTime: 12000;
|
|
11
11
|
contracts: {
|
|
12
|
-
readonly ensRegistry: {
|
|
13
|
-
readonly address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
|
|
14
|
-
};
|
|
15
12
|
readonly ensUniversalResolver: {
|
|
16
|
-
readonly address: "
|
|
17
|
-
readonly blockCreated:
|
|
13
|
+
readonly address: "0xeeeeeeee14d718c2b47d9923deab1335e144eeee";
|
|
14
|
+
readonly blockCreated: 23085558;
|
|
18
15
|
};
|
|
19
16
|
readonly multicall3: {
|
|
20
17
|
readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
|
|
@@ -29,6 +26,7 @@ export declare const getViemChain: (network: NetworkNumber) => {
|
|
|
29
26
|
readonly symbol: "ETH";
|
|
30
27
|
readonly decimals: 18;
|
|
31
28
|
};
|
|
29
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
32
30
|
rpcUrls: {
|
|
33
31
|
readonly default: {
|
|
34
32
|
readonly http: readonly ["https://eth.merkle.io"];
|
|
@@ -101,6 +99,7 @@ export declare const getViemChain: (network: NetworkNumber) => {
|
|
|
101
99
|
readonly symbol: "ETH";
|
|
102
100
|
readonly decimals: 18;
|
|
103
101
|
};
|
|
102
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
104
103
|
rpcUrls: {
|
|
105
104
|
readonly default: {
|
|
106
105
|
readonly http: readonly ["https://mainnet.optimism.io"];
|
|
@@ -174,16 +173,16 @@ export declare const getViemChain: (network: NetworkNumber) => {
|
|
|
174
173
|
r: import("viem").Hex;
|
|
175
174
|
s: import("viem").Hex;
|
|
176
175
|
v: bigint;
|
|
176
|
+
value: bigint;
|
|
177
|
+
gas: bigint;
|
|
177
178
|
to: import("viem").Address | null;
|
|
178
179
|
from: import("viem").Address;
|
|
179
|
-
gas: bigint;
|
|
180
180
|
nonce: number;
|
|
181
|
-
value: bigint;
|
|
182
181
|
blockHash: `0x${string}` | null;
|
|
183
182
|
blockNumber: bigint | null;
|
|
183
|
+
transactionIndex: number | null;
|
|
184
184
|
hash: import("viem").Hash;
|
|
185
185
|
input: import("viem").Hex;
|
|
186
|
-
transactionIndex: number | null;
|
|
187
186
|
typeHex: import("viem").Hex | null;
|
|
188
187
|
accessList?: undefined | undefined;
|
|
189
188
|
authorizationList?: undefined | undefined;
|
|
@@ -352,7 +351,7 @@ export declare const getViemChain: (network: NetworkNumber) => {
|
|
|
352
351
|
readonly apiUrl: "https://api.arbiscan.io/api";
|
|
353
352
|
};
|
|
354
353
|
};
|
|
355
|
-
blockTime
|
|
354
|
+
blockTime: 250;
|
|
356
355
|
contracts: {
|
|
357
356
|
readonly multicall3: {
|
|
358
357
|
readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
|
|
@@ -367,6 +366,7 @@ export declare const getViemChain: (network: NetworkNumber) => {
|
|
|
367
366
|
readonly symbol: "ETH";
|
|
368
367
|
readonly decimals: 18;
|
|
369
368
|
};
|
|
369
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
370
370
|
rpcUrls: {
|
|
371
371
|
readonly default: {
|
|
372
372
|
readonly http: readonly ["https://arb1.arbitrum.io/rpc"];
|
|
@@ -441,6 +441,7 @@ export declare const getViemChain: (network: NetworkNumber) => {
|
|
|
441
441
|
readonly symbol: "ETH";
|
|
442
442
|
readonly decimals: 18;
|
|
443
443
|
};
|
|
444
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
444
445
|
rpcUrls: {
|
|
445
446
|
readonly default: {
|
|
446
447
|
readonly http: readonly ["https://mainnet.base.org"];
|
|
@@ -514,16 +515,16 @@ export declare const getViemChain: (network: NetworkNumber) => {
|
|
|
514
515
|
r: import("viem").Hex;
|
|
515
516
|
s: import("viem").Hex;
|
|
516
517
|
v: bigint;
|
|
518
|
+
value: bigint;
|
|
519
|
+
gas: bigint;
|
|
517
520
|
to: import("viem").Address | null;
|
|
518
521
|
from: import("viem").Address;
|
|
519
|
-
gas: bigint;
|
|
520
522
|
nonce: number;
|
|
521
|
-
value: bigint;
|
|
522
523
|
blockHash: `0x${string}` | null;
|
|
523
524
|
blockNumber: bigint | null;
|
|
525
|
+
transactionIndex: number | null;
|
|
524
526
|
hash: import("viem").Hash;
|
|
525
527
|
input: import("viem").Hex;
|
|
526
|
-
transactionIndex: number | null;
|
|
527
528
|
typeHex: import("viem").Hex | null;
|
|
528
529
|
accessList?: undefined | undefined;
|
|
529
530
|
authorizationList?: undefined | undefined;
|
|
@@ -703,8 +704,8 @@ export declare const getViemChain: (network: NetworkNumber) => {
|
|
|
703
704
|
readonly blockCreated: 6682888;
|
|
704
705
|
};
|
|
705
706
|
readonly ensUniversalResolver: {
|
|
706
|
-
readonly address: "
|
|
707
|
-
readonly blockCreated:
|
|
707
|
+
readonly address: "0x4D41762915F83c76EcaF6776d9b08076aA32b492";
|
|
708
|
+
readonly blockCreated: 22222151;
|
|
708
709
|
};
|
|
709
710
|
};
|
|
710
711
|
ensTlds: readonly [".linea.eth"];
|
|
@@ -715,6 +716,7 @@ export declare const getViemChain: (network: NetworkNumber) => {
|
|
|
715
716
|
readonly symbol: "ETH";
|
|
716
717
|
readonly decimals: 18;
|
|
717
718
|
};
|
|
719
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
718
720
|
rpcUrls: {
|
|
719
721
|
readonly default: {
|
|
720
722
|
readonly http: readonly ["https://rpc.linea.build"];
|
|
@@ -730,6 +732,40 @@ export declare const getViemChain: (network: NetworkNumber) => {
|
|
|
730
732
|
};
|
|
731
733
|
formatters?: undefined;
|
|
732
734
|
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
735
|
+
} | {
|
|
736
|
+
blockExplorers: {
|
|
737
|
+
readonly default: {
|
|
738
|
+
readonly name: "PlasmaScan";
|
|
739
|
+
readonly url: "https://plasmascan.to";
|
|
740
|
+
};
|
|
741
|
+
};
|
|
742
|
+
blockTime?: number | undefined | undefined;
|
|
743
|
+
contracts: {
|
|
744
|
+
readonly multicall3: {
|
|
745
|
+
readonly address: "0xcA11bde05977b3631167028862bE2a173976CA11";
|
|
746
|
+
readonly blockCreated: 0;
|
|
747
|
+
};
|
|
748
|
+
};
|
|
749
|
+
ensTlds?: readonly string[] | undefined;
|
|
750
|
+
id: 9745;
|
|
751
|
+
name: "Plasma";
|
|
752
|
+
nativeCurrency: {
|
|
753
|
+
readonly name: "Plasma";
|
|
754
|
+
readonly symbol: "XPL";
|
|
755
|
+
readonly decimals: 18;
|
|
756
|
+
};
|
|
757
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
758
|
+
rpcUrls: {
|
|
759
|
+
readonly default: {
|
|
760
|
+
readonly http: readonly ["https://rpc.plasma.to"];
|
|
761
|
+
};
|
|
762
|
+
};
|
|
763
|
+
sourceId?: number | undefined | undefined;
|
|
764
|
+
testnet?: boolean | undefined | undefined;
|
|
765
|
+
custom?: Record<string, unknown> | undefined;
|
|
766
|
+
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
767
|
+
formatters?: undefined;
|
|
768
|
+
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
733
769
|
};
|
|
734
770
|
export declare const getViemProvider: (provider: EthereumProvider, network: NetworkNumber, options?: any) => {
|
|
735
771
|
account: undefined;
|
|
@@ -741,6 +777,7 @@ export declare const getViemProvider: (provider: EthereumProvider, network: Netw
|
|
|
741
777
|
request?: (parameters: import("viem").CcipRequestParameters) => Promise<import("viem/_types/utils/ccip").CcipRequestReturnType>;
|
|
742
778
|
} | undefined;
|
|
743
779
|
chain: undefined;
|
|
780
|
+
experimental_blockTag?: import("viem").BlockTag | undefined;
|
|
744
781
|
key: string;
|
|
745
782
|
name: string;
|
|
746
783
|
pollingInterval: number;
|
|
@@ -7579,6 +7616,7 @@ export declare const getViemProvider: (provider: EthereumProvider, network: Netw
|
|
|
7579
7616
|
simulateBlocks: <const calls extends readonly unknown[]>(args: import("viem").SimulateBlocksParameters<calls>) => Promise<import("viem").SimulateBlocksReturnType<calls>>;
|
|
7580
7617
|
simulateCalls: <const calls extends readonly unknown[]>(args: import("viem").SimulateCallsParameters<calls>) => Promise<import("viem").SimulateCallsReturnType<calls>>;
|
|
7581
7618
|
simulateContract: <const abi extends import("viem").Abi | readonly unknown[], functionName extends import("viem").ContractFunctionName<abi, "nonpayable" | "payable">, const args_1 extends import("viem").ContractFunctionArgs<abi, "nonpayable" | "payable", functionName>, chainOverride extends import("viem").Chain | undefined, accountOverride extends import("viem").Account | import("viem").Address | undefined = undefined>(args: import("viem").SimulateContractParameters<abi, functionName, args_1, undefined, chainOverride, accountOverride>) => Promise<import("viem").SimulateContractReturnType<abi, functionName, args_1, undefined, import("viem").Account | undefined, chainOverride, accountOverride>>;
|
|
7619
|
+
verifyHash: (args: import("viem").VerifyHashActionParameters) => Promise<import("viem").VerifyHashActionReturnType>;
|
|
7582
7620
|
verifyMessage: (args: import("viem").VerifyMessageActionParameters) => Promise<import("viem").VerifyMessageActionReturnType>;
|
|
7583
7621
|
verifySiweMessage: (args: import("viem/_types/actions/siwe/verifySiweMessage").VerifySiweMessageParameters) => Promise<import("viem/_types/actions/siwe/verifySiweMessage").VerifySiweMessageReturnType>;
|
|
7584
7622
|
verifyTypedData: (args: import("viem").VerifyTypedDataActionParameters) => Promise<import("viem").VerifyTypedDataActionReturnType>;
|
|
@@ -7596,6 +7634,7 @@ export declare const getViemProvider: (provider: EthereumProvider, network: Netw
|
|
|
7596
7634
|
cacheTime?: undefined;
|
|
7597
7635
|
ccipRead?: undefined;
|
|
7598
7636
|
chain?: undefined;
|
|
7637
|
+
experimental_blockTag?: undefined;
|
|
7599
7638
|
key?: undefined;
|
|
7600
7639
|
name?: undefined;
|
|
7601
7640
|
pollingInterval?: undefined;
|
package/esm/services/viem.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createPublicClient, custom } from 'viem';
|
|
2
|
-
import { arbitrum, base, mainnet, optimism, linea, } from 'viem/chains';
|
|
2
|
+
import { arbitrum, base, mainnet, optimism, linea, plasma, } from 'viem/chains';
|
|
3
3
|
import { NetworkNumber } from '../types/common';
|
|
4
4
|
export const getViemChain = (network) => {
|
|
5
5
|
switch (network) {
|
|
@@ -13,6 +13,8 @@ export const getViemChain = (network) => {
|
|
|
13
13
|
return base;
|
|
14
14
|
case NetworkNumber.Linea:
|
|
15
15
|
return linea;
|
|
16
|
+
case NetworkNumber.Plasma:
|
|
17
|
+
return plasma;
|
|
16
18
|
default:
|
|
17
19
|
throw new Error(`Unsupported network: ${network}`);
|
|
18
20
|
}
|
|
@@ -18,12 +18,6 @@ export const isEligibleForEthenaUSDeRewards = (usedAssets, { healthRatio }) => {
|
|
|
18
18
|
const anythingBorrowedNotAllowed = Object.values(usedAssets).some((asset) => asset.isBorrowed && !allowedBorrowAssets.includes(asset.symbol));
|
|
19
19
|
if (anythingBorrowedNotAllowed)
|
|
20
20
|
return { isEligible: false, eligibleUSDAmount: '0' };
|
|
21
|
-
const totalAmountBorrowed = Object.values(usedAssets).reduce((acc, asset) => {
|
|
22
|
-
if (asset.isBorrowed) {
|
|
23
|
-
return acc.add(asset.borrowedUsd);
|
|
24
|
-
}
|
|
25
|
-
return acc;
|
|
26
|
-
}, new Dec(0)).toString();
|
|
27
21
|
if (new Dec(healthRatio).gte(2.5))
|
|
28
22
|
return { isEligible: false, eligibleUSDAmount: '0' }; // health ratio must be below 2.5
|
|
29
23
|
const halfAmountSupplied = new Dec(totalAmountSupplied).div(2).toString();
|
|
@@ -54,4 +48,5 @@ export const EligibilityMapping = {
|
|
|
54
48
|
[IncentiveEligibilityId.AaveV3EthenaLiquidLeverage]: isEligibleForEthenaUSDeRewards,
|
|
55
49
|
[IncentiveEligibilityId.AaveV3ArbitrumEthSupply]: isEligibleForAaveV3ArbitrumEthSupply,
|
|
56
50
|
[IncentiveEligibilityId.AaveV3ArbitrumETHLSBorrow]: isEligibleForAaveV3ArbitrumETHLSBorrow,
|
|
51
|
+
[IncentiveEligibilityId.AaveV3EthenaLiquidLeveragePlasma]: isEligibleForEthenaUSDeRewards,
|
|
57
52
|
};
|
package/esm/types/common.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ export declare enum IncentiveKind {
|
|
|
5
5
|
export declare enum IncentiveEligibilityId {
|
|
6
6
|
AaveV3EthenaLiquidLeverage = "0x7361e6f04060154e0268a8402b073cbf97e11ae3BORROW_BL",
|
|
7
7
|
AaveV3ArbitrumEthSupply = "0x5d16261c6715a653248269861bbacf68a9774cde",
|
|
8
|
-
AaveV3ArbitrumETHLSBorrow = "0x0c84331e39d6658Cd6e6b9ba04736cC4c4734351"
|
|
8
|
+
AaveV3ArbitrumETHLSBorrow = "0x0c84331e39d6658Cd6e6b9ba04736cC4c4734351",
|
|
9
|
+
AaveV3EthenaLiquidLeveragePlasma = "0x67264783f1e9a2af8627a235853057a6fc975bd2BORROW_BL"
|
|
9
10
|
}
|
|
10
11
|
export interface IncentiveData {
|
|
11
12
|
token: string;
|
|
@@ -23,7 +24,8 @@ export declare enum NetworkNumber {
|
|
|
23
24
|
Opt = 10,
|
|
24
25
|
Arb = 42161,
|
|
25
26
|
Base = 8453,
|
|
26
|
-
Linea = 59144
|
|
27
|
+
Linea = 59144,
|
|
28
|
+
Plasma = 9745
|
|
27
29
|
}
|
|
28
30
|
export type Networkish = string | NetworkNumber;
|
|
29
31
|
export interface MMAssetData {
|
package/esm/types/common.js
CHANGED
|
@@ -8,6 +8,7 @@ export var IncentiveEligibilityId;
|
|
|
8
8
|
IncentiveEligibilityId["AaveV3EthenaLiquidLeverage"] = "0x7361e6f04060154e0268a8402b073cbf97e11ae3BORROW_BL";
|
|
9
9
|
IncentiveEligibilityId["AaveV3ArbitrumEthSupply"] = "0x5d16261c6715a653248269861bbacf68a9774cde";
|
|
10
10
|
IncentiveEligibilityId["AaveV3ArbitrumETHLSBorrow"] = "0x0c84331e39d6658Cd6e6b9ba04736cC4c4734351";
|
|
11
|
+
IncentiveEligibilityId["AaveV3EthenaLiquidLeveragePlasma"] = "0x67264783f1e9a2af8627a235853057a6fc975bd2BORROW_BL";
|
|
11
12
|
})(IncentiveEligibilityId || (IncentiveEligibilityId = {}));
|
|
12
13
|
export var NetworkNumber;
|
|
13
14
|
(function (NetworkNumber) {
|
|
@@ -16,4 +17,5 @@ export var NetworkNumber;
|
|
|
16
17
|
NetworkNumber[NetworkNumber["Arb"] = 42161] = "Arb";
|
|
17
18
|
NetworkNumber[NetworkNumber["Base"] = 8453] = "Base";
|
|
18
19
|
NetworkNumber[NetworkNumber["Linea"] = 59144] = "Linea";
|
|
20
|
+
NetworkNumber[NetworkNumber["Plasma"] = 9745] = "Plasma";
|
|
19
21
|
})(NetworkNumber || (NetworkNumber = {}));
|