@gearbox-protocol/sdk 13.6.0-kyc.7 → 13.6.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/cjs/dev/AccountOpener.js +5 -45
- package/dist/cjs/plugins/adapters/abi/actionAbi.js +1 -1
- package/dist/cjs/plugins/adapters/abi/conctructorAbi.js +1 -1
- package/dist/cjs/plugins/adapters/createAdapter.js +1 -1
- package/dist/cjs/plugins/adapters/types.js +1 -1
- package/dist/cjs/plugins/apy/ApyPlugin.js +266 -0
- package/dist/cjs/plugins/apy/apy-cache.js +120 -0
- package/dist/cjs/plugins/apy/apy-parser.js +169 -0
- package/dist/cjs/{sdk/market/kyc/securitize → plugins/apy}/constants.js +6 -3
- package/dist/cjs/{sdk/market/kyc/securitize → plugins/apy}/index.js +14 -6
- package/dist/cjs/{sdk/market/kyc/securitize/types.js → plugins/apy/pool-apy-types.js} +2 -2
- package/dist/cjs/plugins/apy/pool-apy-utils.js +141 -0
- package/dist/cjs/rewards/rewards/extra-apy.js +10 -8
- package/dist/cjs/sdk/GearboxSDK.js +5 -52
- package/dist/cjs/sdk/accounts/AbstractCreditAccountsService.js +16 -324
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +1 -7
- package/dist/cjs/sdk/base/TokensMeta.js +43 -32
- package/dist/cjs/sdk/base/token-types.js +0 -9
- package/dist/cjs/sdk/chain/chains.js +32 -17
- package/dist/cjs/sdk/constants/address-provider.js +0 -3
- package/dist/cjs/sdk/market/MarketRegister.js +116 -70
- package/dist/cjs/sdk/market/MarketSuite.js +0 -3
- package/dist/cjs/sdk/market/index.js +0 -2
- package/dist/cjs/sdk/market/pool/PoolSuite.js +0 -3
- package/dist/cjs/sdk/market/pool/PoolV310Contract.js +2 -11
- package/dist/cjs/sdk/market/pool/index.js +0 -2
- package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +3 -3
- package/dist/cjs/sdk/options.js +1 -7
- package/dist/cjs/sdk/pools/PoolService.js +12 -104
- package/dist/cjs/sdk/utils/viem/index.js +0 -2
- package/dist/cjs/sdk/utils/viem/simulateWithPriceUpdates.js +39 -2
- package/dist/esm/dev/AccountOpener.js +6 -47
- package/dist/esm/plugins/adapters/abi/actionAbi.js +1 -1
- package/dist/esm/plugins/adapters/abi/conctructorAbi.js +1 -1
- package/dist/esm/plugins/adapters/createAdapter.js +1 -1
- package/dist/esm/plugins/adapters/types.js +1 -1
- package/dist/esm/plugins/apy/ApyPlugin.js +255 -0
- package/dist/esm/plugins/apy/apy-cache.js +86 -0
- package/dist/esm/plugins/apy/apy-parser.js +143 -0
- package/dist/esm/plugins/apy/constants.js +6 -0
- package/dist/esm/plugins/apy/index.js +7 -0
- package/dist/esm/plugins/apy/pool-apy-utils.js +113 -0
- package/dist/esm/rewards/rewards/extra-apy.js +10 -8
- package/dist/esm/sdk/GearboxSDK.js +6 -56
- package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +17 -328
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +1 -7
- package/dist/esm/sdk/base/TokensMeta.js +45 -32
- package/dist/esm/sdk/base/token-types.js +0 -6
- package/dist/esm/sdk/chain/chains.js +32 -17
- package/dist/esm/sdk/constants/address-provider.js +0 -2
- package/dist/esm/sdk/market/MarketRegister.js +118 -74
- package/dist/esm/sdk/market/MarketSuite.js +0 -3
- package/dist/esm/sdk/market/index.js +0 -1
- package/dist/esm/sdk/market/pool/PoolSuite.js +0 -3
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +2 -11
- package/dist/esm/sdk/market/pool/index.js +0 -1
- package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +3 -3
- package/dist/esm/sdk/options.js +1 -7
- package/dist/esm/sdk/pools/PoolService.js +13 -109
- package/dist/esm/sdk/utils/viem/index.js +0 -1
- package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +41 -2
- package/dist/types/plugins/adapters/types.d.ts +2 -2
- package/dist/types/plugins/apy/ApyPlugin.d.ts +46 -0
- package/dist/types/plugins/apy/apy-cache.d.ts +28 -0
- package/dist/types/plugins/apy/apy-parser.d.ts +5 -0
- package/dist/types/plugins/apy/constants.d.ts +2 -0
- package/dist/types/plugins/apy/index.d.ts +7 -0
- package/dist/types/plugins/apy/pool-apy-types.d.ts +41 -0
- package/dist/types/plugins/apy/pool-apy-utils.d.ts +73 -0
- package/dist/types/plugins/apy/types.d.ts +37 -0
- package/dist/types/rewards/rewards/api.d.ts +10 -1
- package/dist/types/rewards/rewards/common.d.ts +0 -10
- package/dist/types/rewards/rewards/extra-apy.d.ts +4 -6
- package/dist/types/sdk/GearboxSDK.d.ts +0 -7
- package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +2 -52
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -1
- package/dist/types/sdk/accounts/types.d.ts +13 -93
- package/dist/types/sdk/base/TokensMeta.d.ts +3 -14
- package/dist/types/sdk/base/token-types.d.ts +4 -44
- package/dist/types/sdk/base/types.d.ts +11 -116
- package/dist/types/sdk/chain/chains.d.ts +5 -5
- package/dist/types/sdk/constants/address-provider.d.ts +0 -1
- package/dist/types/sdk/market/MarketRegister.d.ts +9 -6
- package/dist/types/sdk/market/MarketSuite.d.ts +0 -2
- package/dist/types/sdk/market/index.d.ts +0 -1
- package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +2 -3
- package/dist/types/sdk/market/oracle/types.d.ts +10 -3
- package/dist/types/sdk/market/pool/PoolSuite.d.ts +0 -2
- package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +2 -6
- package/dist/types/sdk/market/pool/index.d.ts +0 -1
- package/dist/types/sdk/market/pricefeeds/PriceFeedsRegister.d.ts +1 -1
- package/dist/types/sdk/market/types.d.ts +1 -1
- package/dist/types/sdk/options.d.ts +0 -1
- package/dist/types/sdk/pools/PoolService.d.ts +8 -8
- package/dist/types/sdk/pools/types.d.ts +1 -1
- package/dist/types/sdk/types/state-human.d.ts +0 -2
- package/dist/types/sdk/types/state.d.ts +0 -5
- package/dist/types/sdk/utils/viem/index.d.ts +0 -1
- package/package.json +2 -3
- package/dist/cjs/abi/kyc/iDSRegistryService.js +0 -70
- package/dist/cjs/abi/kyc/iDSToken.js +0 -71
- package/dist/cjs/abi/kyc/iKYCCompressor.js +0 -196
- package/dist/cjs/abi/kyc/iKYCFactory.js +0 -122
- package/dist/cjs/abi/kyc/iKYCUnderlying.js +0 -401
- package/dist/cjs/abi/kyc/iSecuritizeDegenNFT.js +0 -326
- package/dist/cjs/abi/kyc/iSecuritizeKYCFactory.js +0 -319
- package/dist/cjs/plugins/pools-history/Pools7DAgoPlugin.js +0 -108
- package/dist/cjs/plugins/pools-history/index.js +0 -24
- package/dist/cjs/sdk/market/kyc/KYCRegistry.js +0 -269
- package/dist/cjs/sdk/market/kyc/index.js +0 -26
- package/dist/cjs/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +0 -244
- package/dist/cjs/sdk/market/kyc/types.js +0 -34
- package/dist/cjs/sdk/utils/viem/executeDelegatedMulticalls.js +0 -38
- package/dist/esm/abi/kyc/iDSRegistryService.js +0 -46
- package/dist/esm/abi/kyc/iDSToken.js +0 -47
- package/dist/esm/abi/kyc/iKYCCompressor.js +0 -172
- package/dist/esm/abi/kyc/iKYCFactory.js +0 -98
- package/dist/esm/abi/kyc/iKYCUnderlying.js +0 -377
- package/dist/esm/abi/kyc/iSecuritizeDegenNFT.js +0 -302
- package/dist/esm/abi/kyc/iSecuritizeKYCFactory.js +0 -295
- package/dist/esm/plugins/pools-history/Pools7DAgoPlugin.js +0 -90
- package/dist/esm/plugins/pools-history/index.js +0 -2
- package/dist/esm/sdk/market/kyc/KYCRegistry.js +0 -253
- package/dist/esm/sdk/market/kyc/index.js +0 -3
- package/dist/esm/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +0 -220
- package/dist/esm/sdk/market/kyc/securitize/constants.js +0 -4
- package/dist/esm/sdk/market/kyc/securitize/index.js +0 -3
- package/dist/esm/sdk/market/kyc/types.js +0 -9
- package/dist/esm/sdk/utils/viem/executeDelegatedMulticalls.js +0 -14
- package/dist/types/abi/kyc/iDSRegistryService.d.ts +0 -71
- package/dist/types/abi/kyc/iDSToken.d.ts +0 -67
- package/dist/types/abi/kyc/iKYCCompressor.d.ts +0 -228
- package/dist/types/abi/kyc/iKYCFactory.d.ts +0 -139
- package/dist/types/abi/kyc/iKYCUnderlying.d.ts +0 -548
- package/dist/types/abi/kyc/iSecuritizeDegenNFT.d.ts +0 -404
- package/dist/types/abi/kyc/iSecuritizeKYCFactory.d.ts +0 -376
- package/dist/types/plugins/pools-history/Pools7DAgoPlugin.d.ts +0 -20
- package/dist/types/plugins/pools-history/index.d.ts +0 -2
- package/dist/types/plugins/pools-history/types.d.ts +0 -9
- package/dist/types/sdk/market/kyc/KYCRegistry.d.ts +0 -52
- package/dist/types/sdk/market/kyc/index.d.ts +0 -3
- package/dist/types/sdk/market/kyc/securitize/SecuritizeKYCFactory.d.ts +0 -428
- package/dist/types/sdk/market/kyc/securitize/constants.d.ts +0 -1
- package/dist/types/sdk/market/kyc/securitize/index.d.ts +0 -3
- package/dist/types/sdk/market/kyc/securitize/types.d.ts +0 -127
- package/dist/types/sdk/market/kyc/types.d.ts +0 -170
- package/dist/types/sdk/utils/viem/executeDelegatedMulticalls.d.ts +0 -28
- /package/dist/cjs/plugins/{pools-history → apy}/package.json +0 -0
- /package/dist/cjs/plugins/{pools-history → apy}/types.js +0 -0
- /package/dist/esm/plugins/{pools-history → apy}/package.json +0 -0
- /package/dist/esm/plugins/{pools-history/types.js → apy/pool-apy-types.js} +0 -0
- /package/dist/esm/{sdk/market/kyc/securitize → plugins/apy}/types.js +0 -0
|
@@ -1,84 +1,34 @@
|
|
|
1
1
|
import { iPoolV310Abi } from "../../abi/310/generated.js";
|
|
2
|
-
import { ierc20Abi } from "../../abi/iERC20.js";
|
|
3
2
|
import { ierc20ZapperDepositsAbi } from "../../abi/iERC20ZapperDeposits.js";
|
|
4
3
|
import { iethZapperDepositsAbi } from "../../abi/iETHZapperDeposits.js";
|
|
5
4
|
import { iZapperAbi } from "../../abi/iZapper.js";
|
|
6
|
-
import {
|
|
7
|
-
KYC_UNDERLYING_DEFAULT,
|
|
8
|
-
KYC_UNDERLYING_ON_DEMAND,
|
|
9
|
-
SDKConstruct
|
|
10
|
-
} from "../base/index.js";
|
|
5
|
+
import { SDKConstruct } from "../base/index.js";
|
|
11
6
|
import { NATIVE_ADDRESS } from "../constants/index.js";
|
|
12
7
|
import { AddressSet, hexEq } from "../utils/index.js";
|
|
13
8
|
class PoolService extends SDKConstruct {
|
|
14
9
|
/**
|
|
15
|
-
*
|
|
10
|
+
* @inheritdoc IPoolsService.getDepositTokensIn
|
|
16
11
|
*/
|
|
17
12
|
getDepositTokensIn(pool) {
|
|
18
|
-
const underlying = this.#describeUnderlying(pool);
|
|
19
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
20
|
-
switch (underlying.contractType) {
|
|
21
|
-
case KYC_UNDERLYING_DEFAULT:
|
|
22
|
-
return this.#depositTokensIn(pool, false);
|
|
23
|
-
case KYC_UNDERLYING_ON_DEMAND:
|
|
24
|
-
return [underlying.asset];
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
13
|
return this.#depositTokensIn(pool, true);
|
|
28
14
|
}
|
|
29
15
|
/**
|
|
30
|
-
*
|
|
16
|
+
* @inheritdoc IPoolsService.getDepositTokensOut
|
|
31
17
|
*/
|
|
32
18
|
getDepositTokensOut(pool, tokenIn) {
|
|
33
|
-
const underlying = this.#describeUnderlying(pool);
|
|
34
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
35
|
-
switch (underlying.contractType) {
|
|
36
|
-
case KYC_UNDERLYING_DEFAULT:
|
|
37
|
-
return this.#depositTokensOut(pool, tokenIn, false);
|
|
38
|
-
case KYC_UNDERLYING_ON_DEMAND:
|
|
39
|
-
return [];
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
19
|
return this.#depositTokensOut(pool, tokenIn, true);
|
|
43
20
|
}
|
|
44
21
|
/**
|
|
45
|
-
*
|
|
22
|
+
* @inheritdoc IPoolsService.getDepositMetadata
|
|
46
23
|
*/
|
|
47
24
|
getDepositMetadata(pool, tokenIn, tokenOut) {
|
|
48
|
-
const underlying = this.#describeUnderlying(pool);
|
|
49
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
50
|
-
switch (underlying.contractType) {
|
|
51
|
-
case KYC_UNDERLYING_DEFAULT: {
|
|
52
|
-
return this.#depositMetadata(
|
|
53
|
-
"kyc-default",
|
|
54
|
-
pool,
|
|
55
|
-
tokenIn,
|
|
56
|
-
tokenOut,
|
|
57
|
-
false
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
case KYC_UNDERLYING_ON_DEMAND:
|
|
61
|
-
return {
|
|
62
|
-
zapper: void 0,
|
|
63
|
-
approveTarget: underlying.liquidityProvider.addr,
|
|
64
|
-
permissible: false,
|
|
65
|
-
type: "kyc-on-demand"
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
25
|
return this.#depositMetadata("classic", pool, tokenIn, tokenOut, true);
|
|
70
26
|
}
|
|
71
27
|
/**
|
|
72
|
-
*
|
|
28
|
+
* @inheritdoc IPoolsService.addLiquidity
|
|
73
29
|
*/
|
|
74
30
|
addLiquidity(props) {
|
|
75
31
|
const { collateral, meta, permit, referralCode, pool, wallet } = props;
|
|
76
|
-
const underlying = this.#describeUnderlying(pool);
|
|
77
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
78
|
-
if (underlying.contractType === KYC_UNDERLYING_ON_DEMAND) {
|
|
79
|
-
return void 0;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
32
|
const { zapper } = meta;
|
|
83
33
|
if (zapper && hexEq(zapper.tokenIn.addr, NATIVE_ADDRESS)) {
|
|
84
34
|
return {
|
|
@@ -118,51 +68,22 @@ class PoolService extends SDKConstruct {
|
|
|
118
68
|
}
|
|
119
69
|
}
|
|
120
70
|
/**
|
|
121
|
-
*
|
|
71
|
+
* @inheritdoc IPoolsService.getWithdrawalTokensIn
|
|
122
72
|
*/
|
|
123
73
|
getWithdrawalTokensIn(pool) {
|
|
124
|
-
const underlying = this.#describeUnderlying(pool);
|
|
125
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
126
|
-
switch (underlying.contractType) {
|
|
127
|
-
case KYC_UNDERLYING_DEFAULT:
|
|
128
|
-
return this.#withdrawalTokensIn(pool, false);
|
|
129
|
-
case KYC_UNDERLYING_ON_DEMAND:
|
|
130
|
-
return [];
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
74
|
return this.#withdrawalTokensIn(pool, true);
|
|
134
75
|
}
|
|
135
76
|
/**
|
|
136
|
-
*
|
|
77
|
+
* @inheritdoc IPoolsService.getWithdrawalTokensOut
|
|
137
78
|
*/
|
|
138
79
|
getWithdrawalTokensOut(pool, tokenIn) {
|
|
139
|
-
const underlying = this.#describeUnderlying(pool);
|
|
140
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
141
|
-
switch (underlying.contractType) {
|
|
142
|
-
case KYC_UNDERLYING_DEFAULT:
|
|
143
|
-
return this.#withdrawalTokensOut(pool, tokenIn, false);
|
|
144
|
-
case KYC_UNDERLYING_ON_DEMAND:
|
|
145
|
-
return [underlying.asset];
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
80
|
return this.#withdrawalTokensOut(pool, tokenIn, true);
|
|
149
81
|
}
|
|
150
82
|
/**
|
|
151
|
-
*
|
|
83
|
+
* @inheritdoc IPoolsService.removeLiquidity
|
|
152
84
|
*/
|
|
153
85
|
removeLiquidity(props) {
|
|
154
86
|
const { pool, amount, meta, wallet, permit } = props;
|
|
155
|
-
const underlying = this.#describeUnderlying(pool);
|
|
156
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
157
|
-
if (underlying.contractType === KYC_UNDERLYING_ON_DEMAND) {
|
|
158
|
-
return {
|
|
159
|
-
abi: ierc20Abi,
|
|
160
|
-
functionName: "approve",
|
|
161
|
-
args: [underlying.liquidityProvider, 0n],
|
|
162
|
-
target: underlying.asset
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
87
|
if (meta.zapper) {
|
|
167
88
|
return permit ? {
|
|
168
89
|
target: meta.zapper.baseParams.addr,
|
|
@@ -191,30 +112,9 @@ class PoolService extends SDKConstruct {
|
|
|
191
112
|
};
|
|
192
113
|
}
|
|
193
114
|
/**
|
|
194
|
-
*
|
|
115
|
+
* @inheritdoc IPoolsService.getWithdrawalMetadata
|
|
195
116
|
*/
|
|
196
117
|
getWithdrawalMetadata(pool, tokenIn, tokenOut) {
|
|
197
|
-
const underlying = this.#describeUnderlying(pool);
|
|
198
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
199
|
-
switch (underlying.contractType) {
|
|
200
|
-
case KYC_UNDERLYING_DEFAULT: {
|
|
201
|
-
return this.#withdrawalMetadata(
|
|
202
|
-
"kyc-default",
|
|
203
|
-
pool,
|
|
204
|
-
tokenIn,
|
|
205
|
-
tokenOut,
|
|
206
|
-
false
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
case KYC_UNDERLYING_ON_DEMAND:
|
|
210
|
-
return {
|
|
211
|
-
zapper: void 0,
|
|
212
|
-
approveTarget: void 0,
|
|
213
|
-
permissible: false,
|
|
214
|
-
type: "kyc-on-demand"
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
118
|
return this.#withdrawalMetadata("classic", pool, tokenIn, tokenOut, true);
|
|
219
119
|
}
|
|
220
120
|
/**
|
|
@@ -374,6 +274,8 @@ class PoolService extends SDKConstruct {
|
|
|
374
274
|
zapper,
|
|
375
275
|
// Approval target is zapper when routed, otherwise the pool contract.
|
|
376
276
|
approveTarget: zapper?.baseParams.addr ?? pool.pool.address,
|
|
277
|
+
// TODO: instead of permissible, return permitType depending on tokenIn
|
|
278
|
+
// "none" | "eip2612" | "dai_like";
|
|
377
279
|
permissible: !!zapper && !hexEq(tokenIn, NATIVE_ADDRESS),
|
|
378
280
|
type
|
|
379
281
|
};
|
|
@@ -401,6 +303,8 @@ class PoolService extends SDKConstruct {
|
|
|
401
303
|
zapper,
|
|
402
304
|
// Approval target exists only for zapper-based withdrawals.
|
|
403
305
|
approveTarget: zapper?.baseParams.addr,
|
|
306
|
+
// TODO: instead of permissible, return permitType depending on tokenIn
|
|
307
|
+
// "none" | "eip2612" | "dai_like";
|
|
404
308
|
permissible: !!zapper,
|
|
405
309
|
type
|
|
406
310
|
};
|
|
@@ -3,8 +3,12 @@ import {
|
|
|
3
3
|
CallExecutionError,
|
|
4
4
|
ContractFunctionRevertedError,
|
|
5
5
|
decodeFunctionData,
|
|
6
|
+
decodeFunctionResult,
|
|
7
|
+
encodeFunctionData,
|
|
6
8
|
parseAbi
|
|
7
9
|
} from "viem";
|
|
10
|
+
import { call } from "viem/actions";
|
|
11
|
+
import { getAction, parseAccount } from "viem/utils";
|
|
8
12
|
import { errorAbis } from "../../../abi/errors.js";
|
|
9
13
|
import { iUpdatablePriceFeedAbi } from "../../../abi/iUpdatablePriceFeed.js";
|
|
10
14
|
import { generateCastTraceCall } from "./cast.js";
|
|
@@ -34,6 +38,41 @@ async function simulateWithPriceUpdates(client, parameters) {
|
|
|
34
38
|
"client chain not configured. multicallAddress is required."
|
|
35
39
|
);
|
|
36
40
|
}
|
|
41
|
+
if (priceUpdates.length === 0 && restContracts.length === 1) {
|
|
42
|
+
const contract = restContracts[0];
|
|
43
|
+
const { abi, address, args, functionName } = contract;
|
|
44
|
+
const callData = encodeFunctionData({ abi, args, functionName });
|
|
45
|
+
const request2 = {
|
|
46
|
+
batch: false,
|
|
47
|
+
data: callData,
|
|
48
|
+
to: address,
|
|
49
|
+
blockNumber: rest.blockNumber,
|
|
50
|
+
blockTag: rest.blockTag,
|
|
51
|
+
gas: rest.gas,
|
|
52
|
+
account: rest.account ? parseAccount(rest.account) : client.account,
|
|
53
|
+
value: rest.value
|
|
54
|
+
};
|
|
55
|
+
try {
|
|
56
|
+
const { data } = await getAction(client, call, "call")(request2);
|
|
57
|
+
const result = decodeFunctionResult({
|
|
58
|
+
abi,
|
|
59
|
+
args,
|
|
60
|
+
data: data || "0x",
|
|
61
|
+
functionName
|
|
62
|
+
});
|
|
63
|
+
return [
|
|
64
|
+
result
|
|
65
|
+
];
|
|
66
|
+
} catch (e) {
|
|
67
|
+
throw getSimulateWithPriceUpdatesError(
|
|
68
|
+
e,
|
|
69
|
+
priceUpdates,
|
|
70
|
+
restContracts,
|
|
71
|
+
void 0,
|
|
72
|
+
request2
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
37
76
|
let request;
|
|
38
77
|
try {
|
|
39
78
|
const contracts = [
|
|
@@ -154,8 +193,8 @@ function getSimulateWithPriceUpdatesError(cause, priceUpdates, calls, results, r
|
|
|
154
193
|
return [extractCallError(result), p.pretty, tsValid].filter(Boolean).join(" ");
|
|
155
194
|
});
|
|
156
195
|
const prettyCalls = callsResults.map((c, i) => {
|
|
157
|
-
const
|
|
158
|
-
return [extractCallError(c), `${
|
|
196
|
+
const call2 = calls[i];
|
|
197
|
+
return [extractCallError(c), `${call2.address}.${call2.functionName}`].filter(Boolean).join(" ");
|
|
159
198
|
});
|
|
160
199
|
if (results[0]?.status === "failure") {
|
|
161
200
|
prettyCalls.unshift(
|
|
@@ -2,7 +2,7 @@ import type { AbiParameter, Address } from "viem";
|
|
|
2
2
|
import type { BaseContractStateHuman } from "../../sdk/types/state-human.js";
|
|
3
3
|
import type { LegacyAdapterOperation } from "./legacyAdapterOperations.js";
|
|
4
4
|
export type VersionedAbi = Record<number, readonly AbiParameter[]>;
|
|
5
|
-
export type AdapterContractType = "ADAPTER::ACCOUNT_MIGRATOR" | "ADAPTER::BALANCER_V3_ROUTER" | "ADAPTER::BALANCER_V3_WRAPPER" | "ADAPTER::BALANCER_VAULT" | "ADAPTER::CAMELOT_V3_ROUTER" | "ADAPTER::CURVE_STABLE_NG" | "ADAPTER::CURVE_V1_2ASSETS" | "ADAPTER::CURVE_V1_3ASSETS" | "ADAPTER::CURVE_V1_4ASSETS" | "ADAPTER::CURVE_V1_STECRV_POOL" | "ADAPTER::CURVE_V1_WRAPPER" | "ADAPTER::CVX_V1_BASE_REWARD_POOL" | "ADAPTER::CVX_V1_BOOSTER" | "ADAPTER::DAI_USDS_EXCHANGE" | "ADAPTER::EQUALIZER_ROUTER" | "ADAPTER::ERC4626_VAULT" | "ADAPTER::ERC4626_VAULT_REFERRAL" | "ADAPTER::FLUID_DEX" | "ADAPTER::INFINIFI_GATEWAY" | "ADAPTER::INFINIFI_UNWINDING" | "ADAPTER::INFRARED_VAULT" | "ADAPTER::KELP_DEPOSIT_POOL" | "ADAPTER::KELP_WITHDRAWAL" | "ADAPTER::KODIAK_ISLAND_GATEWAY" | "ADAPTER::LIDO_V1" | "ADAPTER::LIDO_WSTETH_V1" | "ADAPTER::MELLOW_CLAIMER" | "ADAPTER::MELLOW_DVV" | "ADAPTER::MELLOW_ERC4626_VAULT" | "ADAPTER::MELLOW_LRT_VAULT" | "ADAPTER::MELLOW_WRAPPER" | "ADAPTER::MELLOW_DEPOSIT_QUEUE_QUEUE" | "ADAPTER::MELLOW_REDEEM_QUEUE_QUEUE" | "ADAPTER::MIDAS_ISSUANCE_VAULT" | "ADAPTER::MIDAS_REDEMPTION_VAULT" | "ADAPTER::PENDLE_ROUTER" | "ADAPTER::STAKING_REWARDS" | "ADAPTER::
|
|
5
|
+
export type AdapterContractType = "ADAPTER::ACCOUNT_MIGRATOR" | "ADAPTER::BALANCER_V3_ROUTER" | "ADAPTER::BALANCER_V3_WRAPPER" | "ADAPTER::BALANCER_VAULT" | "ADAPTER::CAMELOT_V3_ROUTER" | "ADAPTER::CURVE_STABLE_NG" | "ADAPTER::CURVE_V1_2ASSETS" | "ADAPTER::CURVE_V1_3ASSETS" | "ADAPTER::CURVE_V1_4ASSETS" | "ADAPTER::CURVE_V1_STECRV_POOL" | "ADAPTER::CURVE_V1_WRAPPER" | "ADAPTER::CVX_V1_BASE_REWARD_POOL" | "ADAPTER::CVX_V1_BOOSTER" | "ADAPTER::DAI_USDS_EXCHANGE" | "ADAPTER::EQUALIZER_ROUTER" | "ADAPTER::ERC4626_VAULT" | "ADAPTER::ERC4626_VAULT_REFERRAL" | "ADAPTER::FLUID_DEX" | "ADAPTER::INFINIFI_GATEWAY" | "ADAPTER::INFINIFI_UNWINDING" | "ADAPTER::INFRARED_VAULT" | "ADAPTER::KELP_DEPOSIT_POOL" | "ADAPTER::KELP_WITHDRAWAL" | "ADAPTER::KODIAK_ISLAND_GATEWAY" | "ADAPTER::LIDO_V1" | "ADAPTER::LIDO_WSTETH_V1" | "ADAPTER::MELLOW_CLAIMER" | "ADAPTER::MELLOW_DVV" | "ADAPTER::MELLOW_ERC4626_VAULT" | "ADAPTER::MELLOW_LRT_VAULT" | "ADAPTER::MELLOW_WRAPPER" | "ADAPTER::MELLOW_DEPOSIT_QUEUE_QUEUE" | "ADAPTER::MELLOW_REDEEM_QUEUE_QUEUE" | "ADAPTER::MIDAS_ISSUANCE_VAULT" | "ADAPTER::MIDAS_REDEMPTION_VAULT" | "ADAPTER::PENDLE_ROUTER" | "ADAPTER::STAKING_REWARDS" | "ADAPTER::TRADER_JOE_ROUTER" | "ADAPTER::UNISWAP_V2_ROUTER" | "ADAPTER::UNISWAP_V3_ROUTER" | "ADAPTER::UNISWAP_V4_GATEWAY" | "ADAPTER::UPSHIFT_VAULT" | "ADAPTER::VELODROME_V2_ROUTER" | "ADAPTER::YEARN_V2";
|
|
6
6
|
export declare enum AdapterType {
|
|
7
7
|
ACCOUNT_MIGRATOR = "ACCOUNT_MIGRATOR",
|
|
8
8
|
BALANCER_V3_ROUTER = "BALANCER_V3_ROUTER",
|
|
@@ -41,7 +41,7 @@ export declare enum AdapterType {
|
|
|
41
41
|
MIDAS_REDEMPTION_VAULT = "MIDAS_REDEMPTION_VAULT",
|
|
42
42
|
PENDLE_ROUTER = "PENDLE_ROUTER",
|
|
43
43
|
STAKING_REWARDS = "STAKING_REWARDS",
|
|
44
|
-
|
|
44
|
+
TRADER_JOE_ROUTER = "TRADER_JOE_ROUTER",
|
|
45
45
|
UNISWAP_V2_ROUTER = "UNISWAP_V2_ROUTER",
|
|
46
46
|
UNISWAP_V3_ROUTER = "UNISWAP_V3_ROUTER",
|
|
47
47
|
UNISWAP_V4_GATEWAY = "UNISWAP_V4_GATEWAY",
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { IGearboxSDKPlugin } from "../../sdk/index.js";
|
|
3
|
+
import { AddressMap, BasePlugin } from "../../sdk/index.js";
|
|
4
|
+
import type { GetPoolsAPYResult } from "./pool-apy-types.js";
|
|
5
|
+
import type { ApySnapshotState, Pool7DAgoState, Pools7DAgoStateHuman } from "./types.js";
|
|
6
|
+
export interface ApyPluginState {
|
|
7
|
+
pools7DAgo: Record<Address, Pool7DAgoState>;
|
|
8
|
+
apySnapshot: ApySnapshotState;
|
|
9
|
+
}
|
|
10
|
+
export interface ApyPluginConstructorOptions {
|
|
11
|
+
apyUrl?: string;
|
|
12
|
+
/** TTL for the shared HTTP cache in milliseconds (default: 10 minutes, see `DEFAULT_APY_INTERVAL_MS`) */
|
|
13
|
+
cacheTtlMs?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface ApyPluginLoadOptions {
|
|
16
|
+
/**
|
|
17
|
+
* When `false` and the plugin is already loaded, skips the multicall that loads
|
|
18
|
+
* pool diesel rates at the ~7d-ago block; only the APY snapshot is refreshed.
|
|
19
|
+
* Ignored on the first load (both datasets are always fetched initially).
|
|
20
|
+
*/
|
|
21
|
+
loadPools7DAgo?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare class ApyPlugin extends BasePlugin<ApyPluginState> implements IGearboxSDKPlugin<ApyPluginState> {
|
|
24
|
+
#private;
|
|
25
|
+
constructor(loadOnAttach?: boolean, options?: ApyPluginConstructorOptions);
|
|
26
|
+
load(force?: boolean, loadOptions?: ApyPluginLoadOptions): Promise<ApyPluginState>;
|
|
27
|
+
get loaded(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* @throws if plugin is not loaded
|
|
30
|
+
*/
|
|
31
|
+
get pools7DAgo(): AddressMap<Pool7DAgoState>;
|
|
32
|
+
/**
|
|
33
|
+
* @throws if plugin is not loaded
|
|
34
|
+
*/
|
|
35
|
+
get apySnapshot(): ApySnapshotState;
|
|
36
|
+
/**
|
|
37
|
+
* Computes per-pool APY (current + 7d-ago) and points for all markets.
|
|
38
|
+
*
|
|
39
|
+
* @throws if plugin is not loaded
|
|
40
|
+
*/
|
|
41
|
+
getPoolsAPY(): GetPoolsAPYResult;
|
|
42
|
+
syncState(): Promise<void>;
|
|
43
|
+
stateHuman(_?: boolean): Pools7DAgoStateHuman[];
|
|
44
|
+
get state(): ApyPluginState;
|
|
45
|
+
hydrate(state: ApyPluginState): void;
|
|
46
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Output } from "../../rewards/apy/index.js";
|
|
2
|
+
import type { ILogger } from "../../sdk/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Process-wide cache for the APY state-cache JSON.
|
|
5
|
+
*
|
|
6
|
+
* Multiple ApyPlugin instances (one per SDK / network) share the same
|
|
7
|
+
* cached HTTP response so that only **one** request is made per TTL window
|
|
8
|
+
* regardless of how many SDK instances exist.
|
|
9
|
+
*
|
|
10
|
+
* Concurrent callers that arrive while a fetch is already in flight
|
|
11
|
+
* are de-duplicated — they all await the same promise.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ApyOutputCache {
|
|
14
|
+
#private;
|
|
15
|
+
private constructor();
|
|
16
|
+
/**
|
|
17
|
+
* Returns a shared cache instance for the given URL.
|
|
18
|
+
* The same instance is reused across all callers with identical URL.
|
|
19
|
+
*/
|
|
20
|
+
static get(url: string, ttlMs: number, logger?: ILogger): ApyOutputCache;
|
|
21
|
+
/**
|
|
22
|
+
* Returns cached Output if fresh, otherwise fetches from the network.
|
|
23
|
+
* Concurrent calls are de-duplicated.
|
|
24
|
+
*/
|
|
25
|
+
fetch(): Promise<Output<string, string> | undefined>;
|
|
26
|
+
/** Evicts all cached entries. Mainly useful for tests. */
|
|
27
|
+
static clearAll(): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DataResult, Output, PoolOutputDetails, TokenOutputDetails } from "../../rewards/apy/index.js";
|
|
2
|
+
import type { GearStats, NetworkApyData } from "./types.js";
|
|
3
|
+
export declare function numberToAPY(baseApy: number): number;
|
|
4
|
+
export declare function parseGearStats(output: Output<string, string>): GearStats | null;
|
|
5
|
+
export declare function parseNetworkApy(apyResp: DataResult<TokenOutputDetails<string>[]> | undefined, poolResp: DataResult<PoolOutputDetails<string>[]> | undefined): NetworkApyData | undefined;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { ExternalApy as ExternalApySDK, PoolExtraApy, PoolPointsInfo } from "../../rewards/apy/index.js";
|
|
3
|
+
import type { PoolPointsBase } from "../../rewards/index.js";
|
|
4
|
+
export interface PoolBaseAPY {
|
|
5
|
+
type: "supplyAPY" | "tokenYield";
|
|
6
|
+
apy: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* External APY enriched with the cumulative `totalValue`
|
|
10
|
+
* (base + extra + external).
|
|
11
|
+
*/
|
|
12
|
+
export interface PoolExternalAPY extends ExternalApySDK {
|
|
13
|
+
totalValue: number;
|
|
14
|
+
}
|
|
15
|
+
export interface PoolFullAPY {
|
|
16
|
+
totalAPY: number;
|
|
17
|
+
baseAPY: PoolBaseAPY[];
|
|
18
|
+
extraAPY: PoolExtraApy[];
|
|
19
|
+
extraAPYTotal: number;
|
|
20
|
+
externalAPY: PoolExternalAPY | undefined;
|
|
21
|
+
}
|
|
22
|
+
export interface PoolFullAPY7DAgo extends PoolFullAPY {
|
|
23
|
+
loading7DAgo: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface PoolPointsWithTips {
|
|
26
|
+
reward?: PoolPointsInfo<string>;
|
|
27
|
+
amount: string;
|
|
28
|
+
name: string;
|
|
29
|
+
tokenTitle?: string;
|
|
30
|
+
fullTip: string;
|
|
31
|
+
}
|
|
32
|
+
type AllPoolsAPY = Record<Address, PoolFullAPY>;
|
|
33
|
+
type AllPoolsAPY7DAgo = Record<Address, PoolFullAPY7DAgo>;
|
|
34
|
+
type AllPoolsPoints = Record<Address, PoolPointsWithTips[] | undefined>;
|
|
35
|
+
export interface GetPoolsAPYResult {
|
|
36
|
+
data: AllPoolsAPY;
|
|
37
|
+
data7DAgo: AllPoolsAPY7DAgo;
|
|
38
|
+
pointsBase: PoolPointsBase;
|
|
39
|
+
points: AllPoolsPoints;
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { ExternalApy, PoolExtraApy } from "../../rewards/apy/index.js";
|
|
3
|
+
import type { PoolPointsBase } from "../../rewards/rewards/extra-apy.js";
|
|
4
|
+
import type { AddressMap } from "../../sdk/index.js";
|
|
5
|
+
import type { PoolFullAPY, PoolFullAPY7DAgo, PoolPointsWithTips } from "./pool-apy-types.js";
|
|
6
|
+
/**
|
|
7
|
+
* Collects extra APY entries for the given token addresses from the
|
|
8
|
+
* `poolExtraAPYList` map.
|
|
9
|
+
*
|
|
10
|
+
* In the client, `lookupAddresses` = [pool.address, ...pool.stakedDieselToken].
|
|
11
|
+
* The caller is responsible for providing the correct set of addresses.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getPoolExtraAPY(lookupAddresses: Address[], poolExtraAPYList: Record<Address, PoolExtraApy[]> | undefined): PoolExtraApy[];
|
|
14
|
+
/**
|
|
15
|
+
* Computes annualized supply APY based on diesel rate change over ~7 days.
|
|
16
|
+
*
|
|
17
|
+
* Returns a value in "percentage" units (e.g. 5 ≈ 5 %).
|
|
18
|
+
* Falls back to current on-chain `supplyRate` if 7d-ago diesel rate is
|
|
19
|
+
* missing or higher than the current rate.
|
|
20
|
+
*/
|
|
21
|
+
export declare function calculateSupplyApy7d(currentDieselRate: bigint, currentSupplyRate: bigint, dieselRate7DAgo: bigint): number;
|
|
22
|
+
interface CalculatePoolFullAPYProps {
|
|
23
|
+
depositAPY: number;
|
|
24
|
+
underlyingAPY: number;
|
|
25
|
+
extraAPY: PoolExtraApy[] | undefined;
|
|
26
|
+
currentExternalList: ExternalApy[] | undefined;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Aggregates all APY components for a single pool.
|
|
30
|
+
*
|
|
31
|
+
* `depositAPY` and returned values are in "percentage" units (5 ≈ 5 %).
|
|
32
|
+
* `underlyingAPY` comes from `apyList` (scaled by `PERCENTAGE_FACTOR`),
|
|
33
|
+
* so it is divided by `PERCENTAGE_FACTOR` here.
|
|
34
|
+
*
|
|
35
|
+
* External APY: first entry in `currentExternalList`, enriched with `totalValue`.
|
|
36
|
+
*/
|
|
37
|
+
export declare function calculatePoolFullAPY({ depositAPY, underlyingAPY, extraAPY, currentExternalList, }: CalculatePoolFullAPYProps): PoolFullAPY;
|
|
38
|
+
interface CalculatePoolFullAPY7DAgoProps {
|
|
39
|
+
depositAPY: number;
|
|
40
|
+
/**
|
|
41
|
+
* Annualized supply APY from the ~7d diesel snapshot, in the same units as
|
|
42
|
+
* `depositAPY`.
|
|
43
|
+
*
|
|
44
|
+
* - `undefined` — 7d snapshot not loaded yet (`loading7DAgo: true`); supply
|
|
45
|
+
* row uses `depositAPY`.
|
|
46
|
+
* - `null` — snapshot loaded but no numeric 7d supply; supply row uses
|
|
47
|
+
* `depositAPY` (`||` semantics, same as client `pool7DAgo` with missing
|
|
48
|
+
* `supplyAPY7DAgo`).
|
|
49
|
+
* - `number` — explicit 7d supply; `0` falls back to `depositAPY` via `||`.
|
|
50
|
+
*/
|
|
51
|
+
supplyAPY7DAgo?: number | null;
|
|
52
|
+
poolAPY?: PoolFullAPY | null;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Computes the 7-days-ago APY snapshot for a pool.
|
|
56
|
+
*
|
|
57
|
+
* `supplyAPY7DAgo` replaces the current deposit APY in the base component;
|
|
58
|
+
* extra & external APY are kept from the "current" calculation.
|
|
59
|
+
*/
|
|
60
|
+
export declare function calculatePoolFullAPY7DAgo({ supplyAPY7DAgo, depositAPY, poolAPY, }: CalculatePoolFullAPY7DAgoProps): PoolFullAPY7DAgo;
|
|
61
|
+
interface CalculatePoolPointsProps {
|
|
62
|
+
poolTokenSymbol: string | undefined;
|
|
63
|
+
points: PoolPointsBase[Address] | undefined;
|
|
64
|
+
tokensList: AddressMap<{
|
|
65
|
+
decimals: number;
|
|
66
|
+
}>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Transforms raw `PoolPointsBase` entries into consumer-friendly
|
|
70
|
+
* `PoolPointsWithTips` items with formatted amounts and tooltip strings.
|
|
71
|
+
*/
|
|
72
|
+
export declare function calculatePoolPoints({ poolTokenSymbol, points, tokensList, }: CalculatePoolPointsProps): PoolPointsWithTips[] | undefined;
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { ExternalApy, ExtraCollateralAPY, GearAPYDetails, PointsInfo, PoolExtraApy, PoolPointsInfo } from "../../rewards/apy/index.js";
|
|
3
|
+
import type { BaseContractStateHuman } from "../../sdk/index.js";
|
|
4
|
+
export interface Pool7DAgoState {
|
|
5
|
+
pool: Address;
|
|
6
|
+
dieselRate: bigint;
|
|
7
|
+
}
|
|
8
|
+
export interface Pools7DAgoStateHuman extends BaseContractStateHuman {
|
|
9
|
+
dieselRate: bigint;
|
|
10
|
+
}
|
|
11
|
+
export interface FarmRewardInfo {
|
|
12
|
+
address: Address;
|
|
13
|
+
symbol: string;
|
|
14
|
+
rewardToken: Address;
|
|
15
|
+
rewardSymbol: string;
|
|
16
|
+
token: Address;
|
|
17
|
+
duration: bigint;
|
|
18
|
+
finished: bigint;
|
|
19
|
+
reward: bigint;
|
|
20
|
+
balance: bigint;
|
|
21
|
+
}
|
|
22
|
+
export interface NetworkApyData {
|
|
23
|
+
apyList: Record<Address, number> | undefined;
|
|
24
|
+
extraCollateralAPYList: Record<Address, Record<Address, ExtraCollateralAPY>> | undefined;
|
|
25
|
+
pointsList: Record<Address, PointsInfo<string>> | undefined;
|
|
26
|
+
extraCollateralPointsList: Record<Address, Record<Address, PointsInfo<string>>> | undefined;
|
|
27
|
+
poolRewardsList: Record<Address, Array<PoolPointsInfo<string>>> | undefined;
|
|
28
|
+
tokenExtraRewardsList: Record<Address, Array<FarmRewardInfo>> | undefined;
|
|
29
|
+
poolExternalAPYList: Record<Address, Array<ExternalApy>> | undefined;
|
|
30
|
+
poolExtraAPYList: Record<Address, Array<PoolExtraApy>> | undefined;
|
|
31
|
+
}
|
|
32
|
+
export type GearStats = Omit<GearAPYDetails, "lastUpdated">;
|
|
33
|
+
export interface ApySnapshotState {
|
|
34
|
+
apy: NetworkApyData;
|
|
35
|
+
gearStats: GearStats | null;
|
|
36
|
+
timestamp: string;
|
|
37
|
+
}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
import { type NetworkType } from "../../sdk/index.js";
|
|
3
|
-
|
|
3
|
+
export interface PoolData {
|
|
4
|
+
address: Address;
|
|
5
|
+
version: number;
|
|
6
|
+
underlyingToken: Address;
|
|
7
|
+
dieselRateRay: bigint;
|
|
8
|
+
dieselToken: Address;
|
|
9
|
+
stakedDieselToken: Address[];
|
|
10
|
+
stakedDieselToken_old: Address[];
|
|
11
|
+
expectedLiquidity: bigint;
|
|
12
|
+
}
|
|
4
13
|
export interface GearboxExtraMerkleLmReward {
|
|
5
14
|
pool: Address;
|
|
6
15
|
poolToken: Address;
|
|
@@ -4,13 +4,3 @@ export interface TokenData {
|
|
|
4
4
|
symbol: string;
|
|
5
5
|
decimals: number;
|
|
6
6
|
}
|
|
7
|
-
export interface PoolData {
|
|
8
|
-
address: Address;
|
|
9
|
-
version: number;
|
|
10
|
-
underlyingToken: Address;
|
|
11
|
-
dieselRateRay: bigint;
|
|
12
|
-
dieselToken: Address;
|
|
13
|
-
stakedDieselToken: Address[];
|
|
14
|
-
stakedDieselToken_old: Address[];
|
|
15
|
-
expectedLiquidity: bigint;
|
|
16
|
-
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
-
import { type Asset, type NetworkType } from "../../sdk/index.js";
|
|
2
|
+
import { type Asset, type MarketSuite, type NetworkType, type TokensMeta } from "../../sdk/index.js";
|
|
3
3
|
import type { PoolPointsInfo } from "../index.js";
|
|
4
|
-
import type {
|
|
5
|
-
type PartialPool = Pick<PoolData, "expectedLiquidity" | "underlyingToken" | "address">;
|
|
4
|
+
import type { TokenData } from "./common.js";
|
|
6
5
|
export interface GetPointsByPoolProps {
|
|
7
6
|
poolRewards: Record<Address, Array<PoolPointsInfo<string>>>;
|
|
8
7
|
totalTokenBalances: Record<Address, Asset>;
|
|
9
|
-
pools:
|
|
10
|
-
tokensList:
|
|
8
|
+
pools: MarketSuite[];
|
|
9
|
+
tokensList: TokensMeta;
|
|
11
10
|
}
|
|
12
11
|
export interface GetTotalTokensOnProtocolProps {
|
|
13
12
|
tokensToCheck: Array<Address>;
|
|
@@ -27,4 +26,3 @@ export declare class PoolPointsAPI {
|
|
|
27
26
|
static getPointsByPool({ poolRewards, totalTokenBalances, pools, tokensList, }: GetPointsByPoolProps): PoolPointsBase;
|
|
28
27
|
private static getPoolTokenPoints;
|
|
29
28
|
}
|
|
30
|
-
export {};
|
|
@@ -6,7 +6,6 @@ import { ChainContractsRegister } from "./base/index.js";
|
|
|
6
6
|
import type { GearboxChain, NetworkType } from "./chain/chains.js";
|
|
7
7
|
import type { VersionRange } from "./constants/index.js";
|
|
8
8
|
import type { IAddressProviderContract } from "./core/index.js";
|
|
9
|
-
import { KYCRegistry } from "./market/kyc/index.js";
|
|
10
9
|
import { MarketRegister } from "./market/MarketRegister.js";
|
|
11
10
|
import { PriceFeedRegister } from "./market/pricefeeds/index.js";
|
|
12
11
|
import type { SDKOptions } from "./options.js";
|
|
@@ -300,12 +299,6 @@ export declare class GearboxSDK<const Plugins extends PluginsMap = {}> extends C
|
|
|
300
299
|
* @throws If the SDK has not been attached or hydrated yet.
|
|
301
300
|
**/
|
|
302
301
|
get marketRegister(): MarketRegister;
|
|
303
|
-
/**
|
|
304
|
-
* KYC register for KYC-wrapped underlying tokens and factories.
|
|
305
|
-
*
|
|
306
|
-
* @throws If the SDK has not been attached or hydrated yet.
|
|
307
|
-
**/
|
|
308
|
-
get kyc(): KYCRegistry;
|
|
309
302
|
/**
|
|
310
303
|
* Resolves the appropriate router contract for a given credit manager,
|
|
311
304
|
* credit facade, or explicit version range.
|