@gearbox-protocol/sdk 3.1.2 → 3.1.3-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/abi/compressors.js +1124 -518
- package/dist/cjs/adapters/abi/adapters.js +123 -0
- package/dist/cjs/adapters/abi/index.js +1 -3
- package/dist/cjs/dev/setLTZero.js +7 -0
- package/dist/cjs/sdk/GearboxSDK.js +1 -6
- package/dist/cjs/sdk/accounts/CreditAccountsService.js +45 -30
- package/dist/cjs/sdk/accounts/utils.js +38 -0
- package/dist/cjs/sdk/constants/address-provider.js +11 -17
- package/dist/cjs/sdk/market/MarketSuite.js +1 -1
- package/dist/cjs/sdk/market/credit/CreditFacadeV300Contract.js +1 -5
- package/dist/cjs/sdk/market/credit/CreditFacadeV310Contract.js +1 -5
- package/dist/cjs/sdk/market/oracle/PriceOracleBaseContract.js +6 -5
- package/dist/cjs/sdk/market/pool/PoolSuite.js +1 -1
- package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +4 -4
- package/dist/cjs/sdk/sdk-legacy/core/creditAccount.js +3 -1
- package/dist/esm/abi/compressors.js +1124 -513
- package/dist/esm/adapters/abi/adapters.js +120 -0
- package/dist/esm/adapters/abi/index.js +0 -1
- package/dist/esm/dev/setLTZero.js +7 -0
- package/dist/esm/sdk/GearboxSDK.js +1 -6
- package/dist/esm/sdk/accounts/CreditAccountsService.js +45 -30
- package/dist/esm/sdk/accounts/utils.js +14 -0
- package/dist/esm/sdk/constants/address-provider.js +11 -15
- package/dist/esm/sdk/market/MarketSuite.js +1 -1
- package/dist/esm/sdk/market/credit/CreditFacadeV300Contract.js +1 -5
- package/dist/esm/sdk/market/credit/CreditFacadeV310Contract.js +1 -5
- package/dist/esm/sdk/market/oracle/PriceOracleBaseContract.js +6 -5
- package/dist/esm/sdk/market/pool/PoolSuite.js +1 -1
- package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +9 -6
- package/dist/esm/sdk/sdk-legacy/core/creditAccount.js +3 -1
- package/dist/types/abi/compressors.d.ts +1403 -775
- package/dist/types/adapters/BalancerV3RouterAdapterContract.d.ts +62 -104
- package/dist/types/adapters/abi/adapters.d.ts +213 -0
- package/dist/types/adapters/abi/index.d.ts +0 -1
- package/dist/types/sdk/accounts/CreditAccountsService.d.ts +3 -3
- package/dist/types/sdk/accounts/types.d.ts +15 -2
- package/dist/types/sdk/accounts/utils.d.ts +2 -0
- package/dist/types/sdk/base/types.d.ts +6 -6
- package/dist/types/sdk/constants/address-provider.d.ts +11 -13
- package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +425 -85
- package/dist/types/sdk/market/pool/PoolQuotaKeeperV300Contract.d.ts +2 -2
- package/dist/types/sdk/market/pool/PoolQuotaKeeperV310Contract.d.ts +2 -2
- package/dist/types/sdk/market/pool/createPoolQuotaKeeper.d.ts +2 -2
- package/dist/types/sdk/types/state-human.d.ts +1 -3
- package/package.json +1 -1
- package/dist/cjs/adapters/abi/iBalancerV3RouterAdapter.js +0 -153
- package/dist/esm/adapters/abi/iBalancerV3RouterAdapter.js +0 -129
- package/dist/types/adapters/abi/iBalancerV3RouterAdapter.d.ts +0 -230
|
@@ -19,6 +19,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var adapters_exports = {};
|
|
20
20
|
__export(adapters_exports, {
|
|
21
21
|
iBalancerV2VaultAdapterAbi: () => iBalancerV2VaultAdapterAbi,
|
|
22
|
+
iBalancerV3RouterAdapterAbi: () => iBalancerV3RouterAdapterAbi,
|
|
23
|
+
iBalancerV3RouterAdapterEventsAbi: () => iBalancerV3RouterAdapterEventsAbi,
|
|
24
|
+
iBalancerV3RouterAdapterExceptionsAbi: () => iBalancerV3RouterAdapterExceptionsAbi,
|
|
22
25
|
iCamelotV3AdapterAbi: () => iCamelotV3AdapterAbi,
|
|
23
26
|
iConvexV1BaseRewardPoolAdapterAbi: () => iConvexV1BaseRewardPoolAdapterAbi,
|
|
24
27
|
iConvexV1BoosterAdapterAbi: () => iConvexV1BoosterAdapterAbi,
|
|
@@ -334,6 +337,123 @@ const iBalancerV2VaultAdapterAbi = [
|
|
|
334
337
|
},
|
|
335
338
|
{ type: "error", inputs: [], name: "PoolNotSupportedException" }
|
|
336
339
|
];
|
|
340
|
+
const iBalancerV3RouterAdapterAbi = [
|
|
341
|
+
{
|
|
342
|
+
type: "function",
|
|
343
|
+
inputs: [],
|
|
344
|
+
name: "contractType",
|
|
345
|
+
outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }],
|
|
346
|
+
stateMutability: "view"
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
type: "function",
|
|
350
|
+
inputs: [],
|
|
351
|
+
name: "creditManager",
|
|
352
|
+
outputs: [{ name: "", internalType: "address", type: "address" }],
|
|
353
|
+
stateMutability: "view"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
type: "function",
|
|
357
|
+
inputs: [],
|
|
358
|
+
name: "getAllowedPools",
|
|
359
|
+
outputs: [{ name: "pools", internalType: "address[]", type: "address[]" }],
|
|
360
|
+
stateMutability: "view"
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
type: "function",
|
|
364
|
+
inputs: [{ name: "pool", internalType: "address", type: "address" }],
|
|
365
|
+
name: "isPoolAllowed",
|
|
366
|
+
outputs: [{ name: "", internalType: "bool", type: "bool" }],
|
|
367
|
+
stateMutability: "view"
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
type: "function",
|
|
371
|
+
inputs: [],
|
|
372
|
+
name: "serialize",
|
|
373
|
+
outputs: [{ name: "serializedData", internalType: "bytes", type: "bytes" }],
|
|
374
|
+
stateMutability: "view"
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
type: "function",
|
|
378
|
+
inputs: [
|
|
379
|
+
{ name: "pools", internalType: "address[]", type: "address[]" },
|
|
380
|
+
{ name: "statuses", internalType: "bool[]", type: "bool[]" }
|
|
381
|
+
],
|
|
382
|
+
name: "setPoolStatusBatch",
|
|
383
|
+
outputs: [],
|
|
384
|
+
stateMutability: "nonpayable"
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
type: "function",
|
|
388
|
+
inputs: [
|
|
389
|
+
{ name: "pool", internalType: "address", type: "address" },
|
|
390
|
+
{ name: "tokenIn", internalType: "contract IERC20", type: "address" },
|
|
391
|
+
{ name: "tokenOut", internalType: "contract IERC20", type: "address" },
|
|
392
|
+
{ name: "leftoverAmount", internalType: "uint256", type: "uint256" },
|
|
393
|
+
{ name: "rateMinRAY", internalType: "uint256", type: "uint256" },
|
|
394
|
+
{ name: "deadline", internalType: "uint256", type: "uint256" }
|
|
395
|
+
],
|
|
396
|
+
name: "swapSingleTokenDiffIn",
|
|
397
|
+
outputs: [{ name: "", internalType: "bool", type: "bool" }],
|
|
398
|
+
stateMutability: "nonpayable"
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
type: "function",
|
|
402
|
+
inputs: [
|
|
403
|
+
{ name: "pool", internalType: "address", type: "address" },
|
|
404
|
+
{ name: "tokenIn", internalType: "contract IERC20", type: "address" },
|
|
405
|
+
{ name: "tokenOut", internalType: "contract IERC20", type: "address" },
|
|
406
|
+
{ name: "exactAmountIn", internalType: "uint256", type: "uint256" },
|
|
407
|
+
{ name: "minAmountOut", internalType: "uint256", type: "uint256" },
|
|
408
|
+
{ name: "deadline", internalType: "uint256", type: "uint256" },
|
|
409
|
+
{ name: "wethIsEth", internalType: "bool", type: "bool" },
|
|
410
|
+
{ name: "userData", internalType: "bytes", type: "bytes" }
|
|
411
|
+
],
|
|
412
|
+
name: "swapSingleTokenExactIn",
|
|
413
|
+
outputs: [{ name: "", internalType: "bool", type: "bool" }],
|
|
414
|
+
stateMutability: "nonpayable"
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
type: "function",
|
|
418
|
+
inputs: [],
|
|
419
|
+
name: "targetContract",
|
|
420
|
+
outputs: [{ name: "", internalType: "address", type: "address" }],
|
|
421
|
+
stateMutability: "view"
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
type: "function",
|
|
425
|
+
inputs: [],
|
|
426
|
+
name: "version",
|
|
427
|
+
outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
|
|
428
|
+
stateMutability: "view"
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
type: "event",
|
|
432
|
+
anonymous: false,
|
|
433
|
+
inputs: [
|
|
434
|
+
{ name: "pool", internalType: "address", type: "address", indexed: true },
|
|
435
|
+
{ name: "allowed", internalType: "bool", type: "bool", indexed: false }
|
|
436
|
+
],
|
|
437
|
+
name: "SetPoolStatus"
|
|
438
|
+
},
|
|
439
|
+
{ type: "error", inputs: [], name: "InvalidLengthException" },
|
|
440
|
+
{ type: "error", inputs: [], name: "InvalidPoolException" }
|
|
441
|
+
];
|
|
442
|
+
const iBalancerV3RouterAdapterEventsAbi = [
|
|
443
|
+
{
|
|
444
|
+
type: "event",
|
|
445
|
+
anonymous: false,
|
|
446
|
+
inputs: [
|
|
447
|
+
{ name: "pool", internalType: "address", type: "address", indexed: true },
|
|
448
|
+
{ name: "allowed", internalType: "bool", type: "bool", indexed: false }
|
|
449
|
+
],
|
|
450
|
+
name: "SetPoolStatus"
|
|
451
|
+
}
|
|
452
|
+
];
|
|
453
|
+
const iBalancerV3RouterAdapterExceptionsAbi = [
|
|
454
|
+
{ type: "error", inputs: [], name: "InvalidLengthException" },
|
|
455
|
+
{ type: "error", inputs: [], name: "InvalidPoolException" }
|
|
456
|
+
];
|
|
337
457
|
const iCamelotV3AdapterAbi = [
|
|
338
458
|
{
|
|
339
459
|
type: "function",
|
|
@@ -4246,6 +4366,9 @@ const iwstEthv1AdapterAbi = [
|
|
|
4246
4366
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4247
4367
|
0 && (module.exports = {
|
|
4248
4368
|
iBalancerV2VaultAdapterAbi,
|
|
4369
|
+
iBalancerV3RouterAdapterAbi,
|
|
4370
|
+
iBalancerV3RouterAdapterEventsAbi,
|
|
4371
|
+
iBalancerV3RouterAdapterExceptionsAbi,
|
|
4249
4372
|
iCamelotV3AdapterAbi,
|
|
4250
4373
|
iConvexV1BaseRewardPoolAdapterAbi,
|
|
4251
4374
|
iConvexV1BoosterAdapterAbi,
|
|
@@ -16,9 +16,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
16
16
|
var abi_exports = {};
|
|
17
17
|
module.exports = __toCommonJS(abi_exports);
|
|
18
18
|
__reExport(abi_exports, require("./adapters.js"), module.exports);
|
|
19
|
-
__reExport(abi_exports, require("./iBalancerV3RouterAdapter.js"), module.exports);
|
|
20
19
|
// Annotate the CommonJS export names for ESM import in node:
|
|
21
20
|
0 && (module.exports = {
|
|
22
|
-
...require("./adapters.js")
|
|
23
|
-
...require("./iBalancerV3RouterAdapter.js")
|
|
21
|
+
...require("./adapters.js")
|
|
24
22
|
});
|
|
@@ -110,6 +110,13 @@ async function setLTZero(anvil, cm, logger) {
|
|
|
110
110
|
address: cm.creditConfigurator
|
|
111
111
|
});
|
|
112
112
|
await anvil.stopImpersonatingAccount({ address: configuratorAddr });
|
|
113
|
+
const lt = await anvil.readContract({
|
|
114
|
+
address: cm.baseParams.addr,
|
|
115
|
+
abi: import_v300.iCreditManagerV300Abi,
|
|
116
|
+
functionName: "liquidationThresholds",
|
|
117
|
+
args: [cm.underlying]
|
|
118
|
+
});
|
|
119
|
+
logger?.debug(`[${cm.name}] underlying lt: ${lt}`);
|
|
113
120
|
}
|
|
114
121
|
// Annotate the CommonJS export names for ESM import in node:
|
|
115
122
|
0 && (module.exports = {
|
|
@@ -43,7 +43,6 @@ class GearboxSDK {
|
|
|
43
43
|
#currentBlock;
|
|
44
44
|
#timestamp;
|
|
45
45
|
#syncing = false;
|
|
46
|
-
#gear;
|
|
47
46
|
// Collection of core singleton contracts
|
|
48
47
|
#addressProvider;
|
|
49
48
|
#botListContract;
|
|
@@ -191,7 +190,6 @@ class GearboxSDK {
|
|
|
191
190
|
} catch (e) {
|
|
192
191
|
this.logger?.error(e);
|
|
193
192
|
}
|
|
194
|
-
this.#gear = this.#addressProvider.getAddress(import_constants.AP_GEAR_TOKEN, import_constants.NO_VERSION);
|
|
195
193
|
const gearStakingAddress = this.#addressProvider.getAddress(
|
|
196
194
|
import_constants.AP_GEAR_STAKING,
|
|
197
195
|
import_constants.NO_VERSION
|
|
@@ -411,10 +409,7 @@ class GearboxSDK {
|
|
|
411
409
|
return this.#timestamp;
|
|
412
410
|
}
|
|
413
411
|
get gear() {
|
|
414
|
-
|
|
415
|
-
throw ERR_NOT_ATTACHED;
|
|
416
|
-
}
|
|
417
|
-
return this.#gear;
|
|
412
|
+
return this.addressProvider.getAddress(import_constants.AP_GEAR_TOKEN, import_constants.NO_VERSION);
|
|
418
413
|
}
|
|
419
414
|
get addressProvider() {
|
|
420
415
|
if (this.#addressProvider === void 0) {
|
|
@@ -32,6 +32,7 @@ var import_router = require("../router/index.js");
|
|
|
32
32
|
var import_sdk_gov_legacy = require("../sdk-gov-legacy/index.js");
|
|
33
33
|
var import_utils = require("../utils/index.js");
|
|
34
34
|
var import_viem2 = require("../utils/viem/index.js");
|
|
35
|
+
var import_utils2 = require("./utils.js");
|
|
35
36
|
class CreditAccountsService extends import_base.SDKConstruct {
|
|
36
37
|
#compressor;
|
|
37
38
|
#batchSize;
|
|
@@ -43,6 +44,9 @@ class CreditAccountsService extends import_base.SDKConstruct {
|
|
|
43
44
|
);
|
|
44
45
|
this.#batchSize = options?.batchSize;
|
|
45
46
|
this.#logger = (0, import_utils.childLogger)("CreditAccountsService", sdk.logger);
|
|
47
|
+
this.#logger?.debug(
|
|
48
|
+
`credit account compressor address: ${this.#compressor}`
|
|
49
|
+
);
|
|
46
50
|
}
|
|
47
51
|
/**
|
|
48
52
|
* Returns single credit account data, or undefined if it's not found
|
|
@@ -91,21 +95,21 @@ class CreditAccountsService extends import_base.SDKConstruct {
|
|
|
91
95
|
* TODO: do we want to expose pagination?
|
|
92
96
|
* TODO: do we want to expose "reverting"?
|
|
93
97
|
* TODO: do we want to expose MarketFilter in any way? If so, we need to check that the MarketFilter is compatibled with attached markets?
|
|
94
|
-
* @param
|
|
98
|
+
* @param options
|
|
95
99
|
* @param blockNumber
|
|
96
100
|
* @returns returned credit accounts are sorted by health factor in ascending order
|
|
97
101
|
*/
|
|
98
|
-
async getCreditAccounts(
|
|
102
|
+
async getCreditAccounts(options, blockNumber) {
|
|
99
103
|
const {
|
|
100
104
|
creditManager,
|
|
101
105
|
includeZeroDebt = false,
|
|
102
|
-
maxHealthFactor =
|
|
103
|
-
|
|
104
|
-
minHealthFactor = 0,
|
|
106
|
+
maxHealthFactor = import_constants.MAX_UINT256,
|
|
107
|
+
minHealthFactor = 0n,
|
|
105
108
|
owner = import_constants.ADDRESS_0X0
|
|
106
|
-
} =
|
|
109
|
+
} = options ?? {};
|
|
107
110
|
const arg0 = creditManager ?? {
|
|
108
111
|
configurators: this.marketConfigurators,
|
|
112
|
+
creditManagers: [],
|
|
109
113
|
pools: [],
|
|
110
114
|
underlying: import_constants.ADDRESS_0X0
|
|
111
115
|
};
|
|
@@ -113,7 +117,8 @@ class CreditAccountsService extends import_base.SDKConstruct {
|
|
|
113
117
|
owner,
|
|
114
118
|
includeZeroDebt,
|
|
115
119
|
minHealthFactor,
|
|
116
|
-
maxHealthFactor
|
|
120
|
+
maxHealthFactor,
|
|
121
|
+
reverting: false
|
|
117
122
|
};
|
|
118
123
|
const { txs: priceUpdateTxs } = await this.sdk.priceFeeds.generatePriceFeedsUpdateTxs();
|
|
119
124
|
const allCAs = [];
|
|
@@ -718,31 +723,41 @@ class CreditAccountsService extends import_base.SDKConstruct {
|
|
|
718
723
|
* @returns
|
|
719
724
|
*/
|
|
720
725
|
async #getCreditAccounts(args, priceUpdateTxs, blockNumber) {
|
|
726
|
+
this.#logger?.debug(
|
|
727
|
+
{ args: (0, import_utils2.stringifyGetCreditAccountsArgs)(args) },
|
|
728
|
+
"getting credit accounts"
|
|
729
|
+
);
|
|
730
|
+
let resp;
|
|
721
731
|
if (priceUpdateTxs?.length) {
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
732
|
+
[resp] = await (0, import_viem2.simulateWithPriceUpdates)(this.provider.publicClient, {
|
|
733
|
+
priceUpdates: priceUpdateTxs,
|
|
734
|
+
contracts: [
|
|
735
|
+
{
|
|
736
|
+
abi: import_compressors.iCreditAccountCompressorAbi,
|
|
737
|
+
address: this.#compressor,
|
|
738
|
+
functionName: "getCreditAccounts",
|
|
739
|
+
args
|
|
740
|
+
}
|
|
741
|
+
],
|
|
742
|
+
blockNumber
|
|
743
|
+
});
|
|
744
|
+
} else {
|
|
745
|
+
resp = await this.provider.publicClient.readContract({
|
|
746
|
+
abi: import_compressors.iCreditAccountCompressorAbi,
|
|
747
|
+
address: this.#compressor,
|
|
748
|
+
functionName: "getCreditAccounts",
|
|
749
|
+
args,
|
|
750
|
+
blockNumber
|
|
751
|
+
});
|
|
738
752
|
}
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
753
|
+
this.#logger?.debug(
|
|
754
|
+
{
|
|
755
|
+
accounts: resp[0]?.length ?? 0,
|
|
756
|
+
nextOffset: Number(resp[1])
|
|
757
|
+
},
|
|
758
|
+
"got credit accounts"
|
|
759
|
+
);
|
|
760
|
+
return resp;
|
|
746
761
|
}
|
|
747
762
|
/**
|
|
748
763
|
* Returns raw txs that are needed to update all price feeds so that all credit accounts (possibly from different markets) compute
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var utils_exports = {};
|
|
20
|
+
__export(utils_exports, {
|
|
21
|
+
stringifyGetCreditAccountsArgs: () => stringifyGetCreditAccountsArgs
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(utils_exports);
|
|
24
|
+
function stringifyGetCreditAccountsArgs(args) {
|
|
25
|
+
const s = JSON.stringify(args, replacer);
|
|
26
|
+
return JSON.parse(s);
|
|
27
|
+
}
|
|
28
|
+
function replacer(_key, value) {
|
|
29
|
+
if (typeof value === "bigint") {
|
|
30
|
+
return value.toString();
|
|
31
|
+
} else {
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
stringifyGetCreditAccountsArgs
|
|
38
|
+
});
|
|
@@ -22,7 +22,6 @@ __export(address_provider_exports, {
|
|
|
22
22
|
ADDRESS_PROVIDER_V310: () => ADDRESS_PROVIDER_V310,
|
|
23
23
|
AP_ACCOUNT_FACTORY: () => AP_ACCOUNT_FACTORY,
|
|
24
24
|
AP_ACL: () => AP_ACL,
|
|
25
|
-
AP_ADAPTER_COMPRESSOR: () => AP_ADAPTER_COMPRESSOR,
|
|
26
25
|
AP_BOT_LIST: () => AP_BOT_LIST,
|
|
27
26
|
AP_BYTECODE_REPOSITORY: () => AP_BYTECODE_REPOSITORY,
|
|
28
27
|
AP_CONTRACTS_REGISTER: () => AP_CONTRACTS_REGISTER,
|
|
@@ -42,7 +41,6 @@ __export(address_provider_exports, {
|
|
|
42
41
|
AP_MARKET_CONFIGURATOR: () => AP_MARKET_CONFIGURATOR,
|
|
43
42
|
AP_PARTIAL_LIQUIDATION_BOT: () => AP_PARTIAL_LIQUIDATION_BOT,
|
|
44
43
|
AP_PERIPHERY_COMPRESSOR: () => AP_PERIPHERY_COMPRESSOR,
|
|
45
|
-
AP_POOL_COMPRESSOR: () => AP_POOL_COMPRESSOR,
|
|
46
44
|
AP_PRICE_FEED_COMPRESSOR: () => AP_PRICE_FEED_COMPRESSOR,
|
|
47
45
|
AP_PRICE_ORACLE: () => AP_PRICE_ORACLE,
|
|
48
46
|
AP_REWARDS_COMPRESSOR: () => AP_REWARDS_COMPRESSOR,
|
|
@@ -60,32 +58,30 @@ var import_addresses = require("./addresses.js");
|
|
|
60
58
|
const NO_VERSION = 0;
|
|
61
59
|
const AP_ACCOUNT_FACTORY = "ACCOUNT_FACTORY";
|
|
62
60
|
const AP_ACL = "ACL";
|
|
63
|
-
const AP_ADAPTER_COMPRESSOR = "ADAPTER_COMPRESSOR";
|
|
64
61
|
const AP_BOT_LIST = "BOT_LIST";
|
|
65
62
|
const AP_BYTECODE_REPOSITORY = "BYTECODE_REPOSITORY";
|
|
66
63
|
const AP_CONTRACTS_REGISTER = "CONTRACTS_REGISTER";
|
|
67
64
|
const AP_CONTROLLER_TIMELOCK = "CONTROLLER_TIMELOCK";
|
|
68
|
-
const AP_CREDIT_ACCOUNT_COMPRESSOR = "
|
|
69
|
-
const AP_CREDIT_SUITE_COMPRESSOR = "CREDIT_SUITE_COMPRESSOR";
|
|
65
|
+
const AP_CREDIT_ACCOUNT_COMPRESSOR = "GLOBAL::ACCOUNT_COMPRESSOR";
|
|
66
|
+
const AP_CREDIT_SUITE_COMPRESSOR = "GLOBAL::CREDIT_SUITE_COMPRESSOR";
|
|
70
67
|
const AP_DATA_COMPRESSOR = "DATA_COMPRESSOR";
|
|
71
68
|
const AP_DELEVERAGE_BOT_HV = "DELEVERAGE_BOT_HV";
|
|
72
69
|
const AP_DELEVERAGE_BOT_LV = "DELEVERAGE_BOT_LV";
|
|
73
70
|
const AP_DELEVERAGE_BOT_PEGGED = "DELEVERAGE_BOT_PEGGED";
|
|
74
|
-
const AP_GAUGE_COMPRESSOR = "GAUGE_COMPRESSOR";
|
|
71
|
+
const AP_GAUGE_COMPRESSOR = "GLOBAL::GAUGE_COMPRESSOR";
|
|
75
72
|
const AP_GEAR_STAKING = "GEAR_STAKING";
|
|
76
|
-
const AP_GEAR_TOKEN = "GEAR_TOKEN";
|
|
73
|
+
const AP_GEAR_TOKEN = "GLOBAL::GEAR_TOKEN";
|
|
77
74
|
const AP_INFLATION_ATTACK_BLOCKER = "INFLATION_ATTACK_BLOCKER";
|
|
78
75
|
const AP_INSOLVENCY_CHECKER = "INSOLVENCY_CHECKER";
|
|
79
|
-
const AP_MARKET_COMPRESSOR = "MARKET_COMPRESSOR";
|
|
76
|
+
const AP_MARKET_COMPRESSOR = "GLOBAL::MARKET_COMPRESSOR";
|
|
80
77
|
const AP_MARKET_CONFIGURATOR = "MARKET_CONFIGURATOR";
|
|
81
78
|
const AP_PARTIAL_LIQUIDATION_BOT = "PARTIAL_LIQUIDATION_BOT";
|
|
82
|
-
const AP_PERIPHERY_COMPRESSOR = "PERIPHERY_COMPRESSOR";
|
|
83
|
-
const
|
|
84
|
-
const AP_PRICE_FEED_COMPRESSOR = "PRICE_FEED_COMPRESSOR";
|
|
79
|
+
const AP_PERIPHERY_COMPRESSOR = "GLOBAL::PERIPHERY_COMPRESSOR";
|
|
80
|
+
const AP_PRICE_FEED_COMPRESSOR = "GLOBAL::PRICE_FEED_COMPRESSOR";
|
|
85
81
|
const AP_PRICE_ORACLE = "PRICE_ORACLE";
|
|
86
|
-
const AP_REWARDS_COMPRESSOR = "REWARDS_COMPRESSOR";
|
|
87
|
-
const AP_ROUTER = "
|
|
88
|
-
const AP_TOKEN_COMPRESSOR = "TOKEN_COMPRESSOR";
|
|
82
|
+
const AP_REWARDS_COMPRESSOR = "GLOBAL::REWARDS_COMPRESSOR";
|
|
83
|
+
const AP_ROUTER = "GLOBAL::ROUTER";
|
|
84
|
+
const AP_TOKEN_COMPRESSOR = "GLOBAL::TOKEN_COMPRESSOR";
|
|
89
85
|
const AP_TREASURY = "TREASURY";
|
|
90
86
|
const AP_WETH_GATEWAY = "WETH_GATEWAY";
|
|
91
87
|
const AP_WETH_TOKEN = "WETH_TOKEN";
|
|
@@ -104,14 +100,13 @@ const ADDRESS_PROVIDER = {
|
|
|
104
100
|
Avalanche: import_addresses.NOT_DEPLOYED,
|
|
105
101
|
BNB: import_addresses.NOT_DEPLOYED
|
|
106
102
|
};
|
|
107
|
-
const ADDRESS_PROVIDER_V310 = "
|
|
103
|
+
const ADDRESS_PROVIDER_V310 = "0xF7f0a609BfAb9a0A98786951ef10e5FE26cC1E38";
|
|
108
104
|
// Annotate the CommonJS export names for ESM import in node:
|
|
109
105
|
0 && (module.exports = {
|
|
110
106
|
ADDRESS_PROVIDER,
|
|
111
107
|
ADDRESS_PROVIDER_V310,
|
|
112
108
|
AP_ACCOUNT_FACTORY,
|
|
113
109
|
AP_ACL,
|
|
114
|
-
AP_ADAPTER_COMPRESSOR,
|
|
115
110
|
AP_BOT_LIST,
|
|
116
111
|
AP_BYTECODE_REPOSITORY,
|
|
117
112
|
AP_CONTRACTS_REGISTER,
|
|
@@ -131,7 +126,6 @@ const ADDRESS_PROVIDER_V310 = "0xBaB2014Dd88223E168bA06911c06df638311a097";
|
|
|
131
126
|
AP_MARKET_CONFIGURATOR,
|
|
132
127
|
AP_PARTIAL_LIQUIDATION_BOT,
|
|
133
128
|
AP_PERIPHERY_COMPRESSOR,
|
|
134
|
-
AP_POOL_COMPRESSOR,
|
|
135
129
|
AP_PRICE_FEED_COMPRESSOR,
|
|
136
130
|
AP_PRICE_ORACLE,
|
|
137
131
|
AP_REWARDS_COMPRESSOR,
|
|
@@ -56,11 +56,7 @@ class CreditFacadeV300Contract extends import_base.BaseContract {
|
|
|
56
56
|
botList: this.labelAddress(this.botList),
|
|
57
57
|
minDebt: (0, import_utils.formatBNvalue)(this.minDebt, decimals),
|
|
58
58
|
maxDebt: (0, import_utils.formatBNvalue)(this.maxDebt, decimals),
|
|
59
|
-
|
|
60
|
-
// TODO
|
|
61
|
-
maxCumulativeLoss: "0",
|
|
62
|
-
// TODO
|
|
63
|
-
forbiddenTokenMask: (0, import_utils.fmtBinaryMask)(this.forbiddenTokenMask),
|
|
59
|
+
forbiddenTokensMask: (0, import_utils.fmtBinaryMask)(this.forbiddenTokensMask),
|
|
64
60
|
isPaused: this.isPaused
|
|
65
61
|
};
|
|
66
62
|
}
|
|
@@ -56,11 +56,7 @@ class CreditFacadeV310Contract extends import_base.BaseContract {
|
|
|
56
56
|
botList: this.labelAddress(this.botList),
|
|
57
57
|
minDebt: (0, import_utils.formatBNvalue)(this.minDebt, decimals),
|
|
58
58
|
maxDebt: (0, import_utils.formatBNvalue)(this.maxDebt, decimals),
|
|
59
|
-
|
|
60
|
-
// TODO
|
|
61
|
-
maxCumulativeLoss: "0",
|
|
62
|
-
// TODO
|
|
63
|
-
forbiddenTokenMask: (0, import_utils.fmtBinaryMask)(this.forbiddenTokenMask),
|
|
59
|
+
forbiddenTokensMask: (0, import_utils.fmtBinaryMask)(this.forbiddenTokensMask),
|
|
64
60
|
isPaused: this.isPaused
|
|
65
61
|
};
|
|
66
62
|
}
|
|
@@ -75,8 +75,8 @@ class PriceOracleBaseContract extends import_base.BaseContract {
|
|
|
75
75
|
constructor(sdk, args, data, underlying) {
|
|
76
76
|
super(sdk, args);
|
|
77
77
|
this.underlying = underlying;
|
|
78
|
-
const {
|
|
79
|
-
this.#loadState(
|
|
78
|
+
const { priceFeedMap, priceFeedTree } = data;
|
|
79
|
+
this.#loadState(priceFeedMap, priceFeedTree);
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
82
|
* Returns main and reserve price feeds for given tokens
|
|
@@ -249,11 +249,12 @@ class PriceOracleBaseContract extends import_base.BaseContract {
|
|
|
249
249
|
call: {
|
|
250
250
|
abi: import_compressors.iPriceFeedCompressorAbi,
|
|
251
251
|
address,
|
|
252
|
-
functionName: "
|
|
252
|
+
functionName: "getPriceOracleState",
|
|
253
253
|
args
|
|
254
254
|
},
|
|
255
|
-
onResult: (
|
|
256
|
-
|
|
255
|
+
onResult: (resp) => {
|
|
256
|
+
const { priceFeedMap, priceFeedTree } = resp;
|
|
257
|
+
this.#loadState(priceFeedMap, priceFeedTree);
|
|
257
258
|
}
|
|
258
259
|
};
|
|
259
260
|
}
|
|
@@ -47,7 +47,7 @@ class PoolSuite extends import_base.SDKConstruct {
|
|
|
47
47
|
constructor(sdk, data) {
|
|
48
48
|
super(sdk);
|
|
49
49
|
this.pool = (0, import_createPool.default)(sdk, data.pool);
|
|
50
|
-
this.pqk = (0, import_createPoolQuotaKeeper.default)(sdk, data.pool, data.
|
|
50
|
+
this.pqk = (0, import_createPoolQuotaKeeper.default)(sdk, data.pool, data.quotaKeeper);
|
|
51
51
|
this.rateKeeper = (0, import_createRateKeeper.default)(sdk, data.pool, data.rateKeeper);
|
|
52
52
|
this.interestRateModel = (0, import_createInterestRateModel.default)(
|
|
53
53
|
sdk,
|
|
@@ -127,8 +127,8 @@ class PriceFeedRegister extends import_base.SDKConstruct {
|
|
|
127
127
|
* This is not saved anywhere in PriceFeedRegister, and can later be used to load price feed updates
|
|
128
128
|
*/
|
|
129
129
|
async getPartialUpdatablePriceFeeds(marketConfigurators, pools) {
|
|
130
|
-
const
|
|
131
|
-
import_constants.
|
|
130
|
+
const priceFeedCompressorAddress = this.sdk.addressProvider.getAddress(
|
|
131
|
+
import_constants.AP_PRICE_FEED_COMPRESSOR,
|
|
132
132
|
310
|
|
133
133
|
);
|
|
134
134
|
const configurators = marketConfigurators ?? this.sdk.marketRegister.marketConfigurators.map((mc) => mc.address);
|
|
@@ -137,8 +137,8 @@ class PriceFeedRegister extends import_base.SDKConstruct {
|
|
|
137
137
|
`calling getUpdatablePriceFeeds in block ${this.sdk.currentBlock}`
|
|
138
138
|
);
|
|
139
139
|
const result = await this.provider.publicClient.readContract({
|
|
140
|
-
address:
|
|
141
|
-
abi: import_compressors.
|
|
140
|
+
address: priceFeedCompressorAddress,
|
|
141
|
+
abi: import_compressors.iPriceFeedCompressorAbi,
|
|
142
142
|
functionName: "getUpdatablePriceFeeds",
|
|
143
143
|
args: [
|
|
144
144
|
{
|
|
@@ -64,7 +64,9 @@ class CreditAccountData_Legacy {
|
|
|
64
64
|
this.underlying = payload.underlying.toLowerCase();
|
|
65
65
|
this.expirationDate = Number(payload.expirationDate);
|
|
66
66
|
this.version = Number(payload.cfVersion);
|
|
67
|
-
this.healthFactor = Number(
|
|
67
|
+
this.healthFactor = Number(
|
|
68
|
+
(payload.healthFactor || 0n) * import_constants.PERCENTAGE_FACTOR / import_constants.WAD
|
|
69
|
+
);
|
|
68
70
|
this.enabledTokensMask = payload.enabledTokensMask;
|
|
69
71
|
this.isDeleting = false;
|
|
70
72
|
this.borrowedAmount = payload.debt;
|