@gearbox-protocol/sdk 1.23.0 → 1.23.1
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.
|
@@ -8,7 +8,7 @@ import { CreditAccountData } from "./creditAccount";
|
|
|
8
8
|
import { CreditManagerData } from "./creditManager";
|
|
9
9
|
import { AdapterWithType, Rewards } from "./rewardClaimer";
|
|
10
10
|
export interface RewardDistribution {
|
|
11
|
-
|
|
11
|
+
contractAddress: string;
|
|
12
12
|
contract: SupportedContract;
|
|
13
13
|
token: SupportedToken;
|
|
14
14
|
}
|
package/lib/core/rewardConvex.js
CHANGED
|
@@ -31,8 +31,8 @@ class RewardConvex {
|
|
|
31
31
|
.filter(([_, params]) => params.type === adapters_1.AdapterInterface.CONVEX_V1_BASE_REWARD_POOL)
|
|
32
32
|
.map(([contract]) => contract);
|
|
33
33
|
return Object.entries(cm.adapters)
|
|
34
|
-
.map(([contract
|
|
35
|
-
|
|
34
|
+
.map(([contract]) => ({
|
|
35
|
+
contractAddress: contract,
|
|
36
36
|
contract: contracts_1.contractsByAddress[contract.toLowerCase()],
|
|
37
37
|
}))
|
|
38
38
|
.filter(a => convexPools.includes(a.contract));
|
|
@@ -43,13 +43,13 @@ class RewardConvex {
|
|
|
43
43
|
const adapters = this.findAdapters(cm);
|
|
44
44
|
for (let a of adapters) {
|
|
45
45
|
calls.push({
|
|
46
|
-
address: a.
|
|
46
|
+
address: a.contractAddress,
|
|
47
47
|
interface: RewardConvex.poolInterface,
|
|
48
48
|
method: "earned(address)",
|
|
49
49
|
params: [creditAccount],
|
|
50
50
|
});
|
|
51
51
|
distribution.push({
|
|
52
|
-
|
|
52
|
+
contractAddress: a.contractAddress,
|
|
53
53
|
contract: a.contract,
|
|
54
54
|
token: "CRV",
|
|
55
55
|
});
|
|
@@ -62,7 +62,7 @@ class RewardConvex {
|
|
|
62
62
|
params: [creditAccount],
|
|
63
63
|
});
|
|
64
64
|
distribution.push({
|
|
65
|
-
|
|
65
|
+
contractAddress: a.contractAddress,
|
|
66
66
|
contract: a.contract,
|
|
67
67
|
token: er.rewardToken,
|
|
68
68
|
});
|
|
@@ -77,7 +77,7 @@ class RewardConvex {
|
|
|
77
77
|
const result = {};
|
|
78
78
|
const callData = RewardConvex.poolInterface.encodeFunctionData("getReward(address,bool)", [creditAccount, true]);
|
|
79
79
|
for (let i = 0; i < rewards.length; i++) {
|
|
80
|
-
const { contract,
|
|
80
|
+
const { contract, contractAddress, token } = distribution[i];
|
|
81
81
|
const reward = rewards[i];
|
|
82
82
|
if (!reward.isZero()) {
|
|
83
83
|
if (!result[contract]) {
|
|
@@ -86,7 +86,7 @@ class RewardConvex {
|
|
|
86
86
|
rewards: {},
|
|
87
87
|
calls: [
|
|
88
88
|
{
|
|
89
|
-
target:
|
|
89
|
+
target: contractAddress,
|
|
90
90
|
callData,
|
|
91
91
|
},
|
|
92
92
|
],
|
|
@@ -20,12 +20,12 @@ describe("RewardConvex test", () => {
|
|
|
20
20
|
};
|
|
21
21
|
const expectedResult = [
|
|
22
22
|
{
|
|
23
|
-
adapter: ADAPTER_CONVEX_3CRV_POOL,
|
|
24
23
|
contract: "CONVEX_3CRV_POOL",
|
|
24
|
+
contractAddress: contracts_1.contractsByNetwork.Mainnet.CONVEX_3CRV_POOL,
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
|
-
adapter: ADAPTER_CONVEX_FRAX3CRV_POOL,
|
|
28
27
|
contract: "CONVEX_FRAX3CRV_POOL",
|
|
28
|
+
contractAddress: contracts_1.contractsByNetwork.Goerli.CONVEX_FRAX3CRV_POOL,
|
|
29
29
|
},
|
|
30
30
|
];
|
|
31
31
|
const result = rewardConvex_1.RewardConvex.findAdapters(cm);
|
|
@@ -41,13 +41,13 @@ describe("RewardConvex test", () => {
|
|
|
41
41
|
};
|
|
42
42
|
const calls = [
|
|
43
43
|
{
|
|
44
|
-
address:
|
|
44
|
+
address: contracts_1.contractsByNetwork.Mainnet.CONVEX_3CRV_POOL,
|
|
45
45
|
interface: rewardConvex_1.RewardConvex.poolInterface,
|
|
46
46
|
method: "earned(address)",
|
|
47
47
|
params: [CREDIT_ACCOUNT],
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
|
-
address:
|
|
50
|
+
address: contracts_1.contractsByNetwork.Goerli.CONVEX_FRAX3CRV_POOL,
|
|
51
51
|
interface: rewardConvex_1.RewardConvex.poolInterface,
|
|
52
52
|
method: "earned(address)",
|
|
53
53
|
params: [CREDIT_ACCOUNT],
|
|
@@ -62,17 +62,17 @@ describe("RewardConvex test", () => {
|
|
|
62
62
|
];
|
|
63
63
|
const distribution = [
|
|
64
64
|
{
|
|
65
|
-
|
|
65
|
+
contractAddress: contracts_1.contractsByNetwork.Mainnet.CONVEX_3CRV_POOL,
|
|
66
66
|
contract: "CONVEX_3CRV_POOL",
|
|
67
67
|
token: "CRV",
|
|
68
68
|
},
|
|
69
69
|
{
|
|
70
|
-
|
|
70
|
+
contractAddress: contracts_1.contractsByNetwork.Goerli.CONVEX_FRAX3CRV_POOL,
|
|
71
71
|
contract: "CONVEX_FRAX3CRV_POOL",
|
|
72
72
|
token: "CRV",
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
|
-
|
|
75
|
+
contractAddress: contracts_1.contractsByNetwork.Goerli.CONVEX_FRAX3CRV_POOL,
|
|
76
76
|
contract: "CONVEX_FRAX3CRV_POOL",
|
|
77
77
|
token: "FXS",
|
|
78
78
|
},
|
|
@@ -82,23 +82,23 @@ describe("RewardConvex test", () => {
|
|
|
82
82
|
});
|
|
83
83
|
it("parseResults parse data correctly", () => {
|
|
84
84
|
const rewards = [
|
|
85
|
-
ethers_1.BigNumber.from(
|
|
86
|
-
ethers_1.BigNumber.from(
|
|
87
|
-
ethers_1.BigNumber.from(
|
|
85
|
+
ethers_1.BigNumber.from(1000n),
|
|
86
|
+
ethers_1.BigNumber.from(2000n),
|
|
87
|
+
ethers_1.BigNumber.from(4000n),
|
|
88
88
|
];
|
|
89
89
|
const distribution = [
|
|
90
90
|
{
|
|
91
|
-
|
|
91
|
+
contractAddress: contracts_1.contractsByNetwork.Mainnet.CONVEX_3CRV_POOL,
|
|
92
92
|
contract: "CONVEX_3CRV_POOL",
|
|
93
93
|
token: "CRV",
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
|
-
|
|
96
|
+
contractAddress: contracts_1.contractsByNetwork.Goerli.CONVEX_FRAX3CRV_POOL,
|
|
97
97
|
contract: "CONVEX_FRAX3CRV_POOL",
|
|
98
98
|
token: "CRV",
|
|
99
99
|
},
|
|
100
100
|
{
|
|
101
|
-
|
|
101
|
+
contractAddress: contracts_1.contractsByNetwork.Goerli.CONVEX_FRAX3CRV_POOL,
|
|
102
102
|
contract: "CONVEX_FRAX3CRV_POOL",
|
|
103
103
|
token: "FXS",
|
|
104
104
|
},
|
|
@@ -113,7 +113,7 @@ describe("RewardConvex test", () => {
|
|
|
113
113
|
},
|
|
114
114
|
calls: [
|
|
115
115
|
{
|
|
116
|
-
target:
|
|
116
|
+
target: contracts_1.contractsByNetwork.Mainnet.CONVEX_3CRV_POOL,
|
|
117
117
|
callData,
|
|
118
118
|
},
|
|
119
119
|
],
|
|
@@ -126,7 +126,7 @@ describe("RewardConvex test", () => {
|
|
|
126
126
|
},
|
|
127
127
|
calls: [
|
|
128
128
|
{
|
|
129
|
-
target:
|
|
129
|
+
target: contracts_1.contractsByNetwork.Goerli.CONVEX_FRAX3CRV_POOL,
|
|
130
130
|
callData,
|
|
131
131
|
},
|
|
132
132
|
],
|