@gearbox-protocol/sdk 3.0.0-next.154 → 3.0.0-next.155
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/lib/apy/defiLamaAPY.js +1 -1
- package/lib/contracts/contractsRegister.d.ts +2 -2
- package/lib/contracts/contractsRegister.js +10 -2
- package/lib/core/rewardConvex.d.ts +1 -1
- package/lib/core/rewardConvex.js +11 -2
- package/lib/core/rewardConvex.spec.js +2 -2
- package/lib/types/IConvexV1BaseRewardPoolAdapter.d.ts +17 -1
- package/lib/types/factories/IConvexV1BaseRewardPoolAdapter__factory.d.ts +20 -0
- package/lib/types/factories/IConvexV1BaseRewardPoolAdapter__factory.js +26 -0
- package/package.json +4 -4
package/lib/apy/defiLamaAPY.js
CHANGED
|
@@ -38,7 +38,7 @@ const NORMAL_TO_LAMA = {
|
|
|
38
38
|
auraB_rETH_STABLE_vault: "a4b5b995-99e7-4b8f-916d-8940b5627d70",
|
|
39
39
|
sUSDe: "66985a81-9c51-46ca-9977-42b4fe7bc6df",
|
|
40
40
|
},
|
|
41
|
-
Optimism: {},
|
|
41
|
+
Optimism: { rETH: "d4b3c522-6127-4b89-bedf-83641cdcd2eb" },
|
|
42
42
|
Arbitrum: {
|
|
43
43
|
rETH: "d4b3c522-6127-4b89-bedf-83641cdcd2eb",
|
|
44
44
|
cbETH: "0f45d730-b279-4629-8e11-ccb5cc3038b4",
|
|
@@ -6,7 +6,7 @@ type MainnetCreditManagersV2_1 = "WETH_V2_1";
|
|
|
6
6
|
type MainnetCreditManagersV3 = "USDC_V3_TRADE_TIER_1" | "USDC_V3_TRADE_TIER_2" | "USDC_V3_TRADE_TIER_3" | "WBTC_V3_TRADE_TIER_1" | "WBTC_V3_TRADE_TIER_2" | "WBTC_V3_TRADE_TIER_3" | "WETH_V3_TRADE_TIER_1" | "WETH_V3_TRADE_TIER_2" | "WETH_V3_TRADE_TIER_3" | "USDC_V3_FARM" | "WETH_V3_FARM" | "WETH_V3_RESTAKING" | "USDT_V3_TIER_1_BROKEN" | "GHO_V3_TIER_1" | "DAI_V3_TIER_1" | "USDT_V3_TIER_1";
|
|
7
7
|
export type MainnetCreditManagers = MainnetCreditManagersV1 | MainnetCreditManagersV2 | MainnetCreditManagersV2_1 | MainnetCreditManagersV3;
|
|
8
8
|
export type ArbitrumCreditManagers = "USDC_E_V3_TRADE_TIER_1" | "USDC_E_V3_TRADE_TIER_2" | "WETH_V3_TRADE_TIER_1" | "WETH_V3_TRADE_TIER_2";
|
|
9
|
-
export type OptimismCreditManagers =
|
|
9
|
+
export type OptimismCreditManagers = "USDC_E_V3_TRADE_TIER_1" | "USDC_E_V3_TRADE_TIER_2" | "WETH_V3_TRADE_TIER_1" | "WETH_V3_TRADE_TIER_2";
|
|
10
10
|
export type BaseCreditManagers = never;
|
|
11
11
|
type CreditManagersListType = {
|
|
12
12
|
[key in NetworkType]: key extends "Mainnet" ? Record<MainnetCreditManagers, string> : key extends "Arbitrum" ? Record<ArbitrumCreditManagers, string> : key extends "Optimism" ? Record<OptimismCreditManagers, string> : key extends "Base" ? Record<BaseCreditManagers, string> : never;
|
|
@@ -18,7 +18,7 @@ export type MainnetPoolsV1 = "DAI_V1" | "USDC_V1" | "WETH_V1" | "WBTC_V1" | "WST
|
|
|
18
18
|
export type MainnetPoolsV3 = "USDC_V3_TRADE" | "WETH_V3_TRADE" | "WBTC_V3_TRADE" | "USDT_V3_BROKEN" | "GHO_V3" | "DAI_V3" | "USDT_V3";
|
|
19
19
|
export type MainnetPools = MainnetPoolsV1 | MainnetPoolsV3;
|
|
20
20
|
export type ArbitrumPools = "USDC_V3" | "WETH_V3";
|
|
21
|
-
export type OptimismPools =
|
|
21
|
+
export type OptimismPools = "USDC_V3" | "WETH_V3";
|
|
22
22
|
export type BasePools = never;
|
|
23
23
|
type PoolsListType = {
|
|
24
24
|
[key in NetworkType]: key extends "Mainnet" ? Record<MainnetPools, string> : key extends "Arbitrum" ? Record<ArbitrumPools, string> : key extends "Optimism" ? Record<OptimismPools, string> : key extends "Base" ? Record<BasePools, string> : never;
|
|
@@ -44,7 +44,12 @@ exports.creditManagerByNetwork = {
|
|
|
44
44
|
WETH_V3_TRADE_TIER_1: "0xcedaa4b4a42c0a771f6c24a3745c3ca3ed73f17a".toLowerCase(),
|
|
45
45
|
WETH_V3_TRADE_TIER_2: "0x3ab1d35500d2da4216f5863229a7b81e2f6ff976".toLowerCase(),
|
|
46
46
|
},
|
|
47
|
-
Optimism: {
|
|
47
|
+
Optimism: {
|
|
48
|
+
USDC_E_V3_TRADE_TIER_1: "0xab260a0acbee82db69e61221a57aff302a2a83d9".toLowerCase(),
|
|
49
|
+
USDC_E_V3_TRADE_TIER_2: "0xbd71b3e744a0f9a6f8405479118ff2f42118463a".toLowerCase(),
|
|
50
|
+
WETH_V3_TRADE_TIER_1: "0xf9fbdf90c4503055b82643c53f2daf78c619c72b".toLowerCase(),
|
|
51
|
+
WETH_V3_TRADE_TIER_2: "0x66e033fc1504a1be084ddff50333039945bc8a7d".toLowerCase(),
|
|
52
|
+
},
|
|
48
53
|
Base: {},
|
|
49
54
|
};
|
|
50
55
|
exports.creditManagerByAddress = sdk_gov_1.TypedObjectUtils.entries(exports.creditManagerByNetwork).reduce((acc, [, cms]) => ({
|
|
@@ -73,7 +78,10 @@ exports.poolByNetwork = {
|
|
|
73
78
|
USDC_V3: "0xa76c604145d7394dec36c49af494c144ff327861".toLowerCase(),
|
|
74
79
|
WETH_V3: "0x04419d3509f13054f60d253e0c79491d9e683399".toLowerCase(),
|
|
75
80
|
},
|
|
76
|
-
Optimism: {
|
|
81
|
+
Optimism: {
|
|
82
|
+
USDC_V3: "0x5520daa93a187f4ec67344e6d2c4fc9b080b6a35".toLowerCase(),
|
|
83
|
+
WETH_V3: "0x6b0c5a7efd43c1d0cf114518b11865d0f4aaacbb".toLowerCase(),
|
|
84
|
+
},
|
|
77
85
|
Base: {},
|
|
78
86
|
};
|
|
79
87
|
const deployedContractNames = {
|
|
@@ -32,7 +32,7 @@ export declare class RewardConvex {
|
|
|
32
32
|
auraDistribution: DistributionList;
|
|
33
33
|
convexCalls: CallsList;
|
|
34
34
|
auraCalls: CallsList;
|
|
35
|
-
};
|
|
35
|
+
} | undefined;
|
|
36
36
|
static parseResults({ convexDistribution, convexResponse, convexTotalSupply, auraDistribution, auraResponse, auraTotalSupply, }: ParseProps): Array<Rewards>;
|
|
37
37
|
static getRewardObject(baseReward: bigint, baseDistribution: RewardDistribution, boostedRewardToken: SupportedToken, extraDistribution: Array<RewardDistribution>, rewardsResp: Array<BigNumber>, totalSupply: bigint, callData: string, multiplier: bigint): Rewards | undefined;
|
|
38
38
|
static getBaseRewardToken(protocol: Protocols): SupportedToken | undefined;
|
package/lib/core/rewardConvex.js
CHANGED
|
@@ -10,10 +10,16 @@ const types_1 = require("../types");
|
|
|
10
10
|
class RewardConvex {
|
|
11
11
|
static poolInterface = types_1.IBaseRewardPool__factory.createInterface();
|
|
12
12
|
static async findRewards(ca, cm, network, provider) {
|
|
13
|
-
const
|
|
13
|
+
const prepared = RewardConvex.prepareMultiCalls(ca.addr, cm, network);
|
|
14
|
+
if (!prepared)
|
|
15
|
+
return [];
|
|
16
|
+
const { auraCalls, auraDistribution, convexCalls, convexDistribution } = prepared;
|
|
14
17
|
const auraTotal = auraCalls.flat(1);
|
|
15
18
|
const convexTotal = convexCalls.flat(1);
|
|
16
|
-
const
|
|
19
|
+
const allCalls = [...auraTotal, ...convexTotal];
|
|
20
|
+
if (allCalls.length === 0)
|
|
21
|
+
return [];
|
|
22
|
+
const response = await (0, sdk_gov_1.multicall)(allCalls, provider);
|
|
17
23
|
const auraEnd = auraTotal.length;
|
|
18
24
|
const [auraTotalSupply, ...auraResponse] = response.slice(0, auraEnd);
|
|
19
25
|
const convexEnd = auraEnd + convexTotal.length;
|
|
@@ -42,6 +48,9 @@ class RewardConvex {
|
|
|
42
48
|
const tokens = sdk_gov_1.tokenDataByNetwork[network];
|
|
43
49
|
const contracts = sdk_gov_1.contractsByNetwork[network];
|
|
44
50
|
const adapters = this.findAdapters(cm);
|
|
51
|
+
if (adapters.length === 0) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
45
54
|
const res = adapters.reduce((acc, a) => {
|
|
46
55
|
const currentContract = sdk_gov_1.contractParams[a.contract];
|
|
47
56
|
const baseRewardToken = this.getBaseRewardToken(currentContract.protocol);
|
|
@@ -63,8 +63,8 @@ describe("RewardConvex test", () => {
|
|
|
63
63
|
},
|
|
64
64
|
];
|
|
65
65
|
const result = rewardConvex_1.RewardConvex.prepareMultiCalls(CREDIT_ACCOUNT, cm, "Mainnet");
|
|
66
|
-
(0, chai_1.expect)(result
|
|
67
|
-
(0, chai_1.expect)(result
|
|
66
|
+
(0, chai_1.expect)(result?.convexDistribution).to.be.eql([distribution]);
|
|
67
|
+
(0, chai_1.expect)(result?.convexCalls).to.be.eql(calls);
|
|
68
68
|
});
|
|
69
69
|
it("parseResults parse data correctly", () => {
|
|
70
70
|
const rewards = [ethers_1.BigNumber.from(1000n)];
|
|
@@ -12,6 +12,8 @@ export interface IConvexV1BaseRewardPoolAdapterInterface extends utils.Interface
|
|
|
12
12
|
"curveLPtoken()": FunctionFragment;
|
|
13
13
|
"extraReward1()": FunctionFragment;
|
|
14
14
|
"extraReward2()": FunctionFragment;
|
|
15
|
+
"extraReward3()": FunctionFragment;
|
|
16
|
+
"extraReward4()": FunctionFragment;
|
|
15
17
|
"getReward()": FunctionFragment;
|
|
16
18
|
"rewardTokensMask()": FunctionFragment;
|
|
17
19
|
"stake(uint256)": FunctionFragment;
|
|
@@ -26,7 +28,7 @@ export interface IConvexV1BaseRewardPoolAdapterInterface extends utils.Interface
|
|
|
26
28
|
"withdrawDiff(uint256,bool)": FunctionFragment;
|
|
27
29
|
"withdrawDiffAndUnwrap(uint256,bool)": FunctionFragment;
|
|
28
30
|
};
|
|
29
|
-
getFunction(nameOrSignatureOrTopic: "_gearboxAdapterType" | "_gearboxAdapterVersion" | "addressProvider" | "creditManager" | "curveLPTokenMask" | "curveLPtoken" | "extraReward1" | "extraReward2" | "getReward" | "rewardTokensMask" | "stake" | "stakeDiff" | "stakedPhantomToken" | "stakedTokenMask" | "stakingToken" | "stakingTokenMask" | "targetContract" | "withdraw" | "withdrawAndUnwrap" | "withdrawDiff" | "withdrawDiffAndUnwrap"): FunctionFragment;
|
|
31
|
+
getFunction(nameOrSignatureOrTopic: "_gearboxAdapterType" | "_gearboxAdapterVersion" | "addressProvider" | "creditManager" | "curveLPTokenMask" | "curveLPtoken" | "extraReward1" | "extraReward2" | "extraReward3" | "extraReward4" | "getReward" | "rewardTokensMask" | "stake" | "stakeDiff" | "stakedPhantomToken" | "stakedTokenMask" | "stakingToken" | "stakingTokenMask" | "targetContract" | "withdraw" | "withdrawAndUnwrap" | "withdrawDiff" | "withdrawDiffAndUnwrap"): FunctionFragment;
|
|
30
32
|
encodeFunctionData(functionFragment: "_gearboxAdapterType", values?: undefined): string;
|
|
31
33
|
encodeFunctionData(functionFragment: "_gearboxAdapterVersion", values?: undefined): string;
|
|
32
34
|
encodeFunctionData(functionFragment: "addressProvider", values?: undefined): string;
|
|
@@ -35,6 +37,8 @@ export interface IConvexV1BaseRewardPoolAdapterInterface extends utils.Interface
|
|
|
35
37
|
encodeFunctionData(functionFragment: "curveLPtoken", values?: undefined): string;
|
|
36
38
|
encodeFunctionData(functionFragment: "extraReward1", values?: undefined): string;
|
|
37
39
|
encodeFunctionData(functionFragment: "extraReward2", values?: undefined): string;
|
|
40
|
+
encodeFunctionData(functionFragment: "extraReward3", values?: undefined): string;
|
|
41
|
+
encodeFunctionData(functionFragment: "extraReward4", values?: undefined): string;
|
|
38
42
|
encodeFunctionData(functionFragment: "getReward", values?: undefined): string;
|
|
39
43
|
encodeFunctionData(functionFragment: "rewardTokensMask", values?: undefined): string;
|
|
40
44
|
encodeFunctionData(functionFragment: "stake", values: [PromiseOrValue<BigNumberish>]): string;
|
|
@@ -56,6 +60,8 @@ export interface IConvexV1BaseRewardPoolAdapterInterface extends utils.Interface
|
|
|
56
60
|
decodeFunctionResult(functionFragment: "curveLPtoken", data: BytesLike): Result;
|
|
57
61
|
decodeFunctionResult(functionFragment: "extraReward1", data: BytesLike): Result;
|
|
58
62
|
decodeFunctionResult(functionFragment: "extraReward2", data: BytesLike): Result;
|
|
63
|
+
decodeFunctionResult(functionFragment: "extraReward3", data: BytesLike): Result;
|
|
64
|
+
decodeFunctionResult(functionFragment: "extraReward4", data: BytesLike): Result;
|
|
59
65
|
decodeFunctionResult(functionFragment: "getReward", data: BytesLike): Result;
|
|
60
66
|
decodeFunctionResult(functionFragment: "rewardTokensMask", data: BytesLike): Result;
|
|
61
67
|
decodeFunctionResult(functionFragment: "stake", data: BytesLike): Result;
|
|
@@ -94,6 +100,8 @@ export interface IConvexV1BaseRewardPoolAdapter extends BaseContract {
|
|
|
94
100
|
curveLPtoken(overrides?: CallOverrides): Promise<[string]>;
|
|
95
101
|
extraReward1(overrides?: CallOverrides): Promise<[string]>;
|
|
96
102
|
extraReward2(overrides?: CallOverrides): Promise<[string]>;
|
|
103
|
+
extraReward3(overrides?: CallOverrides): Promise<[string]>;
|
|
104
|
+
extraReward4(overrides?: CallOverrides): Promise<[string]>;
|
|
97
105
|
getReward(overrides?: Overrides & {
|
|
98
106
|
from?: PromiseOrValue<string>;
|
|
99
107
|
}): Promise<ContractTransaction>;
|
|
@@ -130,6 +138,8 @@ export interface IConvexV1BaseRewardPoolAdapter extends BaseContract {
|
|
|
130
138
|
curveLPtoken(overrides?: CallOverrides): Promise<string>;
|
|
131
139
|
extraReward1(overrides?: CallOverrides): Promise<string>;
|
|
132
140
|
extraReward2(overrides?: CallOverrides): Promise<string>;
|
|
141
|
+
extraReward3(overrides?: CallOverrides): Promise<string>;
|
|
142
|
+
extraReward4(overrides?: CallOverrides): Promise<string>;
|
|
133
143
|
getReward(overrides?: Overrides & {
|
|
134
144
|
from?: PromiseOrValue<string>;
|
|
135
145
|
}): Promise<ContractTransaction>;
|
|
@@ -166,6 +176,8 @@ export interface IConvexV1BaseRewardPoolAdapter extends BaseContract {
|
|
|
166
176
|
curveLPtoken(overrides?: CallOverrides): Promise<string>;
|
|
167
177
|
extraReward1(overrides?: CallOverrides): Promise<string>;
|
|
168
178
|
extraReward2(overrides?: CallOverrides): Promise<string>;
|
|
179
|
+
extraReward3(overrides?: CallOverrides): Promise<string>;
|
|
180
|
+
extraReward4(overrides?: CallOverrides): Promise<string>;
|
|
169
181
|
getReward(overrides?: CallOverrides): Promise<[
|
|
170
182
|
BigNumber,
|
|
171
183
|
BigNumber
|
|
@@ -232,6 +244,8 @@ export interface IConvexV1BaseRewardPoolAdapter extends BaseContract {
|
|
|
232
244
|
curveLPtoken(overrides?: CallOverrides): Promise<BigNumber>;
|
|
233
245
|
extraReward1(overrides?: CallOverrides): Promise<BigNumber>;
|
|
234
246
|
extraReward2(overrides?: CallOverrides): Promise<BigNumber>;
|
|
247
|
+
extraReward3(overrides?: CallOverrides): Promise<BigNumber>;
|
|
248
|
+
extraReward4(overrides?: CallOverrides): Promise<BigNumber>;
|
|
235
249
|
getReward(overrides?: Overrides & {
|
|
236
250
|
from?: PromiseOrValue<string>;
|
|
237
251
|
}): Promise<BigNumber>;
|
|
@@ -269,6 +283,8 @@ export interface IConvexV1BaseRewardPoolAdapter extends BaseContract {
|
|
|
269
283
|
curveLPtoken(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
270
284
|
extraReward1(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
271
285
|
extraReward2(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
286
|
+
extraReward3(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
287
|
+
extraReward4(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
272
288
|
getReward(overrides?: Overrides & {
|
|
273
289
|
from?: PromiseOrValue<string>;
|
|
274
290
|
}): Promise<PopulatedTransaction>;
|
|
@@ -82,6 +82,26 @@ export declare class IConvexV1BaseRewardPoolAdapter__factory {
|
|
|
82
82
|
readonly internalType: "address";
|
|
83
83
|
}];
|
|
84
84
|
readonly stateMutability: "view";
|
|
85
|
+
}, {
|
|
86
|
+
readonly type: "function";
|
|
87
|
+
readonly name: "extraReward3";
|
|
88
|
+
readonly inputs: readonly [];
|
|
89
|
+
readonly outputs: readonly [{
|
|
90
|
+
readonly name: "";
|
|
91
|
+
readonly type: "address";
|
|
92
|
+
readonly internalType: "address";
|
|
93
|
+
}];
|
|
94
|
+
readonly stateMutability: "view";
|
|
95
|
+
}, {
|
|
96
|
+
readonly type: "function";
|
|
97
|
+
readonly name: "extraReward4";
|
|
98
|
+
readonly inputs: readonly [];
|
|
99
|
+
readonly outputs: readonly [{
|
|
100
|
+
readonly name: "";
|
|
101
|
+
readonly type: "address";
|
|
102
|
+
readonly internalType: "address";
|
|
103
|
+
}];
|
|
104
|
+
readonly stateMutability: "view";
|
|
85
105
|
}, {
|
|
86
106
|
readonly type: "function";
|
|
87
107
|
readonly name: "getReward";
|
|
@@ -110,6 +110,32 @@ const _abi = [
|
|
|
110
110
|
],
|
|
111
111
|
stateMutability: "view",
|
|
112
112
|
},
|
|
113
|
+
{
|
|
114
|
+
type: "function",
|
|
115
|
+
name: "extraReward3",
|
|
116
|
+
inputs: [],
|
|
117
|
+
outputs: [
|
|
118
|
+
{
|
|
119
|
+
name: "",
|
|
120
|
+
type: "address",
|
|
121
|
+
internalType: "address",
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
stateMutability: "view",
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
type: "function",
|
|
128
|
+
name: "extraReward4",
|
|
129
|
+
inputs: [],
|
|
130
|
+
outputs: [
|
|
131
|
+
{
|
|
132
|
+
name: "",
|
|
133
|
+
type: "address",
|
|
134
|
+
internalType: "address",
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
stateMutability: "view",
|
|
138
|
+
},
|
|
113
139
|
{
|
|
114
140
|
type: "function",
|
|
115
141
|
name: "getReward",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/sdk",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.155",
|
|
4
4
|
"description": "Gearbox SDK",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"@commitlint/cli": "^17.6.3",
|
|
43
43
|
"@commitlint/config-conventional": "^17.0.3",
|
|
44
44
|
"@gearbox-protocol/core-v2": "1.19.0-base.17",
|
|
45
|
-
"@gearbox-protocol/core-v3": "^1.
|
|
45
|
+
"@gearbox-protocol/core-v3": "^1.49.5",
|
|
46
46
|
"@gearbox-protocol/eslint-config": "^1.4.1",
|
|
47
|
-
"@gearbox-protocol/integrations-v3": "^1.
|
|
47
|
+
"@gearbox-protocol/integrations-v3": "^1.40.2",
|
|
48
48
|
"@gearbox-protocol/oracles-v3": "^1.10.3",
|
|
49
49
|
"@gearbox-protocol/periphery-v3": "^1.6.1",
|
|
50
50
|
"@gearbox-protocol/prettier-config": "^1.4.1",
|
|
51
51
|
"@gearbox-protocol/router": "^1.5.5",
|
|
52
|
-
"@gearbox-protocol/router-v3": "^1.
|
|
52
|
+
"@gearbox-protocol/router-v3": "^1.21.3",
|
|
53
53
|
"@openzeppelin/contracts": "^4.9.3",
|
|
54
54
|
"@redstone-finance/evm-connector": "^0.3.6",
|
|
55
55
|
"@typechain/ethers-v5": "^10.1.0",
|