@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
|
@@ -22,7 +22,6 @@ __export(PoolService_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(PoolService_exports);
|
|
24
24
|
var import_generated = require("../../abi/310/generated.js");
|
|
25
|
-
var import_iERC20 = require("../../abi/iERC20.js");
|
|
26
25
|
var import_iERC20ZapperDeposits = require("../../abi/iERC20ZapperDeposits.js");
|
|
27
26
|
var import_iETHZapperDeposits = require("../../abi/iETHZapperDeposits.js");
|
|
28
27
|
var import_iZapper = require("../../abi/iZapper.js");
|
|
@@ -31,73 +30,28 @@ var import_constants = require("../constants/index.js");
|
|
|
31
30
|
var import_utils = require("../utils/index.js");
|
|
32
31
|
class PoolService extends import_base.SDKConstruct {
|
|
33
32
|
/**
|
|
34
|
-
*
|
|
33
|
+
* @inheritdoc IPoolsService.getDepositTokensIn
|
|
35
34
|
*/
|
|
36
35
|
getDepositTokensIn(pool) {
|
|
37
|
-
const underlying = this.#describeUnderlying(pool);
|
|
38
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
39
|
-
switch (underlying.contractType) {
|
|
40
|
-
case import_base.KYC_UNDERLYING_DEFAULT:
|
|
41
|
-
return this.#depositTokensIn(pool, false);
|
|
42
|
-
case import_base.KYC_UNDERLYING_ON_DEMAND:
|
|
43
|
-
return [underlying.asset];
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
36
|
return this.#depositTokensIn(pool, true);
|
|
47
37
|
}
|
|
48
38
|
/**
|
|
49
|
-
*
|
|
39
|
+
* @inheritdoc IPoolsService.getDepositTokensOut
|
|
50
40
|
*/
|
|
51
41
|
getDepositTokensOut(pool, tokenIn) {
|
|
52
|
-
const underlying = this.#describeUnderlying(pool);
|
|
53
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
54
|
-
switch (underlying.contractType) {
|
|
55
|
-
case import_base.KYC_UNDERLYING_DEFAULT:
|
|
56
|
-
return this.#depositTokensOut(pool, tokenIn, false);
|
|
57
|
-
case import_base.KYC_UNDERLYING_ON_DEMAND:
|
|
58
|
-
return [];
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
42
|
return this.#depositTokensOut(pool, tokenIn, true);
|
|
62
43
|
}
|
|
63
44
|
/**
|
|
64
|
-
*
|
|
45
|
+
* @inheritdoc IPoolsService.getDepositMetadata
|
|
65
46
|
*/
|
|
66
47
|
getDepositMetadata(pool, tokenIn, tokenOut) {
|
|
67
|
-
const underlying = this.#describeUnderlying(pool);
|
|
68
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
69
|
-
switch (underlying.contractType) {
|
|
70
|
-
case import_base.KYC_UNDERLYING_DEFAULT: {
|
|
71
|
-
return this.#depositMetadata(
|
|
72
|
-
"kyc-default",
|
|
73
|
-
pool,
|
|
74
|
-
tokenIn,
|
|
75
|
-
tokenOut,
|
|
76
|
-
false
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
case import_base.KYC_UNDERLYING_ON_DEMAND:
|
|
80
|
-
return {
|
|
81
|
-
zapper: void 0,
|
|
82
|
-
approveTarget: underlying.liquidityProvider.addr,
|
|
83
|
-
permissible: false,
|
|
84
|
-
type: "kyc-on-demand"
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
48
|
return this.#depositMetadata("classic", pool, tokenIn, tokenOut, true);
|
|
89
49
|
}
|
|
90
50
|
/**
|
|
91
|
-
*
|
|
51
|
+
* @inheritdoc IPoolsService.addLiquidity
|
|
92
52
|
*/
|
|
93
53
|
addLiquidity(props) {
|
|
94
54
|
const { collateral, meta, permit, referralCode, pool, wallet } = props;
|
|
95
|
-
const underlying = this.#describeUnderlying(pool);
|
|
96
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
97
|
-
if (underlying.contractType === import_base.KYC_UNDERLYING_ON_DEMAND) {
|
|
98
|
-
return void 0;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
55
|
const { zapper } = meta;
|
|
102
56
|
if (zapper && (0, import_utils.hexEq)(zapper.tokenIn.addr, import_constants.NATIVE_ADDRESS)) {
|
|
103
57
|
return {
|
|
@@ -137,51 +91,22 @@ class PoolService extends import_base.SDKConstruct {
|
|
|
137
91
|
}
|
|
138
92
|
}
|
|
139
93
|
/**
|
|
140
|
-
*
|
|
94
|
+
* @inheritdoc IPoolsService.getWithdrawalTokensIn
|
|
141
95
|
*/
|
|
142
96
|
getWithdrawalTokensIn(pool) {
|
|
143
|
-
const underlying = this.#describeUnderlying(pool);
|
|
144
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
145
|
-
switch (underlying.contractType) {
|
|
146
|
-
case import_base.KYC_UNDERLYING_DEFAULT:
|
|
147
|
-
return this.#withdrawalTokensIn(pool, false);
|
|
148
|
-
case import_base.KYC_UNDERLYING_ON_DEMAND:
|
|
149
|
-
return [];
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
97
|
return this.#withdrawalTokensIn(pool, true);
|
|
153
98
|
}
|
|
154
99
|
/**
|
|
155
|
-
*
|
|
100
|
+
* @inheritdoc IPoolsService.getWithdrawalTokensOut
|
|
156
101
|
*/
|
|
157
102
|
getWithdrawalTokensOut(pool, tokenIn) {
|
|
158
|
-
const underlying = this.#describeUnderlying(pool);
|
|
159
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
160
|
-
switch (underlying.contractType) {
|
|
161
|
-
case import_base.KYC_UNDERLYING_DEFAULT:
|
|
162
|
-
return this.#withdrawalTokensOut(pool, tokenIn, false);
|
|
163
|
-
case import_base.KYC_UNDERLYING_ON_DEMAND:
|
|
164
|
-
return [underlying.asset];
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
103
|
return this.#withdrawalTokensOut(pool, tokenIn, true);
|
|
168
104
|
}
|
|
169
105
|
/**
|
|
170
|
-
*
|
|
106
|
+
* @inheritdoc IPoolsService.removeLiquidity
|
|
171
107
|
*/
|
|
172
108
|
removeLiquidity(props) {
|
|
173
109
|
const { pool, amount, meta, wallet, permit } = props;
|
|
174
|
-
const underlying = this.#describeUnderlying(pool);
|
|
175
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
176
|
-
if (underlying.contractType === import_base.KYC_UNDERLYING_ON_DEMAND) {
|
|
177
|
-
return {
|
|
178
|
-
abi: import_iERC20.ierc20Abi,
|
|
179
|
-
functionName: "approve",
|
|
180
|
-
args: [underlying.liquidityProvider, 0n],
|
|
181
|
-
target: underlying.asset
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
110
|
if (meta.zapper) {
|
|
186
111
|
return permit ? {
|
|
187
112
|
target: meta.zapper.baseParams.addr,
|
|
@@ -210,30 +135,9 @@ class PoolService extends import_base.SDKConstruct {
|
|
|
210
135
|
};
|
|
211
136
|
}
|
|
212
137
|
/**
|
|
213
|
-
*
|
|
138
|
+
* @inheritdoc IPoolsService.getWithdrawalMetadata
|
|
214
139
|
*/
|
|
215
140
|
getWithdrawalMetadata(pool, tokenIn, tokenOut) {
|
|
216
|
-
const underlying = this.#describeUnderlying(pool);
|
|
217
|
-
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
218
|
-
switch (underlying.contractType) {
|
|
219
|
-
case import_base.KYC_UNDERLYING_DEFAULT: {
|
|
220
|
-
return this.#withdrawalMetadata(
|
|
221
|
-
"kyc-default",
|
|
222
|
-
pool,
|
|
223
|
-
tokenIn,
|
|
224
|
-
tokenOut,
|
|
225
|
-
false
|
|
226
|
-
);
|
|
227
|
-
}
|
|
228
|
-
case import_base.KYC_UNDERLYING_ON_DEMAND:
|
|
229
|
-
return {
|
|
230
|
-
zapper: void 0,
|
|
231
|
-
approveTarget: void 0,
|
|
232
|
-
permissible: false,
|
|
233
|
-
type: "kyc-on-demand"
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
141
|
return this.#withdrawalMetadata("classic", pool, tokenIn, tokenOut, true);
|
|
238
142
|
}
|
|
239
143
|
/**
|
|
@@ -393,6 +297,8 @@ class PoolService extends import_base.SDKConstruct {
|
|
|
393
297
|
zapper,
|
|
394
298
|
// Approval target is zapper when routed, otherwise the pool contract.
|
|
395
299
|
approveTarget: zapper?.baseParams.addr ?? pool.pool.address,
|
|
300
|
+
// TODO: instead of permissible, return permitType depending on tokenIn
|
|
301
|
+
// "none" | "eip2612" | "dai_like";
|
|
396
302
|
permissible: !!zapper && !(0, import_utils.hexEq)(tokenIn, import_constants.NATIVE_ADDRESS),
|
|
397
303
|
type
|
|
398
304
|
};
|
|
@@ -420,6 +326,8 @@ class PoolService extends import_base.SDKConstruct {
|
|
|
420
326
|
zapper,
|
|
421
327
|
// Approval target exists only for zapper-based withdrawals.
|
|
422
328
|
approveTarget: zapper?.baseParams.addr,
|
|
329
|
+
// TODO: instead of permissible, return permitType depending on tokenIn
|
|
330
|
+
// "none" | "eip2612" | "dai_like";
|
|
423
331
|
permissible: !!zapper,
|
|
424
332
|
type
|
|
425
333
|
};
|
|
@@ -16,7 +16,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
16
16
|
var viem_exports = {};
|
|
17
17
|
module.exports = __toCommonJS(viem_exports);
|
|
18
18
|
__reExport(viem_exports, require("./cast.js"), module.exports);
|
|
19
|
-
__reExport(viem_exports, require("./executeDelegatedMulticalls.js"), module.exports);
|
|
20
19
|
__reExport(viem_exports, require("./getLogsPaginated.js"), module.exports);
|
|
21
20
|
__reExport(viem_exports, require("./getLogsSafe.js"), module.exports);
|
|
22
21
|
__reExport(viem_exports, require("./sendRawTx.js"), module.exports);
|
|
@@ -25,7 +24,6 @@ __reExport(viem_exports, require("./simulateWithPriceUpdates.js"), module.export
|
|
|
25
24
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26
25
|
0 && (module.exports = {
|
|
27
26
|
...require("./cast.js"),
|
|
28
|
-
...require("./executeDelegatedMulticalls.js"),
|
|
29
27
|
...require("./getLogsPaginated.js"),
|
|
30
28
|
...require("./getLogsSafe.js"),
|
|
31
29
|
...require("./sendRawTx.js"),
|
|
@@ -24,6 +24,8 @@ __export(simulateWithPriceUpdates_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(simulateWithPriceUpdates_exports);
|
|
26
26
|
var import_viem = require("viem");
|
|
27
|
+
var import_actions = require("viem/actions");
|
|
28
|
+
var import_utils = require("viem/utils");
|
|
27
29
|
var import_errors = require("../../../abi/errors.js");
|
|
28
30
|
var import_iUpdatablePriceFeed = require("../../../abi/iUpdatablePriceFeed.js");
|
|
29
31
|
var import_cast = require("./cast.js");
|
|
@@ -53,6 +55,41 @@ async function simulateWithPriceUpdates(client, parameters) {
|
|
|
53
55
|
"client chain not configured. multicallAddress is required."
|
|
54
56
|
);
|
|
55
57
|
}
|
|
58
|
+
if (priceUpdates.length === 0 && restContracts.length === 1) {
|
|
59
|
+
const contract = restContracts[0];
|
|
60
|
+
const { abi, address, args, functionName } = contract;
|
|
61
|
+
const callData = (0, import_viem.encodeFunctionData)({ abi, args, functionName });
|
|
62
|
+
const request2 = {
|
|
63
|
+
batch: false,
|
|
64
|
+
data: callData,
|
|
65
|
+
to: address,
|
|
66
|
+
blockNumber: rest.blockNumber,
|
|
67
|
+
blockTag: rest.blockTag,
|
|
68
|
+
gas: rest.gas,
|
|
69
|
+
account: rest.account ? (0, import_utils.parseAccount)(rest.account) : client.account,
|
|
70
|
+
value: rest.value
|
|
71
|
+
};
|
|
72
|
+
try {
|
|
73
|
+
const { data } = await (0, import_utils.getAction)(client, import_actions.call, "call")(request2);
|
|
74
|
+
const result = (0, import_viem.decodeFunctionResult)({
|
|
75
|
+
abi,
|
|
76
|
+
args,
|
|
77
|
+
data: data || "0x",
|
|
78
|
+
functionName
|
|
79
|
+
});
|
|
80
|
+
return [
|
|
81
|
+
result
|
|
82
|
+
];
|
|
83
|
+
} catch (e) {
|
|
84
|
+
throw getSimulateWithPriceUpdatesError(
|
|
85
|
+
e,
|
|
86
|
+
priceUpdates,
|
|
87
|
+
restContracts,
|
|
88
|
+
void 0,
|
|
89
|
+
request2
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
56
93
|
let request;
|
|
57
94
|
try {
|
|
58
95
|
const contracts = [
|
|
@@ -173,8 +210,8 @@ function getSimulateWithPriceUpdatesError(cause, priceUpdates, calls, results, r
|
|
|
173
210
|
return [extractCallError(result), p.pretty, tsValid].filter(Boolean).join(" ");
|
|
174
211
|
});
|
|
175
212
|
const prettyCalls = callsResults.map((c, i) => {
|
|
176
|
-
const
|
|
177
|
-
return [extractCallError(c), `${
|
|
213
|
+
const call2 = calls[i];
|
|
214
|
+
return [extractCallError(c), `${call2.address}.${call2.functionName}`].filter(Boolean).join(" ");
|
|
178
215
|
});
|
|
179
216
|
if (results[0]?.status === "failure") {
|
|
180
217
|
prettyCalls.unshift(
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
parseEventLogs
|
|
7
7
|
} from "viem";
|
|
8
8
|
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts";
|
|
9
|
-
import { iCreditFacadeV310Abi } from "../abi/310/generated.js";
|
|
9
|
+
import { iCreditFacadeV310Abi, iPoolV310Abi } from "../abi/310/generated.js";
|
|
10
10
|
import { ierc20Abi } from "../abi/iERC20.js";
|
|
11
11
|
import {
|
|
12
12
|
ADDRESS_0X0,
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
childLogger,
|
|
16
16
|
MAX_UINT256,
|
|
17
17
|
PERCENTAGE_FACTOR,
|
|
18
|
-
PoolService,
|
|
19
18
|
SDKConstruct,
|
|
20
19
|
sendRawTx
|
|
21
20
|
} from "../sdk/index.js";
|
|
@@ -44,7 +43,6 @@ class AccountOpener extends SDKConstruct {
|
|
|
44
43
|
#minDebtMultiplier;
|
|
45
44
|
#allowMint;
|
|
46
45
|
#leverageDelta;
|
|
47
|
-
#poolService;
|
|
48
46
|
constructor(service, options_ = {}) {
|
|
49
47
|
super(service.sdk);
|
|
50
48
|
const {
|
|
@@ -70,7 +68,6 @@ class AccountOpener extends SDKConstruct {
|
|
|
70
68
|
this.#poolDepositMultiplier = BigInt(poolDepositMultiplier);
|
|
71
69
|
this.#minDebtMultiplier = BigInt(minDebtMultiplier);
|
|
72
70
|
this.#leverageDelta = BigInt(leverageDelta);
|
|
73
|
-
this.#poolService = new PoolService(service.sdk);
|
|
74
71
|
this.#logger?.info(
|
|
75
72
|
{
|
|
76
73
|
borrower: privateKeyToAccount(this.borrowerKey).address,
|
|
@@ -108,10 +105,6 @@ class AccountOpener extends SDKConstruct {
|
|
|
108
105
|
},
|
|
109
106
|
"opening credit accounts"
|
|
110
107
|
);
|
|
111
|
-
await Promise.all([
|
|
112
|
-
this.sdk.tokensMeta.loadTokenData(),
|
|
113
|
-
this.sdk.marketRegister.loadZappers()
|
|
114
|
-
]);
|
|
115
108
|
let deposits = [];
|
|
116
109
|
if (depositIntoPools) {
|
|
117
110
|
try {
|
|
@@ -463,34 +456,9 @@ class AccountOpener extends SDKConstruct {
|
|
|
463
456
|
this.#logger?.debug(
|
|
464
457
|
`depositor balance in underlying: ${this.sdk.tokensMeta.formatBN(pool.underlying, allowance, { symbol: true })}`
|
|
465
458
|
);
|
|
466
|
-
const tokensOut = this.#poolService.getDepositTokensOut(
|
|
467
|
-
address,
|
|
468
|
-
underlying
|
|
469
|
-
);
|
|
470
|
-
this.#logger?.debug(
|
|
471
|
-
{ tokensOut: tokensOut.map((t) => this.labelAddress(t)) },
|
|
472
|
-
"deposit tokens out"
|
|
473
|
-
);
|
|
474
|
-
if (tokensOut.length === 0) {
|
|
475
|
-
throw new Error(`no tokens out found for pool ${poolName}`);
|
|
476
|
-
}
|
|
477
|
-
const tokenOut = tokensOut[0];
|
|
478
|
-
const metadata = this.#poolService.getDepositMetadata(
|
|
479
|
-
address,
|
|
480
|
-
underlying,
|
|
481
|
-
tokenOut
|
|
482
|
-
);
|
|
483
|
-
this.logger?.debug(
|
|
484
|
-
{
|
|
485
|
-
underlying: this.labelAddress(underlying),
|
|
486
|
-
tokenOut: this.labelAddress(tokenOut),
|
|
487
|
-
...metadata
|
|
488
|
-
},
|
|
489
|
-
"pool deposit metadata"
|
|
490
|
-
);
|
|
491
459
|
txHash = await this.#anvil.writeContract({
|
|
492
460
|
account: depositor,
|
|
493
|
-
address:
|
|
461
|
+
address: underlying,
|
|
494
462
|
abi: ierc20Abi,
|
|
495
463
|
functionName: "approve",
|
|
496
464
|
args: [address, allowance],
|
|
@@ -507,21 +475,12 @@ class AccountOpener extends SDKConstruct {
|
|
|
507
475
|
this.#logger?.debug(
|
|
508
476
|
`depositor approved underlying for pool ${poolName}: ${txHash}`
|
|
509
477
|
);
|
|
510
|
-
const depositCall = this.#poolService.addLiquidity({
|
|
511
|
-
collateral: { token: underlying, balance: amount },
|
|
512
|
-
pool: address,
|
|
513
|
-
wallet: depositor.address,
|
|
514
|
-
meta: metadata
|
|
515
|
-
});
|
|
516
|
-
if (!depositCall) {
|
|
517
|
-
throw new Error(`no deposit call could be created for ${poolName}`);
|
|
518
|
-
}
|
|
519
478
|
txHash = await this.#anvil.writeContract({
|
|
520
479
|
account: depositor,
|
|
521
|
-
address
|
|
522
|
-
abi:
|
|
523
|
-
functionName:
|
|
524
|
-
args:
|
|
480
|
+
address,
|
|
481
|
+
abi: iPoolV310Abi,
|
|
482
|
+
functionName: "deposit",
|
|
483
|
+
args: [amount, depositor.address],
|
|
525
484
|
chain: this.#anvil.chain
|
|
526
485
|
});
|
|
527
486
|
receipt = await this.#anvil.waitForTransactionReceipt({ hash: txHash });
|
|
@@ -48,7 +48,7 @@ const adapterActionSignatures = {
|
|
|
48
48
|
310: "function setPairStatusBatch((address,address,address,uint8)[])",
|
|
49
49
|
311: "function setPairStatusBatch((address,address,address,uint8,uint8)[])"
|
|
50
50
|
},
|
|
51
|
-
[AdapterType.
|
|
51
|
+
[AdapterType.TRADER_JOE_ROUTER]: {
|
|
52
52
|
310: "function setPoolStatusBatch((address,address,uint256,uint8,bool)[])"
|
|
53
53
|
},
|
|
54
54
|
[AdapterType.UNISWAP_V2_ROUTER]: {
|
|
@@ -109,7 +109,7 @@ function createAdapter(options, data, strict) {
|
|
|
109
109
|
return new PendleRouterAdapterContract(options, data);
|
|
110
110
|
case "ADAPTER::STAKING_REWARDS":
|
|
111
111
|
return new StakingRewardsAdapterContract(options, data);
|
|
112
|
-
case "ADAPTER::
|
|
112
|
+
case "ADAPTER::TRADER_JOE_ROUTER":
|
|
113
113
|
return new TraderJoeRouterAdapterContract(options, data);
|
|
114
114
|
case "ADAPTER::UNISWAP_V2_ROUTER":
|
|
115
115
|
return new UniswapV2AdapterContract(options, data);
|
|
@@ -36,7 +36,7 @@ var AdapterType = /* @__PURE__ */ ((AdapterType2) => {
|
|
|
36
36
|
AdapterType2["MIDAS_REDEMPTION_VAULT"] = "MIDAS_REDEMPTION_VAULT";
|
|
37
37
|
AdapterType2["PENDLE_ROUTER"] = "PENDLE_ROUTER";
|
|
38
38
|
AdapterType2["STAKING_REWARDS"] = "STAKING_REWARDS";
|
|
39
|
-
AdapterType2["
|
|
39
|
+
AdapterType2["TRADER_JOE_ROUTER"] = "TRADER_JOE_ROUTER";
|
|
40
40
|
AdapterType2["UNISWAP_V2_ROUTER"] = "UNISWAP_V2_ROUTER";
|
|
41
41
|
AdapterType2["UNISWAP_V3_ROUTER"] = "UNISWAP_V3_ROUTER";
|
|
42
42
|
AdapterType2["UNISWAP_V4_GATEWAY"] = "UNISWAP_V4_GATEWAY";
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { marketCompressorAbi } from "../../abi/compressors/marketCompressor.js";
|
|
2
|
+
import { PoolPointsAPI } from "../../rewards/rewards/extra-apy.js";
|
|
3
|
+
import {
|
|
4
|
+
AddressMap,
|
|
5
|
+
AP_MARKET_COMPRESSOR,
|
|
6
|
+
BasePlugin,
|
|
7
|
+
BLOCKS_PER_WEEK_BY_NETWORK,
|
|
8
|
+
PERCENTAGE_DECIMALS,
|
|
9
|
+
VERSION_RANGE_310
|
|
10
|
+
} from "../../sdk/index.js";
|
|
11
|
+
import { rayToNumber } from "../../sdk/utils/formatter.js";
|
|
12
|
+
import { hexEq } from "../../sdk/utils/hex.js";
|
|
13
|
+
import { ApyOutputCache } from "./apy-cache.js";
|
|
14
|
+
import { parseGearStats, parseNetworkApy } from "./apy-parser.js";
|
|
15
|
+
import { APY_STATE_CACHE_URL, DEFAULT_APY_INTERVAL_MS } from "./constants.js";
|
|
16
|
+
import {
|
|
17
|
+
calculatePoolFullAPY,
|
|
18
|
+
calculatePoolFullAPY7DAgo,
|
|
19
|
+
calculatePoolPoints,
|
|
20
|
+
calculateSupplyApy7d,
|
|
21
|
+
getPoolExtraAPY
|
|
22
|
+
} from "./pool-apy-utils.js";
|
|
23
|
+
const MAP_LABEL = "pools7DAgo";
|
|
24
|
+
class ApyPlugin extends BasePlugin {
|
|
25
|
+
#apyUrl;
|
|
26
|
+
#cacheTtlMs;
|
|
27
|
+
#pools7DAgo;
|
|
28
|
+
#apySnapshot;
|
|
29
|
+
constructor(loadOnAttach = false, options) {
|
|
30
|
+
super(loadOnAttach);
|
|
31
|
+
this.#apyUrl = options?.apyUrl ?? APY_STATE_CACHE_URL;
|
|
32
|
+
this.#cacheTtlMs = options?.cacheTtlMs ?? DEFAULT_APY_INTERVAL_MS;
|
|
33
|
+
}
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
// Load — single entry point for all data (on-chain + state-cache)
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
async load(force, loadOptions) {
|
|
38
|
+
if (!force && this.loaded) {
|
|
39
|
+
return this.state;
|
|
40
|
+
}
|
|
41
|
+
const targetBlock = this.sdk.currentBlock - BLOCKS_PER_WEEK_BY_NETWORK[this.sdk.networkType];
|
|
42
|
+
const [marketCompressorAddress] = this.sdk.addressProvider.mustGetLatest(
|
|
43
|
+
AP_MARKET_COMPRESSOR,
|
|
44
|
+
VERSION_RANGE_310
|
|
45
|
+
);
|
|
46
|
+
this.#logger?.debug(
|
|
47
|
+
`loading pools 7d ago with market compressor ${marketCompressorAddress}`
|
|
48
|
+
);
|
|
49
|
+
const markets = this.sdk.marketRegister.markets;
|
|
50
|
+
const shouldLoadPools7DAgo = !this.#pools7DAgo || !!loadOptions?.loadPools7DAgo;
|
|
51
|
+
const [multicallResp, apySnapshot] = await Promise.all([
|
|
52
|
+
shouldLoadPools7DAgo ? this.client.multicall({
|
|
53
|
+
allowFailure: true,
|
|
54
|
+
contracts: markets.map(
|
|
55
|
+
(m) => ({
|
|
56
|
+
address: marketCompressorAddress,
|
|
57
|
+
abi: marketCompressorAbi,
|
|
58
|
+
functionName: "getPoolState",
|
|
59
|
+
args: [m.pool.pool.address]
|
|
60
|
+
})
|
|
61
|
+
),
|
|
62
|
+
blockNumber: targetBlock > 0n ? targetBlock : void 0,
|
|
63
|
+
batchSize: 0
|
|
64
|
+
}) : null,
|
|
65
|
+
this.#fetchApy()
|
|
66
|
+
]);
|
|
67
|
+
if (multicallResp !== null) {
|
|
68
|
+
this.#pools7DAgo = new AddressMap(void 0, MAP_LABEL);
|
|
69
|
+
multicallResp.forEach((r, index) => {
|
|
70
|
+
const m = markets[index];
|
|
71
|
+
const cfg = m.configurator.address;
|
|
72
|
+
const pool = m.pool.pool.address;
|
|
73
|
+
if (r.status === "success") {
|
|
74
|
+
this.#pools7DAgo?.upsert(m.pool.pool.address, {
|
|
75
|
+
dieselRate: r.result.dieselRate,
|
|
76
|
+
pool
|
|
77
|
+
});
|
|
78
|
+
} else {
|
|
79
|
+
this.#logger?.error(
|
|
80
|
+
`failed to load pools 7d ago for market configurator ${this.labelAddress(cfg)} and pool ${this.labelAddress(pool)}: ${r.error}`
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (apySnapshot) {
|
|
86
|
+
this.#apySnapshot = apySnapshot;
|
|
87
|
+
}
|
|
88
|
+
return this.state;
|
|
89
|
+
}
|
|
90
|
+
get loaded() {
|
|
91
|
+
return !!this.#pools7DAgo && !!this.#apySnapshot;
|
|
92
|
+
}
|
|
93
|
+
// ---------------------------------------------------------------------------
|
|
94
|
+
// Accessors
|
|
95
|
+
// ---------------------------------------------------------------------------
|
|
96
|
+
/**
|
|
97
|
+
* @throws if plugin is not loaded
|
|
98
|
+
*/
|
|
99
|
+
get pools7DAgo() {
|
|
100
|
+
if (!this.#pools7DAgo) {
|
|
101
|
+
throw new Error("apy plugin not loaded");
|
|
102
|
+
}
|
|
103
|
+
return this.#pools7DAgo;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* @throws if plugin is not loaded
|
|
107
|
+
*/
|
|
108
|
+
get apySnapshot() {
|
|
109
|
+
if (!this.#apySnapshot) {
|
|
110
|
+
throw new Error("apy plugin not loaded");
|
|
111
|
+
}
|
|
112
|
+
return this.#apySnapshot;
|
|
113
|
+
}
|
|
114
|
+
// ---------------------------------------------------------------------------
|
|
115
|
+
// Aggregated APY / points
|
|
116
|
+
// ---------------------------------------------------------------------------
|
|
117
|
+
/**
|
|
118
|
+
* Computes per-pool APY (current + 7d-ago) and points for all markets.
|
|
119
|
+
*
|
|
120
|
+
* @throws if plugin is not loaded
|
|
121
|
+
*/
|
|
122
|
+
getPoolsAPY() {
|
|
123
|
+
if (!this.loaded) {
|
|
124
|
+
throw new Error("apy plugin not loaded");
|
|
125
|
+
}
|
|
126
|
+
const markets = this.sdk.marketRegister.markets;
|
|
127
|
+
const { apy } = this.apySnapshot;
|
|
128
|
+
const totalTokenBalances = {};
|
|
129
|
+
const poolPointsBase = apy.poolRewardsList && Object.keys(apy.poolRewardsList).length > 0 ? PoolPointsAPI.getPointsByPool({
|
|
130
|
+
poolRewards: apy.poolRewardsList,
|
|
131
|
+
totalTokenBalances,
|
|
132
|
+
pools: markets,
|
|
133
|
+
tokensList: this.sdk.tokensMeta
|
|
134
|
+
}) : {};
|
|
135
|
+
const data = {};
|
|
136
|
+
const data7DAgo = {};
|
|
137
|
+
const points = {};
|
|
138
|
+
for (const market of markets) {
|
|
139
|
+
const pool = market.pool.pool;
|
|
140
|
+
const poolAddr = pool.address.toLowerCase();
|
|
141
|
+
const underlyingLc = pool.underlying.toLowerCase();
|
|
142
|
+
const depositAPY = rayToNumber(pool.supplyRate) * Number(PERCENTAGE_DECIMALS);
|
|
143
|
+
const underlyingAPY = apy.apyList?.[underlyingLc] ?? apy.apyList?.[pool.underlying] ?? 0;
|
|
144
|
+
const lookupAddresses = this.#getExtraAPYLookupAddresses(poolAddr);
|
|
145
|
+
const extraAPY = getPoolExtraAPY(lookupAddresses, apy.poolExtraAPYList);
|
|
146
|
+
const currentExternalList = apy.poolExternalAPYList?.[poolAddr];
|
|
147
|
+
const poolAPY = calculatePoolFullAPY({
|
|
148
|
+
depositAPY,
|
|
149
|
+
underlyingAPY,
|
|
150
|
+
extraAPY,
|
|
151
|
+
currentExternalList
|
|
152
|
+
});
|
|
153
|
+
data[poolAddr] = poolAPY;
|
|
154
|
+
const pool7DAgo = this.#pools7DAgo?.get(poolAddr);
|
|
155
|
+
const supplyAPY7DAgo = pool7DAgo ? calculateSupplyApy7d(
|
|
156
|
+
pool.dieselRate,
|
|
157
|
+
pool.supplyRate,
|
|
158
|
+
pool7DAgo.dieselRate
|
|
159
|
+
) : void 0;
|
|
160
|
+
data7DAgo[poolAddr] = calculatePoolFullAPY7DAgo({
|
|
161
|
+
supplyAPY7DAgo,
|
|
162
|
+
depositAPY,
|
|
163
|
+
poolAPY
|
|
164
|
+
});
|
|
165
|
+
const poolTokenMeta = this.sdk.tokensMeta.get(pool.underlying);
|
|
166
|
+
points[poolAddr] = calculatePoolPoints({
|
|
167
|
+
poolTokenSymbol: poolTokenMeta?.symbol,
|
|
168
|
+
points: poolPointsBase[poolAddr],
|
|
169
|
+
tokensList: this.sdk.tokensMeta
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
return { data, data7DAgo, pointsBase: poolPointsBase, points };
|
|
173
|
+
}
|
|
174
|
+
// ---------------------------------------------------------------------------
|
|
175
|
+
// Plugin lifecycle
|
|
176
|
+
// ---------------------------------------------------------------------------
|
|
177
|
+
async syncState() {
|
|
178
|
+
await this.load();
|
|
179
|
+
}
|
|
180
|
+
stateHuman(_) {
|
|
181
|
+
return this.pools7DAgo.values().flatMap((p) => ({
|
|
182
|
+
address: p.pool,
|
|
183
|
+
version: this.version,
|
|
184
|
+
dieselRate: p.dieselRate
|
|
185
|
+
}));
|
|
186
|
+
}
|
|
187
|
+
get state() {
|
|
188
|
+
return {
|
|
189
|
+
pools7DAgo: this.pools7DAgo.asRecord(),
|
|
190
|
+
apySnapshot: this.apySnapshot
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
hydrate(state) {
|
|
194
|
+
this.#pools7DAgo = new AddressMap(
|
|
195
|
+
Object.entries(state.pools7DAgo),
|
|
196
|
+
MAP_LABEL
|
|
197
|
+
);
|
|
198
|
+
this.#apySnapshot = state.apySnapshot;
|
|
199
|
+
}
|
|
200
|
+
// ---------------------------------------------------------------------------
|
|
201
|
+
// Internal
|
|
202
|
+
// ---------------------------------------------------------------------------
|
|
203
|
+
async #fetchApy() {
|
|
204
|
+
try {
|
|
205
|
+
const cache = ApyOutputCache.get(
|
|
206
|
+
this.#apyUrl,
|
|
207
|
+
this.#cacheTtlMs,
|
|
208
|
+
this.#logger
|
|
209
|
+
);
|
|
210
|
+
const output = await cache.fetch();
|
|
211
|
+
if (!output) return void 0;
|
|
212
|
+
const chainData = output.chains[this.sdk.chainId];
|
|
213
|
+
if (!chainData) {
|
|
214
|
+
this.#logger?.debug(
|
|
215
|
+
`apy state-cache: no data for chainId ${this.sdk.chainId}`
|
|
216
|
+
);
|
|
217
|
+
return void 0;
|
|
218
|
+
}
|
|
219
|
+
const apy = parseNetworkApy(chainData.tokens, chainData.pools);
|
|
220
|
+
if (!apy) return void 0;
|
|
221
|
+
return {
|
|
222
|
+
apy,
|
|
223
|
+
gearStats: parseGearStats(output),
|
|
224
|
+
timestamp: output.timestamp
|
|
225
|
+
};
|
|
226
|
+
} catch (e) {
|
|
227
|
+
this.#logger?.error(e, "failed to fetch apy state-cache");
|
|
228
|
+
return void 0;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Collects addresses to look up in poolExtraAPYList for a given pool.
|
|
233
|
+
* Includes pool address (= diesel token) + any staked diesel token
|
|
234
|
+
* outputs discovered from zappers.
|
|
235
|
+
*/
|
|
236
|
+
#getExtraAPYLookupAddresses(poolAddr) {
|
|
237
|
+
const addresses = [poolAddr];
|
|
238
|
+
try {
|
|
239
|
+
const zappers = this.sdk.marketRegister.poolZappers(poolAddr);
|
|
240
|
+
for (const z of zappers) {
|
|
241
|
+
if (!hexEq(z.tokenOut.addr, poolAddr)) {
|
|
242
|
+
addresses.push(z.tokenOut.addr);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
} catch {
|
|
246
|
+
}
|
|
247
|
+
return addresses;
|
|
248
|
+
}
|
|
249
|
+
get #logger() {
|
|
250
|
+
return this.logger;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
export {
|
|
254
|
+
ApyPlugin
|
|
255
|
+
};
|