@gearbox-protocol/sdk 8.1.4 → 8.1.6
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/plugins/degen-distributors/DegenDistributorsPlugin.js +1 -3
- package/dist/cjs/plugins/pools-history/Pools7DAgoPlugin.js +1 -6
- package/dist/cjs/sdk/chain/chains.js +4 -4
- package/dist/cjs/sdk/sdk-legacy/tokens/tokenData.js +2 -1
- package/dist/cjs/sdk/utils/viem/simulateMulticall.js +7 -25
- package/dist/esm/plugins/degen-distributors/DegenDistributorsPlugin.js +1 -3
- package/dist/esm/plugins/pools-history/Pools7DAgoPlugin.js +1 -6
- package/dist/esm/sdk/chain/chains.js +4 -4
- package/dist/esm/sdk/sdk-legacy/tokens/tokenData.js +2 -1
- package/dist/esm/sdk/utils/viem/simulateMulticall.js +7 -25
- package/dist/types/sdk/chain/chains.d.ts +1 -1
- package/dist/types/sdk/utils/viem/simulateMulticall.d.ts +4 -0
- package/package.json +1 -1
|
@@ -47,15 +47,13 @@ class DegenDistributorsPlugin extends import_sdk.BasePlugin {
|
|
|
47
47
|
acc[cfgLC] = distributors[index];
|
|
48
48
|
return acc;
|
|
49
49
|
}, {});
|
|
50
|
+
this.#distributors = new import_sdk.AddressMap(void 0, MAP_LABEL);
|
|
50
51
|
this.sdk.marketRegister.markets.forEach((m) => {
|
|
51
52
|
const pool = m.pool.pool.address;
|
|
52
53
|
const cfg = m.configurator.address;
|
|
53
54
|
const cfgLC = cfg.toLowerCase();
|
|
54
55
|
const r = distributorByConfigurator?.[cfgLC];
|
|
55
56
|
if (r.status === "fulfilled") {
|
|
56
|
-
if (!this.#distributors) {
|
|
57
|
-
this.#distributors = new import_sdk.AddressMap(void 0, MAP_LABEL);
|
|
58
|
-
}
|
|
59
57
|
this.#distributors.upsert(pool, r.value);
|
|
60
58
|
} else {
|
|
61
59
|
this.sdk.logger?.error(
|
|
@@ -51,17 +51,12 @@ class Pools7DAgoPlugin extends import_sdk.BasePlugin {
|
|
|
51
51
|
),
|
|
52
52
|
blockNumber: import_sdk.BigIntMath.max(0n, targetBlock)
|
|
53
53
|
});
|
|
54
|
+
this.#pools7DAgo = new import_sdk.AddressMap(void 0, MAP_LABEL);
|
|
54
55
|
resp.forEach((r, index) => {
|
|
55
56
|
const m = markets[index];
|
|
56
57
|
const cfg = m.configurator.address;
|
|
57
58
|
const pool = m.pool.pool.address;
|
|
58
59
|
if (r.status === "success") {
|
|
59
|
-
if (!this.#pools7DAgo) {
|
|
60
|
-
this.#pools7DAgo = new import_sdk.AddressMap(
|
|
61
|
-
void 0,
|
|
62
|
-
MAP_LABEL
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
60
|
this.#pools7DAgo.upsert(m.pool.pool.address, {
|
|
66
61
|
dieselRate: r.result.dieselRate,
|
|
67
62
|
pool
|
|
@@ -64,11 +64,11 @@ const chains = {
|
|
|
64
64
|
network: "Mainnet",
|
|
65
65
|
defaultMarketConfigurators: {
|
|
66
66
|
"0x354fe9f450F60b8547f88BE042E4A45b46128a06": "Chaos Labs",
|
|
67
|
-
"0x4d427D418342d8CE89a7634c3a402851978B680A": "K3"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"0xc168343c791d56dd1da4b4b8b0cc1c1ec1a16e6b": "cp0x"
|
|
67
|
+
"0x4d427D418342d8CE89a7634c3a402851978B680A": "K3",
|
|
68
|
+
"0xc168343c791d56dd1da4b4b8b0cc1c1ec1a16e6b": "cp0x",
|
|
69
|
+
"0x3b56538833fc02f4f0e75609390f26ded0c32e42": "Re7"
|
|
71
70
|
},
|
|
71
|
+
testMarketConfigurators: {},
|
|
72
72
|
isPublic: true,
|
|
73
73
|
wellKnownToken: {
|
|
74
74
|
address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
@@ -38,7 +38,8 @@ const ALIASES = {
|
|
|
38
38
|
PT_corn_pumpBTC_26DEC2024: "p.c.pumpBTC(26.12.24)",
|
|
39
39
|
PT_sUSDe_27MAR2025: "p.sUSDe(27.03.25)",
|
|
40
40
|
PT_sUSDe_29MAY2025: "p.sUSDe(29.05.25)",
|
|
41
|
-
PT_beraSTONE_10APR2025: "p.beraSTONE(10.04.25)"
|
|
41
|
+
PT_beraSTONE_10APR2025: "p.beraSTONE(10.04.25)",
|
|
42
|
+
PT_uptBTC_14AUG2025: "p.uptBTC(14.08.25)"
|
|
42
43
|
};
|
|
43
44
|
class TokenData {
|
|
44
45
|
address;
|
|
@@ -91,31 +91,13 @@ async function simulateMulticall(client, parameters) {
|
|
|
91
91
|
account
|
|
92
92
|
};
|
|
93
93
|
const results = [];
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
data: data || "0x"
|
|
102
|
-
});
|
|
103
|
-
} catch (e) {
|
|
104
|
-
if (!allowFailure) {
|
|
105
|
-
throw e;
|
|
106
|
-
}
|
|
107
|
-
for (const _ of contracts) {
|
|
108
|
-
results.push({
|
|
109
|
-
status: "failure",
|
|
110
|
-
error: e,
|
|
111
|
-
result: void 0
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
return {
|
|
115
|
-
results,
|
|
116
|
-
request
|
|
117
|
-
};
|
|
118
|
-
}
|
|
94
|
+
const { data } = await (0, import_utils.getAction)(client, import_actions.call, "call")(request);
|
|
95
|
+
const result = (0, import_viem.decodeFunctionResult)({
|
|
96
|
+
abi: import_viem.multicall3Abi,
|
|
97
|
+
args: [calls],
|
|
98
|
+
functionName: "aggregate3",
|
|
99
|
+
data: data || "0x"
|
|
100
|
+
});
|
|
119
101
|
for (let j = 0; j < result.length; j++) {
|
|
120
102
|
const { returnData, success } = result[j];
|
|
121
103
|
const { callData } = calls[j];
|
|
@@ -24,15 +24,13 @@ class DegenDistributorsPlugin extends BasePlugin {
|
|
|
24
24
|
acc[cfgLC] = distributors[index];
|
|
25
25
|
return acc;
|
|
26
26
|
}, {});
|
|
27
|
+
this.#distributors = new AddressMap(void 0, MAP_LABEL);
|
|
27
28
|
this.sdk.marketRegister.markets.forEach((m) => {
|
|
28
29
|
const pool = m.pool.pool.address;
|
|
29
30
|
const cfg = m.configurator.address;
|
|
30
31
|
const cfgLC = cfg.toLowerCase();
|
|
31
32
|
const r = distributorByConfigurator?.[cfgLC];
|
|
32
33
|
if (r.status === "fulfilled") {
|
|
33
|
-
if (!this.#distributors) {
|
|
34
|
-
this.#distributors = new AddressMap(void 0, MAP_LABEL);
|
|
35
|
-
}
|
|
36
34
|
this.#distributors.upsert(pool, r.value);
|
|
37
35
|
} else {
|
|
38
36
|
this.sdk.logger?.error(
|
|
@@ -35,17 +35,12 @@ class Pools7DAgoPlugin extends BasePlugin {
|
|
|
35
35
|
),
|
|
36
36
|
blockNumber: BigIntMath.max(0n, targetBlock)
|
|
37
37
|
});
|
|
38
|
+
this.#pools7DAgo = new AddressMap(void 0, MAP_LABEL);
|
|
38
39
|
resp.forEach((r, index) => {
|
|
39
40
|
const m = markets[index];
|
|
40
41
|
const cfg = m.configurator.address;
|
|
41
42
|
const pool = m.pool.pool.address;
|
|
42
43
|
if (r.status === "success") {
|
|
43
|
-
if (!this.#pools7DAgo) {
|
|
44
|
-
this.#pools7DAgo = new AddressMap(
|
|
45
|
-
void 0,
|
|
46
|
-
MAP_LABEL
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
44
|
this.#pools7DAgo.upsert(m.pool.pool.address, {
|
|
50
45
|
dieselRate: r.result.dieselRate,
|
|
51
46
|
pool
|
|
@@ -48,11 +48,11 @@ const chains = {
|
|
|
48
48
|
network: "Mainnet",
|
|
49
49
|
defaultMarketConfigurators: {
|
|
50
50
|
"0x354fe9f450F60b8547f88BE042E4A45b46128a06": "Chaos Labs",
|
|
51
|
-
"0x4d427D418342d8CE89a7634c3a402851978B680A": "K3"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"0xc168343c791d56dd1da4b4b8b0cc1c1ec1a16e6b": "cp0x"
|
|
51
|
+
"0x4d427D418342d8CE89a7634c3a402851978B680A": "K3",
|
|
52
|
+
"0xc168343c791d56dd1da4b4b8b0cc1c1ec1a16e6b": "cp0x",
|
|
53
|
+
"0x3b56538833fc02f4f0e75609390f26ded0c32e42": "Re7"
|
|
55
54
|
},
|
|
55
|
+
testMarketConfigurators: {},
|
|
56
56
|
isPublic: true,
|
|
57
57
|
wellKnownToken: {
|
|
58
58
|
address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
@@ -15,7 +15,8 @@ const ALIASES = {
|
|
|
15
15
|
PT_corn_pumpBTC_26DEC2024: "p.c.pumpBTC(26.12.24)",
|
|
16
16
|
PT_sUSDe_27MAR2025: "p.sUSDe(27.03.25)",
|
|
17
17
|
PT_sUSDe_29MAY2025: "p.sUSDe(29.05.25)",
|
|
18
|
-
PT_beraSTONE_10APR2025: "p.beraSTONE(10.04.25)"
|
|
18
|
+
PT_beraSTONE_10APR2025: "p.beraSTONE(10.04.25)",
|
|
19
|
+
PT_uptBTC_14AUG2025: "p.uptBTC(14.08.25)"
|
|
19
20
|
};
|
|
20
21
|
class TokenData {
|
|
21
22
|
address;
|
|
@@ -77,31 +77,13 @@ async function simulateMulticall(client, parameters) {
|
|
|
77
77
|
account
|
|
78
78
|
};
|
|
79
79
|
const results = [];
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
data: data || "0x"
|
|
88
|
-
});
|
|
89
|
-
} catch (e) {
|
|
90
|
-
if (!allowFailure) {
|
|
91
|
-
throw e;
|
|
92
|
-
}
|
|
93
|
-
for (const _ of contracts) {
|
|
94
|
-
results.push({
|
|
95
|
-
status: "failure",
|
|
96
|
-
error: e,
|
|
97
|
-
result: void 0
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
return {
|
|
101
|
-
results,
|
|
102
|
-
request
|
|
103
|
-
};
|
|
104
|
-
}
|
|
80
|
+
const { data } = await getAction(client, call, "call")(request);
|
|
81
|
+
const result = decodeFunctionResult({
|
|
82
|
+
abi: multicall3Abi,
|
|
83
|
+
args: [calls],
|
|
84
|
+
functionName: "aggregate3",
|
|
85
|
+
data: data || "0x"
|
|
86
|
+
});
|
|
105
87
|
for (let j = 0; j < result.length; j++) {
|
|
106
88
|
const { returnData, success } = result[j];
|
|
107
89
|
const { callData } = calls[j];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Address, Chain } from "viem";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
export type Curator = "Chaos Labs" | "K3" | "cp0x";
|
|
3
|
+
export type Curator = "Chaos Labs" | "K3" | "cp0x" | "Re7";
|
|
4
4
|
export interface GearboxChain extends Chain {
|
|
5
5
|
network: NetworkType;
|
|
6
6
|
defaultMarketConfigurators: Record<Address, Curator>;
|
|
@@ -23,6 +23,10 @@ export interface SimulateMulticallReturnType<contracts extends readonly unknown[
|
|
|
23
23
|
/**
|
|
24
24
|
* This is "multicall" action from viem, modified to use "simulateContract" instead of "readContract"
|
|
25
25
|
* Unlike viem's multicall there's no batching, since for simulation we assume that calls are dependent
|
|
26
|
+
*
|
|
27
|
+
* Another difference is how network errors are threated
|
|
28
|
+
* In case of multicall-level error (network, out of gas, header not found, etc.) this method will throw even with allowFailure=true,
|
|
29
|
+
* while original multicall with allowFailure=true will return `failure` for all calls, and push error down to each call
|
|
26
30
|
* @param client
|
|
27
31
|
* @param parameters
|
|
28
32
|
* @returns
|