@gearbox-protocol/sdk 7.11.0-next.2 → 7.11.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/adapters/AdaptersPlugin.js +3 -2
- package/dist/cjs/bots/BotsPlugin.js +17 -29
- package/dist/cjs/dev/AccountsCounterPlugin.js +10 -19
- package/dist/cjs/dev/createTransport.js +2 -1
- package/dist/cjs/sdk/GearboxSDK.js +3 -13
- package/dist/cjs/sdk/chain/chains.js +21 -10
- package/dist/cjs/sdk/constants/address-provider.js +2 -1
- package/dist/cjs/sdk/constants/addresses.js +8 -4
- package/dist/cjs/sdk/constants/networks.js +5 -2
- package/dist/cjs/sdk/plugins/V300StalenessPeriodPlugin.js +1 -3
- package/dist/cjs/sdk/router/RouterV300Contract.js +2 -1
- package/dist/cjs/sdk/sdk-gov-legacy/contracts/contracts.js +74 -37
- package/dist/cjs/sdk/sdk-gov-legacy/tokens/token.js +4 -2
- package/dist/cjs/sdk/sdk-gov-legacy/tokens/tokenData.js +2 -1
- package/dist/cjs/sdk/sdk-legacy/core/endpoint.js +2 -1
- package/dist/cjs/sdk/sdk-legacy/gearboxRewards/api.js +159 -94
- package/dist/cjs/sdk/sdk-legacy/gearboxRewards/apy.js +1 -1
- package/dist/cjs/sdk/sdk-legacy/gearboxRewards/extraAPY.js +0 -4
- package/dist/cjs/sdk/sdk-legacy/index.js +2 -0
- package/dist/cjs/{pools7DAgo/types.js → sdk/sdk-legacy/pathfinder/core.js} +2 -2
- package/dist/cjs/{pools7DAgo → sdk/sdk-legacy/pathfinder}/index.js +4 -6
- package/dist/cjs/sdk/utils/viem/simulateWithPriceUpdates.js +1 -0
- package/dist/cjs/zappers/ZappersPlugin.js +4 -13
- package/dist/esm/adapters/AdaptersPlugin.js +3 -2
- package/dist/esm/bots/BotsPlugin.js +17 -29
- package/dist/esm/dev/AccountsCounterPlugin.js +10 -19
- package/dist/esm/dev/createTransport.js +2 -1
- package/dist/esm/sdk/GearboxSDK.js +3 -13
- package/dist/esm/sdk/chain/chains.js +22 -10
- package/dist/esm/sdk/constants/address-provider.js +2 -1
- package/dist/esm/sdk/constants/addresses.js +8 -4
- package/dist/esm/sdk/constants/networks.js +5 -2
- package/dist/esm/sdk/plugins/V300StalenessPeriodPlugin.js +1 -3
- package/dist/esm/sdk/router/RouterV300Contract.js +2 -1
- package/dist/esm/sdk/sdk-gov-legacy/contracts/contracts.js +74 -37
- package/dist/esm/sdk/sdk-gov-legacy/tokens/token.js +4 -2
- package/dist/esm/sdk/sdk-gov-legacy/tokens/tokenData.js +2 -1
- package/dist/esm/sdk/sdk-legacy/core/endpoint.js +2 -1
- package/dist/esm/sdk/sdk-legacy/gearboxRewards/api.js +159 -94
- package/dist/esm/sdk/sdk-legacy/gearboxRewards/apy.js +1 -1
- package/dist/esm/sdk/sdk-legacy/gearboxRewards/extraAPY.js +0 -4
- package/dist/esm/sdk/sdk-legacy/index.js +1 -0
- package/dist/esm/sdk/sdk-legacy/pathfinder/index.js +1 -0
- package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -0
- package/dist/esm/zappers/ZappersPlugin.js +4 -13
- package/dist/types/adapters/AdaptersPlugin.d.ts +4 -5
- package/dist/types/bots/BotsPlugin.d.ts +3 -5
- package/dist/types/bots/types.d.ts +2 -2
- package/dist/types/dev/AccountsCounterPlugin.d.ts +2 -4
- package/dist/types/sdk/GearboxSDK.d.ts +3 -4
- package/dist/types/sdk/chain/chains.d.ts +2 -2
- package/dist/types/sdk/plugins/V300StalenessPeriodPlugin.d.ts +2 -3
- package/dist/types/sdk/plugins/types.d.ts +15 -33
- package/dist/types/sdk/sdk-legacy/gearboxRewards/api.d.ts +27 -16
- package/dist/types/sdk/sdk-legacy/gearboxRewards/apy.d.ts +15 -9
- package/dist/types/sdk/sdk-legacy/gearboxRewards/extraAPY.d.ts +3 -2
- package/dist/types/sdk/sdk-legacy/index.d.ts +1 -0
- package/dist/types/sdk/sdk-legacy/pathfinder/core.d.ts +14 -0
- package/dist/types/sdk/sdk-legacy/pathfinder/index.d.ts +1 -0
- package/dist/types/zappers/ZappersPlugin.d.ts +4 -5
- package/package.json +1 -1
- package/dist/cjs/degenDistributors/DegenDistributorsPlugin.js +0 -110
- package/dist/cjs/degenDistributors/index.js +0 -24
- package/dist/cjs/degenDistributors/package.json +0 -1
- package/dist/cjs/degenDistributors/types.js +0 -16
- package/dist/cjs/pools7DAgo/Pools7DAgoPlugin.js +0 -116
- package/dist/cjs/pools7DAgo/package.json +0 -1
- package/dist/esm/degenDistributors/DegenDistributorsPlugin.js +0 -86
- package/dist/esm/degenDistributors/index.js +0 -2
- package/dist/esm/degenDistributors/package.json +0 -1
- package/dist/esm/pools7DAgo/Pools7DAgoPlugin.js +0 -99
- package/dist/esm/pools7DAgo/index.js +0 -2
- package/dist/esm/pools7DAgo/package.json +0 -1
- package/dist/esm/pools7DAgo/types.js +0 -0
- package/dist/types/degenDistributors/DegenDistributorsPlugin.d.ts +0 -22
- package/dist/types/degenDistributors/index.d.ts +0 -2
- package/dist/types/degenDistributors/types.d.ts +0 -4
- package/dist/types/pools7DAgo/Pools7DAgoPlugin.d.ts +0 -22
- package/dist/types/pools7DAgo/index.d.ts +0 -2
- package/dist/types/pools7DAgo/types.d.ts +0 -9
- /package/dist/esm/{degenDistributors/types.js → sdk/sdk-legacy/pathfinder/core.js} +0 -0
|
@@ -48,7 +48,6 @@ var import_YearnV2AdapterContract = require("./YearnV2AdapterContract.js");
|
|
|
48
48
|
class AdaptersPlugin extends import_sdk.SDKConstruct {
|
|
49
49
|
name = "Adapters";
|
|
50
50
|
version = 1;
|
|
51
|
-
loaded = true;
|
|
52
51
|
createContract(data) {
|
|
53
52
|
const args = data;
|
|
54
53
|
const adapterType = (0, import_sdk.bytes32ToString)(
|
|
@@ -117,7 +116,9 @@ class AdaptersPlugin extends import_sdk.SDKConstruct {
|
|
|
117
116
|
return {};
|
|
118
117
|
}
|
|
119
118
|
get state() {
|
|
120
|
-
return {
|
|
119
|
+
return {
|
|
120
|
+
version: this.version
|
|
121
|
+
};
|
|
121
122
|
}
|
|
122
123
|
hydrate(_) {
|
|
123
124
|
}
|
|
@@ -39,25 +39,25 @@ class UnsupportedBotVersionError extends Error {
|
|
|
39
39
|
class BotsPlugin extends import_sdk.SDKConstruct {
|
|
40
40
|
#logger;
|
|
41
41
|
version = 1;
|
|
42
|
-
#botsByMarket;
|
|
42
|
+
#botsByMarket = new import_sdk.AddressMap();
|
|
43
43
|
constructor(sdk) {
|
|
44
44
|
super(sdk);
|
|
45
45
|
this.#logger = sdk.logger?.child?.({ name: "BotsPlugin" }) ?? sdk.logger;
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
async attach() {
|
|
48
|
+
await this.#load();
|
|
49
|
+
}
|
|
50
50
|
async syncState() {
|
|
51
|
-
await this
|
|
51
|
+
await this.#load();
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
return
|
|
53
|
+
botsByMarketConfigurator(mc) {
|
|
54
|
+
return this.#botsByMarket.get(mc) ?? [];
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
this.#botsByMarket
|
|
56
|
+
get allBots() {
|
|
57
|
+
return this.#botsByMarket.values().flat();
|
|
58
|
+
}
|
|
59
|
+
async #load() {
|
|
60
|
+
this.#botsByMarket.clear();
|
|
61
61
|
const [pcAddr] = this.sdk.addressProvider.mustGetLatest(
|
|
62
62
|
import_sdk.AP_PERIPHERY_COMPRESSOR,
|
|
63
63
|
import_sdk.VERSION_RANGE_310
|
|
@@ -82,7 +82,6 @@ class BotsPlugin extends import_sdk.SDKConstruct {
|
|
|
82
82
|
const marketBotData = botsData[i];
|
|
83
83
|
this.#loadStateMarketState(mc, marketBotData);
|
|
84
84
|
}
|
|
85
|
-
return this.state;
|
|
86
85
|
}
|
|
87
86
|
#loadStateMarketState(mc, state) {
|
|
88
87
|
const bots = state.map((state2) => this.#createBot(mc, state2)).sort((a, b) => a.minHealthFactor - b.minHealthFactor);
|
|
@@ -94,39 +93,28 @@ class BotsPlugin extends import_sdk.SDKConstruct {
|
|
|
94
93
|
bots[i].botType = import_types.BOT_TYPES[i];
|
|
95
94
|
}
|
|
96
95
|
}
|
|
97
|
-
this
|
|
96
|
+
this.#botsByMarket.upsert(mc, bots);
|
|
98
97
|
}
|
|
99
98
|
stateHuman(raw) {
|
|
100
99
|
return {
|
|
101
100
|
bots: Object.fromEntries(
|
|
102
|
-
this
|
|
101
|
+
this.#botsByMarket.entries().map(([mc, bots]) => [
|
|
103
102
|
this.labelAddress(mc),
|
|
104
103
|
bots.map((b) => b.stateHuman(raw))
|
|
105
104
|
])
|
|
106
105
|
)
|
|
107
106
|
};
|
|
108
107
|
}
|
|
109
|
-
get botsByMarket() {
|
|
110
|
-
if (!this.#botsByMarket) {
|
|
111
|
-
throw new Error("bots plugin not loaded");
|
|
112
|
-
}
|
|
113
|
-
return this.#botsByMarket;
|
|
114
|
-
}
|
|
115
|
-
botsByMarketConfigurator(mc) {
|
|
116
|
-
return this.botsByMarket.get(mc) ?? [];
|
|
117
|
-
}
|
|
118
|
-
get allBots() {
|
|
119
|
-
return this.botsByMarket.values().flat();
|
|
120
|
-
}
|
|
121
108
|
get state() {
|
|
122
109
|
return {
|
|
110
|
+
version: this.version,
|
|
123
111
|
bots: import_sdk.TypedObjectUtils.fromEntries(
|
|
124
|
-
this
|
|
112
|
+
this.#botsByMarket.entries().map(([mc, bots]) => [mc, bots.map((b) => b.state)])
|
|
125
113
|
)
|
|
126
114
|
};
|
|
127
115
|
}
|
|
128
116
|
hydrate(state) {
|
|
129
|
-
this.#botsByMarket
|
|
117
|
+
this.#botsByMarket.clear();
|
|
130
118
|
for (const [mc, botStates] of import_sdk.TypedObjectUtils.entries(state.bots)) {
|
|
131
119
|
this.#loadStateMarketState(mc, botStates);
|
|
132
120
|
}
|
|
@@ -24,30 +24,21 @@ module.exports = __toCommonJS(AccountsCounterPlugin_exports);
|
|
|
24
24
|
var import_compressors = require("../abi/compressors.js");
|
|
25
25
|
var import_sdk = require("../sdk/index.js");
|
|
26
26
|
class AccountsCounterPlugin extends import_sdk.SDKConstruct {
|
|
27
|
-
#accounts;
|
|
27
|
+
#accounts = new import_sdk.AddressMap();
|
|
28
28
|
version = 1;
|
|
29
29
|
async attach() {
|
|
30
|
-
await this
|
|
30
|
+
await this.#load();
|
|
31
31
|
}
|
|
32
32
|
async syncState() {
|
|
33
|
-
await this
|
|
33
|
+
await this.#load();
|
|
34
34
|
}
|
|
35
35
|
get accounts() {
|
|
36
|
-
if (!this.#accounts) {
|
|
37
|
-
throw new Error("AccountsCounterPlugin is not loaded");
|
|
38
|
-
}
|
|
39
36
|
return this.#accounts;
|
|
40
37
|
}
|
|
41
|
-
get loaded() {
|
|
42
|
-
return !!this.#accounts;
|
|
43
|
-
}
|
|
44
38
|
forCreditManager(addr) {
|
|
45
|
-
return this
|
|
39
|
+
return this.#accounts.mustGet(addr);
|
|
46
40
|
}
|
|
47
|
-
async load(
|
|
48
|
-
if (!force && this.loaded) {
|
|
49
|
-
return this.state;
|
|
50
|
-
}
|
|
41
|
+
async #load() {
|
|
51
42
|
const [compressor] = this.sdk.addressProvider.mustGetLatest(
|
|
52
43
|
import_sdk.AP_CREDIT_ACCOUNT_COMPRESSOR,
|
|
53
44
|
import_sdk.VERSION_RANGE_310
|
|
@@ -90,23 +81,23 @@ class AccountsCounterPlugin extends import_sdk.SDKConstruct {
|
|
|
90
81
|
),
|
|
91
82
|
allowFailure: false
|
|
92
83
|
});
|
|
93
|
-
this.#accounts
|
|
84
|
+
this.#accounts.clear();
|
|
94
85
|
for (let i = 0; i < cms.length; i++) {
|
|
95
86
|
const cm = cms[i];
|
|
96
87
|
const [reverting, nonReverting] = [count[2 * i], count[2 * i + 1]];
|
|
97
88
|
this.#accounts.upsert(cm.creditManager.address, reverting + nonReverting);
|
|
98
89
|
}
|
|
99
|
-
return this.state;
|
|
100
90
|
}
|
|
101
91
|
get state() {
|
|
102
92
|
return {
|
|
103
|
-
|
|
93
|
+
version: this.version,
|
|
94
|
+
accounts: this.#accounts.asRecord()
|
|
104
95
|
};
|
|
105
96
|
}
|
|
106
97
|
hydrate(state) {
|
|
107
|
-
this.#accounts
|
|
98
|
+
this.#accounts.clear();
|
|
108
99
|
for (const [addr, count] of import_sdk.TypedObjectUtils.entries(state.accounts)) {
|
|
109
|
-
this
|
|
100
|
+
this.#accounts.upsert(addr, count);
|
|
110
101
|
}
|
|
111
102
|
}
|
|
112
103
|
}
|
|
@@ -244,12 +244,6 @@ class GearboxSDK {
|
|
|
244
244
|
for (const [name, plugin] of import_utils.TypedObjectUtils.entries(this.plugins)) {
|
|
245
245
|
const pluginState = state.plugins[name];
|
|
246
246
|
if (plugin.hydrate && pluginState) {
|
|
247
|
-
if (!pluginState.loaded) {
|
|
248
|
-
this.logger?.debug(
|
|
249
|
-
`skipping ${re}hydrating plugin ${name} state: not loaded`
|
|
250
|
-
);
|
|
251
|
-
continue;
|
|
252
|
-
}
|
|
253
247
|
if (pluginState.version !== plugin.version) {
|
|
254
248
|
throw new import_plugins.PluginStateVersionError(plugin, pluginState);
|
|
255
249
|
}
|
|
@@ -272,7 +266,7 @@ class GearboxSDK {
|
|
|
272
266
|
/**
|
|
273
267
|
* Rehydrate existing SDK from new state without re-creating instance
|
|
274
268
|
*/
|
|
275
|
-
|
|
269
|
+
rehydrate(state) {
|
|
276
270
|
if (!this.#attachConfig) {
|
|
277
271
|
throw new Error("cannot rehydrate, attach config is not set");
|
|
278
272
|
}
|
|
@@ -281,10 +275,6 @@ class GearboxSDK {
|
|
|
281
275
|
redstone: this.#attachConfig.redstone
|
|
282
276
|
};
|
|
283
277
|
this.#hydrate(opts, state);
|
|
284
|
-
await this.#hooks.triggerHooks("rehydrate", {
|
|
285
|
-
blockNumber: state.currentBlock,
|
|
286
|
-
timestamp: state.timestamp
|
|
287
|
-
});
|
|
288
278
|
}
|
|
289
279
|
/**
|
|
290
280
|
* Converts contract call into some human-friendly string
|
|
@@ -347,7 +337,7 @@ class GearboxSDK {
|
|
|
347
337
|
plugins: Object.fromEntries(
|
|
348
338
|
import_utils.TypedObjectUtils.entries(this.plugins).map(([name, plugin]) => [
|
|
349
339
|
name,
|
|
350
|
-
plugin.
|
|
340
|
+
plugin.stateHuman?.(raw) ?? {}
|
|
351
341
|
])
|
|
352
342
|
),
|
|
353
343
|
...this.marketRegister.stateHuman(raw)
|
|
@@ -365,7 +355,7 @@ class GearboxSDK {
|
|
|
365
355
|
plugins: Object.fromEntries(
|
|
366
356
|
import_utils.TypedObjectUtils.entries(this.plugins).map(([name, plugin]) => [
|
|
367
357
|
name,
|
|
368
|
-
plugin.
|
|
358
|
+
plugin.state
|
|
369
359
|
])
|
|
370
360
|
)
|
|
371
361
|
};
|
|
@@ -30,6 +30,7 @@ module.exports = __toCommonJS(chains_exports);
|
|
|
30
30
|
var import_viem = require("viem");
|
|
31
31
|
var import_chains = require("viem/chains");
|
|
32
32
|
var import_zod = require("zod");
|
|
33
|
+
var import_utils = require("../utils/index.js");
|
|
33
34
|
const SUPPORTED_NETWORKS = [
|
|
34
35
|
"Mainnet",
|
|
35
36
|
"Arbitrum",
|
|
@@ -41,7 +42,8 @@ const SUPPORTED_NETWORKS = [
|
|
|
41
42
|
"Berachain",
|
|
42
43
|
"Avalanche",
|
|
43
44
|
"BNB",
|
|
44
|
-
"WorldChain"
|
|
45
|
+
"WorldChain",
|
|
46
|
+
"Etherlink"
|
|
45
47
|
];
|
|
46
48
|
const NetworkType = import_zod.z.enum(SUPPORTED_NETWORKS);
|
|
47
49
|
function withPublicNode(chain, subdomain) {
|
|
@@ -230,12 +232,19 @@ const chains = {
|
|
|
230
232
|
},
|
|
231
233
|
alchemyDomain: "worldchain-mainnet"
|
|
232
234
|
// TODO: has no block explorer API
|
|
235
|
+
}),
|
|
236
|
+
Etherlink: (0, import_viem.defineChain)({
|
|
237
|
+
...import_chains.etherlink,
|
|
238
|
+
network: "Etherlink",
|
|
239
|
+
defaultMarketConfigurators: {},
|
|
240
|
+
isPublic: false,
|
|
241
|
+
wellKnownToken: {
|
|
242
|
+
address: "0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9",
|
|
243
|
+
symbol: "USDC"
|
|
244
|
+
}
|
|
245
|
+
// TODO: has no block explorer API
|
|
233
246
|
})
|
|
234
247
|
};
|
|
235
|
-
const networkByChainId = Object.values(chains).reduce((acc, chain) => {
|
|
236
|
-
acc[chain.id] = chain.network;
|
|
237
|
-
return acc;
|
|
238
|
-
}, {});
|
|
239
248
|
function getChain(chainIdOrNetworkType) {
|
|
240
249
|
const network = typeof chainIdOrNetworkType === "string" ? chainIdOrNetworkType : getNetworkType(Number(chainIdOrNetworkType));
|
|
241
250
|
const chain = chains[network];
|
|
@@ -245,13 +254,15 @@ function getChain(chainIdOrNetworkType) {
|
|
|
245
254
|
return chain;
|
|
246
255
|
}
|
|
247
256
|
function getNetworkType(chainId) {
|
|
248
|
-
const network
|
|
249
|
-
|
|
250
|
-
|
|
257
|
+
for (const [network, chain] of import_utils.TypedObjectUtils.entries(chains)) {
|
|
258
|
+
if (chain.id === Number(chainId)) {
|
|
259
|
+
return network;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
throw new Error(`Unsupported network with chainId ${chainId}`);
|
|
251
263
|
}
|
|
252
264
|
function isSupportedNetwork(chainId) {
|
|
253
|
-
|
|
254
|
-
return !!networkByChainId[chainId];
|
|
265
|
+
return Object.values(chains).some((c) => c.id === chainId);
|
|
255
266
|
}
|
|
256
267
|
function isPublicNetwork(networkOrChainId) {
|
|
257
268
|
return Object.values(chains).some((c) => {
|
|
@@ -99,7 +99,8 @@ const ADDRESS_PROVIDER = {
|
|
|
99
99
|
Berachain: import_addresses.NOT_DEPLOYED,
|
|
100
100
|
Avalanche: import_addresses.NOT_DEPLOYED,
|
|
101
101
|
BNB: import_addresses.NOT_DEPLOYED,
|
|
102
|
-
WorldChain: import_addresses.NOT_DEPLOYED
|
|
102
|
+
WorldChain: import_addresses.NOT_DEPLOYED,
|
|
103
|
+
Etherlink: import_addresses.NOT_DEPLOYED
|
|
103
104
|
};
|
|
104
105
|
const ADDRESS_PROVIDER_V310 = "0xF7f0a609BfAb9a0A98786951ef10e5FE26cC1E38";
|
|
105
106
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -42,7 +42,8 @@ const TIMELOCK = {
|
|
|
42
42
|
Berachain: NOT_DEPLOYED,
|
|
43
43
|
Avalanche: NOT_DEPLOYED,
|
|
44
44
|
BNB: NOT_DEPLOYED,
|
|
45
|
-
WorldChain: NOT_DEPLOYED
|
|
45
|
+
WorldChain: NOT_DEPLOYED,
|
|
46
|
+
Etherlink: NOT_DEPLOYED
|
|
46
47
|
};
|
|
47
48
|
const GEARBOX_MULTISIG = {
|
|
48
49
|
Mainnet: "0xA7D5DDc1b8557914F158076b228AA91eF613f1D5",
|
|
@@ -56,7 +57,8 @@ const GEARBOX_MULTISIG = {
|
|
|
56
57
|
Berachain: NOT_DEPLOYED,
|
|
57
58
|
Avalanche: NOT_DEPLOYED,
|
|
58
59
|
BNB: NOT_DEPLOYED,
|
|
59
|
-
WorldChain: NOT_DEPLOYED
|
|
60
|
+
WorldChain: NOT_DEPLOYED,
|
|
61
|
+
Etherlink: NOT_DEPLOYED
|
|
60
62
|
};
|
|
61
63
|
const GEARBOX_RISK_CURATORS = {
|
|
62
64
|
Mainnet: [TIMELOCK.Mainnet],
|
|
@@ -70,7 +72,8 @@ const GEARBOX_RISK_CURATORS = {
|
|
|
70
72
|
Berachain: [],
|
|
71
73
|
Avalanche: [],
|
|
72
74
|
BNB: [],
|
|
73
|
-
WorldChain: []
|
|
75
|
+
WorldChain: [],
|
|
76
|
+
Etherlink: []
|
|
74
77
|
};
|
|
75
78
|
const DEPRECIATED_POOLS = {
|
|
76
79
|
Mainnet: {
|
|
@@ -86,7 +89,8 @@ const DEPRECIATED_POOLS = {
|
|
|
86
89
|
Berachain: {},
|
|
87
90
|
Avalanche: {},
|
|
88
91
|
BNB: {},
|
|
89
|
-
WorldChain: {}
|
|
92
|
+
WorldChain: {},
|
|
93
|
+
Etherlink: {}
|
|
90
94
|
};
|
|
91
95
|
// Annotate the CommonJS export names for ESM import in node:
|
|
92
96
|
0 && (module.exports = {
|
|
@@ -42,7 +42,9 @@ const ADDRESS_PROVIDER_BLOCK = {
|
|
|
42
42
|
// arbitrary not deployed yet
|
|
43
43
|
BNB: 48553569n,
|
|
44
44
|
// arbitrary not deployed yet
|
|
45
|
-
WorldChain: 22372908n
|
|
45
|
+
WorldChain: 22372908n,
|
|
46
|
+
// arbitrary not deployed yet
|
|
47
|
+
Etherlink: 16672969n
|
|
46
48
|
// arbitrary not deployed yet
|
|
47
49
|
};
|
|
48
50
|
const BLOCK_DURATION_BY_NETWORK = {
|
|
@@ -59,7 +61,8 @@ const BLOCK_DURATION_BY_NETWORK = {
|
|
|
59
61
|
Berachain: 1.9,
|
|
60
62
|
Avalanche: 1.7,
|
|
61
63
|
BNB: 3,
|
|
62
|
-
WorldChain: 2
|
|
64
|
+
WorldChain: 2,
|
|
65
|
+
Etherlink: 1
|
|
63
66
|
};
|
|
64
67
|
const RAMP_TIME = 30 * 24 * 60 * 60 * 1.2;
|
|
65
68
|
const RAMP_DURATION_BY_NETWORK = import_mappers.TypedObjectUtils.entries(BLOCK_DURATION_BY_NETWORK).reduce(
|
|
@@ -38,9 +38,6 @@ class V300StalenessPeriodPlugin extends import_base.SDKConstruct {
|
|
|
38
38
|
this.#syncedTo = import_constants.ADDRESS_PROVIDER_BLOCK[sdk.provider.networkType] - 1n;
|
|
39
39
|
this.#logger = sdk.logger?.child?.({ name: "V300StalenessPeriodPlugin" }) ?? sdk.logger;
|
|
40
40
|
}
|
|
41
|
-
get loaded() {
|
|
42
|
-
return !!this.#syncedTo;
|
|
43
|
-
}
|
|
44
41
|
async attach() {
|
|
45
42
|
await this.#syncPriceFeeds();
|
|
46
43
|
}
|
|
@@ -101,6 +98,7 @@ class V300StalenessPeriodPlugin extends import_base.SDKConstruct {
|
|
|
101
98
|
}
|
|
102
99
|
get state() {
|
|
103
100
|
return {
|
|
101
|
+
version: this.version,
|
|
104
102
|
events: this.#events
|
|
105
103
|
};
|
|
106
104
|
}
|
|
@@ -301,7 +301,8 @@ class RouterV300Contract extends import_AbstractRouterContract.AbstractRouterCon
|
|
|
301
301
|
Berachain: "0x0",
|
|
302
302
|
Avalanche: "0x0",
|
|
303
303
|
BNB: "0x0",
|
|
304
|
-
WorldChain: "0x0"
|
|
304
|
+
WorldChain: "0x0",
|
|
305
|
+
Etherlink: "0x0"
|
|
305
306
|
};
|
|
306
307
|
const pendleRouter = PENDLE_ROUTER_BY_NETWORK[this.sdk.provider.networkType];
|
|
307
308
|
const pendleAdapter = cm.creditManager.adapters.mustGet(pendleRouter);
|