@gearbox-protocol/sdk 3.0.0-next.43 → 3.0.0-next.45
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/contracts/index.sol +2 -2
- package/lib/core/gaugeMath.d.ts +40 -0
- package/lib/core/gaugeMath.js +108 -0
- package/lib/core/gaugeMath.spec.d.ts +1 -0
- package/lib/core/gaugeMath.spec.js +388 -0
- package/lib/core/transactions.d.ts +14 -1
- package/lib/core/transactions.js +24 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/types/{IERC20Zapper.d.ts → IERC20ZapperDeposits.d.ts} +3 -3
- package/lib/types/{IETHZapper.d.ts → IETHZapperDeposits.d.ts} +3 -3
- package/lib/types/factories/{IERC20Zapper__factory.d.ts → IERC20ZapperDeposits__factory.d.ts} +4 -4
- package/lib/types/factories/{IERC20Zapper__factory.js → IERC20ZapperDeposits__factory.js} +3 -3
- package/lib/types/factories/{IETHZapper__factory.d.ts → IETHZapperDeposits__factory.d.ts} +4 -4
- package/lib/types/factories/{IETHZapper__factory.js → IETHZapperDeposits__factory.js} +3 -3
- package/lib/types/factories/index.d.ts +2 -2
- package/lib/types/factories/index.js +5 -5
- package/lib/types/index.d.ts +4 -4
- package/lib/types/index.js +5 -5
- package/package.json +4 -4
- /package/lib/types/{IERC20Zapper.js → IERC20ZapperDeposits.js} +0 -0
- /package/lib/types/{IETHZapper.js → IETHZapperDeposits.js} +0 -0
package/contracts/index.sol
CHANGED
|
@@ -12,8 +12,8 @@ import {ICreditFacadeV3} from "@gearbox-protocol/core-v3/contracts/interfaces/IC
|
|
|
12
12
|
import {IPoolService} from "@gearbox-protocol/core-v2/contracts/interfaces/IPoolService.sol";
|
|
13
13
|
import {ICreditFacadeV2} from "@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacadeV2.sol";
|
|
14
14
|
import {ICreditConfiguratorV2} from "@gearbox-protocol/core-v2/contracts/interfaces/ICreditConfiguratorV2.sol";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
15
|
+
import {IERC20ZapperDeposits} from "@gearbox-protocol/integrations-v3/contracts/interfaces/zappers/IERC20ZapperDeposits.sol";
|
|
16
|
+
import {IETHZapperDeposits} from "@gearbox-protocol/integrations-v3/contracts/interfaces/zappers/IETHZapperDeposits.sol";
|
|
17
17
|
import {IZapper} from "@gearbox-protocol/integrations-v3/contracts/interfaces/zappers/IZapper.sol";
|
|
18
18
|
|
|
19
19
|
import {IGearStakingV3} from "@gearbox-protocol/core-v3/contracts/interfaces/IGearStakingV3.sol";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { GaugeQuotaParams } from "../payload/gauge";
|
|
2
|
+
export type BaseVoteType = "raise" | "lower";
|
|
3
|
+
export type VoteType = BaseVoteType | "remove";
|
|
4
|
+
export interface BaseVote {
|
|
5
|
+
amount: bigint;
|
|
6
|
+
type: BaseVoteType;
|
|
7
|
+
}
|
|
8
|
+
export interface Vote {
|
|
9
|
+
amount: bigint;
|
|
10
|
+
type: VoteType;
|
|
11
|
+
}
|
|
12
|
+
export interface SingleVoteState {
|
|
13
|
+
available: bigint;
|
|
14
|
+
vote?: BaseVote;
|
|
15
|
+
voteCalls: Array<Vote>;
|
|
16
|
+
}
|
|
17
|
+
export interface VoteProps {
|
|
18
|
+
state: Omit<SingleVoteState, "voteCalls">;
|
|
19
|
+
change?: Vote;
|
|
20
|
+
}
|
|
21
|
+
interface UnvoteProps {
|
|
22
|
+
initialVote?: BaseVote;
|
|
23
|
+
balanceAfter: bigint;
|
|
24
|
+
nextVoteType: BaseVoteType;
|
|
25
|
+
voteAfter?: Omit<SingleVoteState, "available">;
|
|
26
|
+
}
|
|
27
|
+
export interface GetGaugeApyProps {
|
|
28
|
+
quota: Pick<GaugeQuotaParams, "totalVotesCaSide" | "totalVotesLpSide" | "stakerVotesCaSide" | "stakerVotesLpSide" | "minRate" | "maxRate"> | undefined;
|
|
29
|
+
vote?: BaseVote;
|
|
30
|
+
voteAfter?: Omit<SingleVoteState, "available">;
|
|
31
|
+
}
|
|
32
|
+
export declare class GaugeMath {
|
|
33
|
+
static vote({ change, ...rest }: VoteProps): SingleVoteState | undefined;
|
|
34
|
+
private static addVotes;
|
|
35
|
+
private static removeVotes;
|
|
36
|
+
static revertVote({ balanceAfter, initialVote, nextVoteType, voteAfter, }: UnvoteProps): bigint | undefined;
|
|
37
|
+
static getBaseVote: (v: GaugeQuotaParams) => BaseVote | undefined;
|
|
38
|
+
static getGaugeApy({ quota, voteAfter, vote }: GetGaugeApyProps): number | null;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GaugeMath = void 0;
|
|
4
|
+
const sdk_gov_1 = require("@gearbox-protocol/sdk-gov");
|
|
5
|
+
const math_1 = require("../utils/math");
|
|
6
|
+
class GaugeMath {
|
|
7
|
+
static vote({ change, ...rest }) {
|
|
8
|
+
if (change?.type === "remove") {
|
|
9
|
+
return this.removeVotes({ ...rest, change });
|
|
10
|
+
}
|
|
11
|
+
if (change) {
|
|
12
|
+
return this.addVotes({
|
|
13
|
+
...rest,
|
|
14
|
+
change: { ...change, type: change.type },
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return { ...rest.state, voteCalls: [] };
|
|
18
|
+
}
|
|
19
|
+
static addVotes({ state, change }) {
|
|
20
|
+
const { available, vote } = state;
|
|
21
|
+
if (!vote) {
|
|
22
|
+
return {
|
|
23
|
+
available: available - change.amount,
|
|
24
|
+
vote: change,
|
|
25
|
+
voteCalls: [change],
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
if (vote.type === change.type) {
|
|
29
|
+
return {
|
|
30
|
+
available: available - change.amount,
|
|
31
|
+
vote: { ...change, amount: vote.amount + change.amount },
|
|
32
|
+
voteCalls: [change],
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const remove = { type: "remove", amount: vote.amount };
|
|
36
|
+
return {
|
|
37
|
+
available: available + vote.amount - change.amount,
|
|
38
|
+
vote: { ...change, amount: change.amount },
|
|
39
|
+
voteCalls: [remove, change],
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
static removeVotes({ state, change }) {
|
|
43
|
+
const { available, vote } = state;
|
|
44
|
+
if (!vote)
|
|
45
|
+
return { ...state, voteCalls: [] };
|
|
46
|
+
const safeChange = math_1.BigIntMath.min(vote.amount, change.amount);
|
|
47
|
+
const afterVote = vote.amount - safeChange;
|
|
48
|
+
return {
|
|
49
|
+
available: available + safeChange,
|
|
50
|
+
vote: { ...vote, amount: afterVote },
|
|
51
|
+
voteCalls: [{ ...change, amount: safeChange }],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
static revertVote({ balanceAfter, initialVote, nextVoteType, voteAfter, }) {
|
|
55
|
+
// on vote type change unvote previous vote
|
|
56
|
+
const prevUnvoted = !initialVote || initialVote.type === nextVoteType
|
|
57
|
+
? balanceAfter
|
|
58
|
+
: balanceAfter + initialVote.amount;
|
|
59
|
+
if (!voteAfter)
|
|
60
|
+
return prevUnvoted;
|
|
61
|
+
// change call is always last, remove is always first
|
|
62
|
+
const [first, last = first] = voteAfter.voteCalls;
|
|
63
|
+
const removePart = first?.type === "remove" ? first?.amount || 0n : 0n;
|
|
64
|
+
const addPart = last?.type !== "remove" ? last?.amount || 0n : 0n;
|
|
65
|
+
// revert current changes
|
|
66
|
+
return prevUnvoted + addPart - removePart;
|
|
67
|
+
}
|
|
68
|
+
static getBaseVote = (v) => {
|
|
69
|
+
const voteDown = v.stakerVotesCaSide;
|
|
70
|
+
const voteUp = v.stakerVotesLpSide;
|
|
71
|
+
if (!voteDown && !voteUp)
|
|
72
|
+
return undefined;
|
|
73
|
+
if (voteDown > 0) {
|
|
74
|
+
return { type: "lower", amount: voteDown };
|
|
75
|
+
}
|
|
76
|
+
if (voteUp > 0) {
|
|
77
|
+
return { type: "raise", amount: voteUp };
|
|
78
|
+
}
|
|
79
|
+
return undefined;
|
|
80
|
+
};
|
|
81
|
+
// rate = (minRate *(votesFormin + yourvotesformin) +maxRate*(votesFormax +yourvotesformax)/( votesForMin + votesForMax+yourvotes)
|
|
82
|
+
static getGaugeApy({ quota, voteAfter, vote }) {
|
|
83
|
+
if (!quota)
|
|
84
|
+
return null;
|
|
85
|
+
const first = voteAfter?.voteCalls?.[0];
|
|
86
|
+
const last = voteAfter?.voteCalls?.[1] || first;
|
|
87
|
+
const isRemove = first?.type === "remove";
|
|
88
|
+
const removeCaPart = isRemove && vote?.type === "lower" ? first?.amount || 0n : 0n;
|
|
89
|
+
const removeLpPart = isRemove && vote?.type === "raise" ? first?.amount || 0n : 0n;
|
|
90
|
+
const caPart = last?.type === "lower" ? last?.amount || 0n : 0n;
|
|
91
|
+
const lpPart = last?.type === "raise" ? last?.amount || 0n : 0n;
|
|
92
|
+
const caImpact = (0, sdk_gov_1.toBigInt)(quota.minRate) *
|
|
93
|
+
(quota.totalVotesCaSide + caPart - removeCaPart);
|
|
94
|
+
const lpImpact = (0, sdk_gov_1.toBigInt)(quota.maxRate) *
|
|
95
|
+
(quota.totalVotesLpSide + lpPart - removeLpPart);
|
|
96
|
+
const total = quota.totalVotesCaSide +
|
|
97
|
+
quota.totalVotesLpSide +
|
|
98
|
+
caPart +
|
|
99
|
+
lpPart -
|
|
100
|
+
removeCaPart -
|
|
101
|
+
removeLpPart;
|
|
102
|
+
if (total === 0n)
|
|
103
|
+
return quota.minRate;
|
|
104
|
+
const r = (caImpact + lpImpact) / total;
|
|
105
|
+
return Number(r);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
exports.GaugeMath = GaugeMath;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const chai_1 = require("chai");
|
|
4
|
+
const gaugeMath_1 = require("./gaugeMath");
|
|
5
|
+
describe("GaugeMath vote() test", () => {
|
|
6
|
+
it("with empty state and with no changes", () => {
|
|
7
|
+
const s = { available: 0n, voteCalls: [] };
|
|
8
|
+
const v = { state: s };
|
|
9
|
+
const r = gaugeMath_1.GaugeMath.vote(v);
|
|
10
|
+
const res = { ...s, voteCalls: [] };
|
|
11
|
+
(0, chai_1.expect)(r).to.be.eql(res);
|
|
12
|
+
});
|
|
13
|
+
it("remove with no prev vote", () => {
|
|
14
|
+
const s = { available: 0n, voteCalls: [] };
|
|
15
|
+
const v = { state: s, change: { type: "remove", amount: 10n } };
|
|
16
|
+
const r = gaugeMath_1.GaugeMath.vote(v);
|
|
17
|
+
const res = { ...s, voteCalls: [] };
|
|
18
|
+
(0, chai_1.expect)(r).to.be.eql(res);
|
|
19
|
+
});
|
|
20
|
+
it("remove with prev vote - more than available", () => {
|
|
21
|
+
const s = {
|
|
22
|
+
available: 0n,
|
|
23
|
+
vote: { type: "lower", amount: 5n },
|
|
24
|
+
voteCalls: [],
|
|
25
|
+
};
|
|
26
|
+
const v = { state: s, change: { type: "remove", amount: 10n } };
|
|
27
|
+
const r = gaugeMath_1.GaugeMath.vote(v);
|
|
28
|
+
const res = {
|
|
29
|
+
available: 5n,
|
|
30
|
+
vote: { type: "lower", amount: 0n },
|
|
31
|
+
voteCalls: [{ type: "remove", amount: 5n }],
|
|
32
|
+
};
|
|
33
|
+
(0, chai_1.expect)(r).to.be.eql(res);
|
|
34
|
+
});
|
|
35
|
+
it("remove with prev vote - eq than available", () => {
|
|
36
|
+
const s = {
|
|
37
|
+
available: 0n,
|
|
38
|
+
vote: { type: "lower", amount: 5n },
|
|
39
|
+
voteCalls: [],
|
|
40
|
+
};
|
|
41
|
+
const v = { state: s, change: { type: "remove", amount: 5n } };
|
|
42
|
+
const r = gaugeMath_1.GaugeMath.vote(v);
|
|
43
|
+
const res = {
|
|
44
|
+
available: 5n,
|
|
45
|
+
vote: { type: "lower", amount: 0n },
|
|
46
|
+
voteCalls: [{ type: "remove", amount: 5n }],
|
|
47
|
+
};
|
|
48
|
+
(0, chai_1.expect)(r).to.be.eql(res);
|
|
49
|
+
});
|
|
50
|
+
it("remove with prev vote - more than available", () => {
|
|
51
|
+
const s = {
|
|
52
|
+
available: 0n,
|
|
53
|
+
vote: { type: "lower", amount: 10n },
|
|
54
|
+
voteCalls: [],
|
|
55
|
+
};
|
|
56
|
+
const v = { state: s, change: { type: "remove", amount: 5n } };
|
|
57
|
+
const r = gaugeMath_1.GaugeMath.vote(v);
|
|
58
|
+
const res = {
|
|
59
|
+
available: 5n,
|
|
60
|
+
vote: { type: "lower", amount: 5n },
|
|
61
|
+
voteCalls: [{ type: "remove", amount: 5n }],
|
|
62
|
+
};
|
|
63
|
+
(0, chai_1.expect)(r).to.be.eql(res);
|
|
64
|
+
});
|
|
65
|
+
it("add to zero", () => {
|
|
66
|
+
const s = { available: 10n, voteCalls: [] };
|
|
67
|
+
const v = { state: s, change: { type: "lower", amount: 10n } };
|
|
68
|
+
const r = gaugeMath_1.GaugeMath.vote(v);
|
|
69
|
+
const res = {
|
|
70
|
+
available: 0n,
|
|
71
|
+
vote: { type: "lower", amount: 10n },
|
|
72
|
+
voteCalls: [{ type: "lower", amount: 10n }],
|
|
73
|
+
};
|
|
74
|
+
(0, chai_1.expect)(r).to.be.eql(res);
|
|
75
|
+
});
|
|
76
|
+
it("add to same type", () => {
|
|
77
|
+
const s = {
|
|
78
|
+
available: 10n,
|
|
79
|
+
vote: { type: "lower", amount: 5n },
|
|
80
|
+
voteCalls: [],
|
|
81
|
+
};
|
|
82
|
+
const v = { state: s, change: { type: "lower", amount: 10n } };
|
|
83
|
+
const r = gaugeMath_1.GaugeMath.vote(v);
|
|
84
|
+
const res = {
|
|
85
|
+
available: 0n,
|
|
86
|
+
vote: { type: "lower", amount: 15n },
|
|
87
|
+
voteCalls: [{ type: "lower", amount: 10n }],
|
|
88
|
+
};
|
|
89
|
+
(0, chai_1.expect)(r).to.be.eql(res);
|
|
90
|
+
});
|
|
91
|
+
it("add different type", () => {
|
|
92
|
+
const s = {
|
|
93
|
+
available: 10n,
|
|
94
|
+
vote: { type: "lower", amount: 10n },
|
|
95
|
+
voteCalls: [],
|
|
96
|
+
};
|
|
97
|
+
const v = { state: s, change: { type: "raise", amount: 5n } };
|
|
98
|
+
const r = gaugeMath_1.GaugeMath.vote(v);
|
|
99
|
+
const res = {
|
|
100
|
+
available: 15n,
|
|
101
|
+
vote: { type: "raise", amount: 5n },
|
|
102
|
+
voteCalls: [
|
|
103
|
+
{ type: "remove", amount: 10n },
|
|
104
|
+
{ type: "raise", amount: 5n },
|
|
105
|
+
],
|
|
106
|
+
};
|
|
107
|
+
(0, chai_1.expect)(r).to.be.eql(res);
|
|
108
|
+
});
|
|
109
|
+
it("available can be negative after add", () => {
|
|
110
|
+
const s = {
|
|
111
|
+
available: 5n,
|
|
112
|
+
vote: { type: "lower", amount: 5n },
|
|
113
|
+
voteCalls: [],
|
|
114
|
+
};
|
|
115
|
+
const v = { state: s, change: { type: "raise", amount: 15n } };
|
|
116
|
+
const r = gaugeMath_1.GaugeMath.vote(v);
|
|
117
|
+
const res = {
|
|
118
|
+
available: -5n,
|
|
119
|
+
vote: { type: "raise", amount: 15n },
|
|
120
|
+
voteCalls: [
|
|
121
|
+
{ type: "remove", amount: 5n },
|
|
122
|
+
{ type: "raise", amount: 15n },
|
|
123
|
+
],
|
|
124
|
+
};
|
|
125
|
+
(0, chai_1.expect)(r).to.be.eql(res);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
describe("GaugeMath revertVote() test", () => {
|
|
129
|
+
it("if no votes before & after, should return initial amount", () => {
|
|
130
|
+
const initialBalance = 21n;
|
|
131
|
+
const r = gaugeMath_1.GaugeMath.revertVote({
|
|
132
|
+
balanceAfter: initialBalance,
|
|
133
|
+
nextVoteType: "lower",
|
|
134
|
+
});
|
|
135
|
+
(0, chai_1.expect)(r).to.be.eql(initialBalance);
|
|
136
|
+
});
|
|
137
|
+
it("if no vote after and next expected type is not changed, should return initial amount", () => {
|
|
138
|
+
const initialBalance = 27n;
|
|
139
|
+
const initialVote = {
|
|
140
|
+
type: "lower",
|
|
141
|
+
amount: 99n,
|
|
142
|
+
};
|
|
143
|
+
const r = gaugeMath_1.GaugeMath.revertVote({
|
|
144
|
+
balanceAfter: initialBalance,
|
|
145
|
+
initialVote,
|
|
146
|
+
nextVoteType: "lower",
|
|
147
|
+
});
|
|
148
|
+
(0, chai_1.expect)(r).to.be.eql(initialBalance);
|
|
149
|
+
});
|
|
150
|
+
it("if no vote after and next expected type is changed, should revert initial vote", () => {
|
|
151
|
+
const initialBalance = 27n;
|
|
152
|
+
const initialVote = {
|
|
153
|
+
type: "lower",
|
|
154
|
+
amount: 99n,
|
|
155
|
+
};
|
|
156
|
+
const r = gaugeMath_1.GaugeMath.revertVote({
|
|
157
|
+
balanceAfter: initialBalance,
|
|
158
|
+
initialVote,
|
|
159
|
+
nextVoteType: "raise",
|
|
160
|
+
});
|
|
161
|
+
(0, chai_1.expect)(r).to.be.eql(initialBalance + initialVote.amount);
|
|
162
|
+
});
|
|
163
|
+
it("if no vote before, should revert vote after", () => {
|
|
164
|
+
const initialBalance = 26n;
|
|
165
|
+
const voteBy = 5n;
|
|
166
|
+
const voteAfter = {
|
|
167
|
+
available: initialBalance - voteBy,
|
|
168
|
+
vote: { type: "lower", amount: voteBy },
|
|
169
|
+
voteCalls: [{ type: "lower", amount: voteBy }],
|
|
170
|
+
};
|
|
171
|
+
const balanceAfter = voteAfter.available;
|
|
172
|
+
const r = gaugeMath_1.GaugeMath.revertVote({
|
|
173
|
+
balanceAfter,
|
|
174
|
+
nextVoteType: "lower",
|
|
175
|
+
voteAfter: voteAfter,
|
|
176
|
+
});
|
|
177
|
+
(0, chai_1.expect)(r).to.be.eql(initialBalance);
|
|
178
|
+
});
|
|
179
|
+
it("if vote before type matches expected type, should revert vote after", () => {
|
|
180
|
+
const initialBalance = 10n;
|
|
181
|
+
const voteBy = 6n;
|
|
182
|
+
const initialVote = {
|
|
183
|
+
type: "lower",
|
|
184
|
+
amount: 20n,
|
|
185
|
+
};
|
|
186
|
+
const voteAfter = {
|
|
187
|
+
available: initialBalance - voteBy,
|
|
188
|
+
vote: { type: "lower", amount: initialVote.amount + voteBy },
|
|
189
|
+
voteCalls: [{ type: "lower", amount: voteBy }],
|
|
190
|
+
};
|
|
191
|
+
const balanceAfter = voteAfter.available;
|
|
192
|
+
const r = gaugeMath_1.GaugeMath.revertVote({
|
|
193
|
+
initialVote,
|
|
194
|
+
balanceAfter,
|
|
195
|
+
nextVoteType: "lower",
|
|
196
|
+
voteAfter: voteAfter,
|
|
197
|
+
});
|
|
198
|
+
(0, chai_1.expect)(r).to.be.eql(initialBalance);
|
|
199
|
+
});
|
|
200
|
+
it("if vote before type doesn't match expected type, should revert vote before", () => {
|
|
201
|
+
const initialBalance = 10n;
|
|
202
|
+
const voteBy = 20n;
|
|
203
|
+
const initialVote = {
|
|
204
|
+
type: "raise",
|
|
205
|
+
amount: 61n,
|
|
206
|
+
};
|
|
207
|
+
const voteAfter = {
|
|
208
|
+
available: initialBalance + initialVote.amount - voteBy,
|
|
209
|
+
vote: { type: "lower", amount: voteBy },
|
|
210
|
+
voteCalls: [
|
|
211
|
+
{ type: "remove", amount: initialVote.amount },
|
|
212
|
+
{ type: "lower", amount: voteBy },
|
|
213
|
+
],
|
|
214
|
+
};
|
|
215
|
+
const r = gaugeMath_1.GaugeMath.revertVote({
|
|
216
|
+
initialVote,
|
|
217
|
+
balanceAfter: voteAfter.available,
|
|
218
|
+
nextVoteType: "lower",
|
|
219
|
+
voteAfter: voteAfter,
|
|
220
|
+
});
|
|
221
|
+
(0, chai_1.expect)(r).to.be.eql(initialBalance + initialVote.amount);
|
|
222
|
+
});
|
|
223
|
+
it("on remove, if vote before type matches expected type, should revert removal", () => {
|
|
224
|
+
const initialBalance = 100n;
|
|
225
|
+
const voteBy = 13n;
|
|
226
|
+
const initialVote = {
|
|
227
|
+
type: "lower",
|
|
228
|
+
amount: 30n,
|
|
229
|
+
};
|
|
230
|
+
const voteAfter = {
|
|
231
|
+
available: initialBalance + voteBy,
|
|
232
|
+
vote: { type: "lower", amount: initialVote.amount - voteBy },
|
|
233
|
+
voteCalls: [{ type: "remove", amount: voteBy }],
|
|
234
|
+
};
|
|
235
|
+
const r = gaugeMath_1.GaugeMath.revertVote({
|
|
236
|
+
initialVote,
|
|
237
|
+
balanceAfter: voteAfter.available,
|
|
238
|
+
nextVoteType: "lower",
|
|
239
|
+
voteAfter: voteAfter,
|
|
240
|
+
});
|
|
241
|
+
(0, chai_1.expect)(r).to.be.eql(initialBalance);
|
|
242
|
+
});
|
|
243
|
+
it("on remove, if vote before type doesn't match expected type, should revert vote before", () => {
|
|
244
|
+
const initialBalance = 100n;
|
|
245
|
+
const voteBy = 13n;
|
|
246
|
+
const initialVote = {
|
|
247
|
+
type: "raise",
|
|
248
|
+
amount: 30n,
|
|
249
|
+
};
|
|
250
|
+
const voteAfter = {
|
|
251
|
+
available: initialBalance + voteBy,
|
|
252
|
+
vote: { type: "raise", amount: initialVote.amount - voteBy },
|
|
253
|
+
voteCalls: [{ type: "remove", amount: voteBy }],
|
|
254
|
+
};
|
|
255
|
+
const r = gaugeMath_1.GaugeMath.revertVote({
|
|
256
|
+
initialVote,
|
|
257
|
+
balanceAfter: voteAfter.available,
|
|
258
|
+
nextVoteType: "lower",
|
|
259
|
+
voteAfter: voteAfter,
|
|
260
|
+
});
|
|
261
|
+
(0, chai_1.expect)(r).to.be.eql(initialBalance + initialVote.amount);
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
describe("GaugeMath getGaugeApy() test", () => {
|
|
265
|
+
it("should return null if no quota", () => {
|
|
266
|
+
const vote = { amount: 0n, type: "lower" };
|
|
267
|
+
const voteAfter = {
|
|
268
|
+
vote: { amount: 5n, type: "lower" },
|
|
269
|
+
voteCalls: [{ amount: 5n, type: "lower" }],
|
|
270
|
+
};
|
|
271
|
+
const r = gaugeMath_1.GaugeMath.getGaugeApy({
|
|
272
|
+
quota: undefined,
|
|
273
|
+
vote,
|
|
274
|
+
voteAfter,
|
|
275
|
+
});
|
|
276
|
+
(0, chai_1.expect)(r).to.be.eql(null);
|
|
277
|
+
});
|
|
278
|
+
it("should return min rate if total is zero", () => {
|
|
279
|
+
const quota = {
|
|
280
|
+
totalVotesCaSide: 0n,
|
|
281
|
+
totalVotesLpSide: 0n,
|
|
282
|
+
stakerVotesCaSide: 0n,
|
|
283
|
+
stakerVotesLpSide: 0n,
|
|
284
|
+
minRate: 12,
|
|
285
|
+
maxRate: 12345,
|
|
286
|
+
};
|
|
287
|
+
const r = gaugeMath_1.GaugeMath.getGaugeApy({
|
|
288
|
+
quota,
|
|
289
|
+
});
|
|
290
|
+
(0, chai_1.expect)(r).to.be.eql(12);
|
|
291
|
+
});
|
|
292
|
+
it("should calculate quota without votes", () => {
|
|
293
|
+
const quota = {
|
|
294
|
+
totalVotesCaSide: 100n,
|
|
295
|
+
totalVotesLpSide: 100n,
|
|
296
|
+
stakerVotesCaSide: 10n,
|
|
297
|
+
stakerVotesLpSide: 0n,
|
|
298
|
+
minRate: 0,
|
|
299
|
+
maxRate: 10000,
|
|
300
|
+
};
|
|
301
|
+
const r = gaugeMath_1.GaugeMath.getGaugeApy({
|
|
302
|
+
quota,
|
|
303
|
+
});
|
|
304
|
+
(0, chai_1.expect)(r).to.be.eql(5000);
|
|
305
|
+
});
|
|
306
|
+
it("should calculate quota with prev vote", () => {
|
|
307
|
+
const quota = {
|
|
308
|
+
totalVotesCaSide: 100n,
|
|
309
|
+
totalVotesLpSide: 100n,
|
|
310
|
+
stakerVotesCaSide: 10n,
|
|
311
|
+
stakerVotesLpSide: 0n,
|
|
312
|
+
minRate: 0,
|
|
313
|
+
maxRate: 10000,
|
|
314
|
+
};
|
|
315
|
+
const vote = { amount: 10n, type: "lower" };
|
|
316
|
+
const r = gaugeMath_1.GaugeMath.getGaugeApy({
|
|
317
|
+
quota,
|
|
318
|
+
vote,
|
|
319
|
+
});
|
|
320
|
+
(0, chai_1.expect)(r).to.be.eql(5000);
|
|
321
|
+
});
|
|
322
|
+
it("should calculate quota with same vote increase", () => {
|
|
323
|
+
const quota = {
|
|
324
|
+
totalVotesCaSide: 100n,
|
|
325
|
+
totalVotesLpSide: 100n,
|
|
326
|
+
stakerVotesCaSide: 10n,
|
|
327
|
+
stakerVotesLpSide: 0n,
|
|
328
|
+
minRate: 0,
|
|
329
|
+
maxRate: 10000,
|
|
330
|
+
};
|
|
331
|
+
const vote = { amount: 10n, type: "lower" };
|
|
332
|
+
const voteAfter = {
|
|
333
|
+
vote: { amount: 20n, type: "lower" },
|
|
334
|
+
voteCalls: [{ amount: 10n, type: "lower" }],
|
|
335
|
+
};
|
|
336
|
+
const r = gaugeMath_1.GaugeMath.getGaugeApy({
|
|
337
|
+
quota,
|
|
338
|
+
vote,
|
|
339
|
+
voteAfter,
|
|
340
|
+
});
|
|
341
|
+
(0, chai_1.expect)(r).to.be.eql(4761);
|
|
342
|
+
});
|
|
343
|
+
it("should calculate quota with different vote increase", () => {
|
|
344
|
+
const quota = {
|
|
345
|
+
totalVotesCaSide: 100n,
|
|
346
|
+
totalVotesLpSide: 100n,
|
|
347
|
+
stakerVotesCaSide: 20n,
|
|
348
|
+
stakerVotesLpSide: 0n,
|
|
349
|
+
minRate: 0,
|
|
350
|
+
maxRate: 10000,
|
|
351
|
+
};
|
|
352
|
+
const vote = { amount: 30n, type: "lower" };
|
|
353
|
+
const voteAfter = {
|
|
354
|
+
vote: { amount: 20n, type: "raise" },
|
|
355
|
+
voteCalls: [
|
|
356
|
+
{ amount: 30n, type: "remove" },
|
|
357
|
+
{ amount: 20n, type: "raise" },
|
|
358
|
+
],
|
|
359
|
+
};
|
|
360
|
+
const r = gaugeMath_1.GaugeMath.getGaugeApy({
|
|
361
|
+
quota,
|
|
362
|
+
vote,
|
|
363
|
+
voteAfter,
|
|
364
|
+
});
|
|
365
|
+
(0, chai_1.expect)(r).to.be.eql(6315);
|
|
366
|
+
});
|
|
367
|
+
it("should calculate quota with vote remove", () => {
|
|
368
|
+
const quota = {
|
|
369
|
+
totalVotesCaSide: 100n,
|
|
370
|
+
totalVotesLpSide: 100n,
|
|
371
|
+
stakerVotesCaSide: 20n,
|
|
372
|
+
stakerVotesLpSide: 0n,
|
|
373
|
+
minRate: 0,
|
|
374
|
+
maxRate: 10000,
|
|
375
|
+
};
|
|
376
|
+
const vote = { amount: 20n, type: "lower" };
|
|
377
|
+
const voteAfter = {
|
|
378
|
+
vote: { amount: 0n, type: "lower" },
|
|
379
|
+
voteCalls: [{ amount: 20n, type: "remove" }],
|
|
380
|
+
};
|
|
381
|
+
const r = gaugeMath_1.GaugeMath.getGaugeApy({
|
|
382
|
+
quota,
|
|
383
|
+
vote,
|
|
384
|
+
voteAfter,
|
|
385
|
+
});
|
|
386
|
+
(0, chai_1.expect)(r).to.be.eql(5555);
|
|
387
|
+
});
|
|
388
|
+
});
|
|
@@ -2,7 +2,7 @@ import { SupportedContract } from "@gearbox-protocol/sdk-gov";
|
|
|
2
2
|
import { Asset } from "./assets";
|
|
3
3
|
import { EVMTx, EVMTxProps } from "./eventOrTx";
|
|
4
4
|
export interface TxSerialized {
|
|
5
|
-
type: "TxAddLiquidity" | "TxRemoveLiquidity" | "TxSwap" | "TxAddCollateral" | "TxIncreaseBorrowAmount" | "TxDecreaseBorrowAmount" | "TxOpenAccount" | "TxRepayAccount" | "TxCloseAccount" | "TxApprove" | "TxOpenMultitokenAccount" | "TxClaimReward" | "TxClaimNFT" | "TxClaimGearRewards" | "TxEnableTokens" | "TxUpdateQuota" | "TxGaugeStake" | "TxGaugeUnstake" | "TxGaugeClaim";
|
|
5
|
+
type: "TxAddLiquidity" | "TxRemoveLiquidity" | "TxSwap" | "TxAddCollateral" | "TxIncreaseBorrowAmount" | "TxDecreaseBorrowAmount" | "TxOpenAccount" | "TxRepayAccount" | "TxCloseAccount" | "TxApprove" | "TxOpenMultitokenAccount" | "TxClaimReward" | "TxClaimNFT" | "TxClaimGearRewards" | "TxEnableTokens" | "TxUpdateQuota" | "TxGaugeStake" | "TxGaugeUnstake" | "TxGaugeClaim" | "TxGaugeVote";
|
|
6
6
|
content: string;
|
|
7
7
|
}
|
|
8
8
|
export declare class TxSerializer {
|
|
@@ -224,4 +224,17 @@ export declare class TxGaugeClaim extends EVMTx {
|
|
|
224
224
|
toString(): string;
|
|
225
225
|
serialize(): TxSerialized;
|
|
226
226
|
}
|
|
227
|
+
interface TxGaugeVoteProps extends EVMTxProps {
|
|
228
|
+
tokens: Array<{
|
|
229
|
+
token: string;
|
|
230
|
+
}>;
|
|
231
|
+
}
|
|
232
|
+
export declare class TxGaugeVote extends EVMTx {
|
|
233
|
+
readonly tokens: Array<{
|
|
234
|
+
token: string;
|
|
235
|
+
}>;
|
|
236
|
+
constructor(opts: TxGaugeVoteProps);
|
|
237
|
+
toString(): string;
|
|
238
|
+
serialize(): TxSerialized;
|
|
239
|
+
}
|
|
227
240
|
export {};
|
package/lib/core/transactions.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TxGaugeClaim = exports.TxGaugeUnstake = exports.TxGaugeStake = exports.TxUpdateQuota = exports.TxEnableTokens = exports.TxApprove = exports.TxCloseAccount = exports.TxRepayAccount = exports.TxClaimGearRewards = exports.TxClaimNFT = exports.TxClaimReward = exports.TxOpenMultitokenAccount = exports.TxOpenAccount = exports.TxDecreaseBorrowAmount = exports.TxIncreaseBorrowAmount = exports.TxAddCollateral = exports.TXSwap = exports.TxRemoveLiquidity = exports.TxAddLiquidity = exports.TxSerializer = void 0;
|
|
3
|
+
exports.TxGaugeVote = exports.TxGaugeClaim = exports.TxGaugeUnstake = exports.TxGaugeStake = exports.TxUpdateQuota = exports.TxEnableTokens = exports.TxApprove = exports.TxCloseAccount = exports.TxRepayAccount = exports.TxClaimGearRewards = exports.TxClaimNFT = exports.TxClaimReward = exports.TxOpenMultitokenAccount = exports.TxOpenAccount = exports.TxDecreaseBorrowAmount = exports.TxIncreaseBorrowAmount = exports.TxAddCollateral = exports.TXSwap = exports.TxRemoveLiquidity = exports.TxAddLiquidity = exports.TxSerializer = void 0;
|
|
4
4
|
const sdk_gov_1 = require("@gearbox-protocol/sdk-gov");
|
|
5
5
|
const contractsRegister_1 = require("../contracts/contractsRegister");
|
|
6
6
|
const math_1 = require("../utils/math");
|
|
@@ -51,6 +51,8 @@ class TxSerializer {
|
|
|
51
51
|
return new TxGaugeUnstake(params);
|
|
52
52
|
case "TxGaugeClaim":
|
|
53
53
|
return new TxGaugeClaim(params);
|
|
54
|
+
case "TxGaugeVote":
|
|
55
|
+
return new TxGaugeVote(params);
|
|
54
56
|
default:
|
|
55
57
|
throw new Error(`Unknown transaction for parsing: ${e.type}`);
|
|
56
58
|
}
|
|
@@ -478,3 +480,24 @@ class TxGaugeClaim extends eventOrTx_1.EVMTx {
|
|
|
478
480
|
}
|
|
479
481
|
}
|
|
480
482
|
exports.TxGaugeClaim = TxGaugeClaim;
|
|
483
|
+
class TxGaugeVote extends eventOrTx_1.EVMTx {
|
|
484
|
+
tokens;
|
|
485
|
+
constructor(opts) {
|
|
486
|
+
super(opts);
|
|
487
|
+
this.tokens = opts.tokens;
|
|
488
|
+
}
|
|
489
|
+
toString() {
|
|
490
|
+
const votes = this.tokens.map(({ token }) => {
|
|
491
|
+
const [tokenSymbol] = (0, sdk_gov_1.extractTokenData)(token);
|
|
492
|
+
return tokenSymbol;
|
|
493
|
+
});
|
|
494
|
+
return `Gauge: voted for ${votes.join(", ")}`;
|
|
495
|
+
}
|
|
496
|
+
serialize() {
|
|
497
|
+
return {
|
|
498
|
+
type: "TxGaugeVote",
|
|
499
|
+
content: JSON.stringify(this),
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
exports.TxGaugeVote = TxGaugeVote;
|
package/lib/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./core/errors";
|
|
|
8
8
|
export * from "./core/eventOrTx";
|
|
9
9
|
export * from "./core/events";
|
|
10
10
|
export * from "./core/gauge";
|
|
11
|
+
export * from "./core/gaugeMath";
|
|
11
12
|
export * from "./core/pool";
|
|
12
13
|
export * from "./core/rewardClaimer";
|
|
13
14
|
export * from "./core/strategy";
|
package/lib/index.js
CHANGED
|
@@ -25,6 +25,7 @@ __exportStar(require("./core/errors"), exports);
|
|
|
25
25
|
__exportStar(require("./core/eventOrTx"), exports);
|
|
26
26
|
__exportStar(require("./core/events"), exports);
|
|
27
27
|
__exportStar(require("./core/gauge"), exports);
|
|
28
|
+
__exportStar(require("./core/gaugeMath"), exports);
|
|
28
29
|
__exportStar(require("./core/pool"), exports);
|
|
29
30
|
__exportStar(require("./core/rewardClaimer"), exports);
|
|
30
31
|
__exportStar(require("./core/strategy"), exports);
|
|
@@ -2,7 +2,7 @@ import type { BaseContract, BigNumber, BigNumberish, BytesLike, CallOverrides, C
|
|
|
2
2
|
import type { FunctionFragment, Result } from "@ethersproject/abi";
|
|
3
3
|
import type { Listener, Provider } from "@ethersproject/providers";
|
|
4
4
|
import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent, PromiseOrValue } from "./common";
|
|
5
|
-
export interface
|
|
5
|
+
export interface IERC20ZapperDepositsInterface extends utils.Interface {
|
|
6
6
|
functions: {
|
|
7
7
|
"deposit(uint256,address)": FunctionFragment;
|
|
8
8
|
"depositWithPermit(uint256,address,uint256,uint8,bytes32,bytes32)": FunctionFragment;
|
|
@@ -39,11 +39,11 @@ export interface IERC20ZapperInterface extends utils.Interface {
|
|
|
39
39
|
decodeFunctionResult(functionFragment: "depositWithReferralAndPermit", data: BytesLike): Result;
|
|
40
40
|
events: {};
|
|
41
41
|
}
|
|
42
|
-
export interface
|
|
42
|
+
export interface IERC20ZapperDeposits extends BaseContract {
|
|
43
43
|
connect(signerOrProvider: Signer | Provider | string): this;
|
|
44
44
|
attach(addressOrName: string): this;
|
|
45
45
|
deployed(): Promise<this>;
|
|
46
|
-
interface:
|
|
46
|
+
interface: IERC20ZapperDepositsInterface;
|
|
47
47
|
queryFilter<TEvent extends TypedEvent>(event: TypedEventFilter<TEvent>, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise<Array<TEvent>>;
|
|
48
48
|
listeners<TEvent extends TypedEvent>(eventFilter?: TypedEventFilter<TEvent>): Array<TypedListener<TEvent>>;
|
|
49
49
|
listeners(eventName?: string): Array<Listener>;
|
|
@@ -2,7 +2,7 @@ import type { BaseContract, BigNumber, BigNumberish, BytesLike, CallOverrides, C
|
|
|
2
2
|
import type { FunctionFragment, Result } from "@ethersproject/abi";
|
|
3
3
|
import type { Listener, Provider } from "@ethersproject/providers";
|
|
4
4
|
import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent, PromiseOrValue } from "./common";
|
|
5
|
-
export interface
|
|
5
|
+
export interface IETHZapperDepositsInterface extends utils.Interface {
|
|
6
6
|
functions: {
|
|
7
7
|
"deposit(address)": FunctionFragment;
|
|
8
8
|
"depositWithReferral(address,uint256)": FunctionFragment;
|
|
@@ -14,11 +14,11 @@ export interface IETHZapperInterface extends utils.Interface {
|
|
|
14
14
|
decodeFunctionResult(functionFragment: "depositWithReferral", data: BytesLike): Result;
|
|
15
15
|
events: {};
|
|
16
16
|
}
|
|
17
|
-
export interface
|
|
17
|
+
export interface IETHZapperDeposits extends BaseContract {
|
|
18
18
|
connect(signerOrProvider: Signer | Provider | string): this;
|
|
19
19
|
attach(addressOrName: string): this;
|
|
20
20
|
deployed(): Promise<this>;
|
|
21
|
-
interface:
|
|
21
|
+
interface: IETHZapperDepositsInterface;
|
|
22
22
|
queryFilter<TEvent extends TypedEvent>(event: TypedEventFilter<TEvent>, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise<Array<TEvent>>;
|
|
23
23
|
listeners<TEvent extends TypedEvent>(eventFilter?: TypedEventFilter<TEvent>): Array<TypedListener<TEvent>>;
|
|
24
24
|
listeners(eventName?: string): Array<Listener>;
|
package/lib/types/factories/{IERC20Zapper__factory.d.ts → IERC20ZapperDeposits__factory.d.ts}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Signer } from "ethers";
|
|
2
2
|
import type { Provider } from "@ethersproject/providers";
|
|
3
|
-
import type {
|
|
4
|
-
export declare class
|
|
3
|
+
import type { IERC20ZapperDeposits, IERC20ZapperDepositsInterface } from "../IERC20ZapperDeposits";
|
|
4
|
+
export declare class IERC20ZapperDeposits__factory {
|
|
5
5
|
static readonly abi: readonly [{
|
|
6
6
|
readonly inputs: readonly [{
|
|
7
7
|
readonly internalType: "uint256";
|
|
@@ -115,6 +115,6 @@ export declare class IERC20Zapper__factory {
|
|
|
115
115
|
readonly stateMutability: "nonpayable";
|
|
116
116
|
readonly type: "function";
|
|
117
117
|
}];
|
|
118
|
-
static createInterface():
|
|
119
|
-
static connect(address: string, signerOrProvider: Signer | Provider):
|
|
118
|
+
static createInterface(): IERC20ZapperDepositsInterface;
|
|
119
|
+
static connect(address: string, signerOrProvider: Signer | Provider): IERC20ZapperDeposits;
|
|
120
120
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/* tslint:disable */
|
|
4
4
|
/* eslint-disable */
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.IERC20ZapperDeposits__factory = void 0;
|
|
7
7
|
const ethers_1 = require("ethers");
|
|
8
8
|
const _abi = [
|
|
9
9
|
{
|
|
@@ -153,7 +153,7 @@ const _abi = [
|
|
|
153
153
|
type: "function",
|
|
154
154
|
},
|
|
155
155
|
];
|
|
156
|
-
class
|
|
156
|
+
class IERC20ZapperDeposits__factory {
|
|
157
157
|
static abi = _abi;
|
|
158
158
|
static createInterface() {
|
|
159
159
|
return new ethers_1.utils.Interface(_abi);
|
|
@@ -162,4 +162,4 @@ class IERC20Zapper__factory {
|
|
|
162
162
|
return new ethers_1.Contract(address, _abi, signerOrProvider);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
exports.
|
|
165
|
+
exports.IERC20ZapperDeposits__factory = IERC20ZapperDeposits__factory;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Signer } from "ethers";
|
|
2
2
|
import type { Provider } from "@ethersproject/providers";
|
|
3
|
-
import type {
|
|
4
|
-
export declare class
|
|
3
|
+
import type { IETHZapperDeposits, IETHZapperDepositsInterface } from "../IETHZapperDeposits";
|
|
4
|
+
export declare class IETHZapperDeposits__factory {
|
|
5
5
|
static readonly abi: readonly [{
|
|
6
6
|
readonly inputs: readonly [{
|
|
7
7
|
readonly internalType: "address";
|
|
@@ -35,6 +35,6 @@ export declare class IETHZapper__factory {
|
|
|
35
35
|
readonly stateMutability: "payable";
|
|
36
36
|
readonly type: "function";
|
|
37
37
|
}];
|
|
38
|
-
static createInterface():
|
|
39
|
-
static connect(address: string, signerOrProvider: Signer | Provider):
|
|
38
|
+
static createInterface(): IETHZapperDepositsInterface;
|
|
39
|
+
static connect(address: string, signerOrProvider: Signer | Provider): IETHZapperDeposits;
|
|
40
40
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/* tslint:disable */
|
|
4
4
|
/* eslint-disable */
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.IETHZapperDeposits__factory = void 0;
|
|
7
7
|
const ethers_1 = require("ethers");
|
|
8
8
|
const _abi = [
|
|
9
9
|
{
|
|
@@ -50,7 +50,7 @@ const _abi = [
|
|
|
50
50
|
type: "function",
|
|
51
51
|
},
|
|
52
52
|
];
|
|
53
|
-
class
|
|
53
|
+
class IETHZapperDeposits__factory {
|
|
54
54
|
static abi = _abi;
|
|
55
55
|
static createInterface() {
|
|
56
56
|
return new ethers_1.utils.Interface(_abi);
|
|
@@ -59,4 +59,4 @@ class IETHZapper__factory {
|
|
|
59
59
|
return new ethers_1.Contract(address, _abi, signerOrProvider);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
exports.
|
|
62
|
+
exports.IETHZapperDeposits__factory = IETHZapperDeposits__factory;
|
|
@@ -43,9 +43,9 @@ export { IDataCompressorV3_00__factory } from "./IDataCompressorV3_00__factory";
|
|
|
43
43
|
export { IERC20__factory } from "./IERC20__factory";
|
|
44
44
|
export { IERC20Metadata__factory } from "./IERC20Metadata__factory";
|
|
45
45
|
export { IERC20Permit__factory } from "./IERC20Permit__factory";
|
|
46
|
-
export {
|
|
46
|
+
export { IERC20ZapperDeposits__factory } from "./IERC20ZapperDeposits__factory";
|
|
47
47
|
export { IERC4626__factory } from "./IERC4626__factory";
|
|
48
|
-
export {
|
|
48
|
+
export { IETHZapperDeposits__factory } from "./IETHZapperDeposits__factory";
|
|
49
49
|
export { IGasPricer__factory } from "./IGasPricer__factory";
|
|
50
50
|
export { IInterestRateModel__factory } from "./IInterestRateModel__factory";
|
|
51
51
|
export { ILidoV1Adapter__factory } from "./ILidoV1Adapter__factory";
|
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.IInterestRateModel__factory = exports.IGasPricer__factory = exports.
|
|
26
|
+
exports.IInterestRateModel__factory = exports.IGasPricer__factory = exports.IETHZapperDeposits__factory = exports.IERC4626__factory = exports.IERC20ZapperDeposits__factory = exports.IERC20Permit__factory = exports.IERC20Metadata__factory = exports.IERC20__factory = exports.IDataCompressorV3_00__factory = exports.IDataCompressorV2_10__factory = exports.IDaiLikePermit__factory = exports.ICurveV1_4AssetsAdapter__factory = exports.ICurveV1_3AssetsAdapter__factory = exports.ICurveV1_2AssetsAdapter__factory = exports.ICurveV1Adapter__factory = exports.ICurvePool__factory = exports.ICreditFacadeV3Multicall__factory = exports.IConvexV1BaseRewardPoolAdapter__factory = exports.IConvexToken__factory = exports.IBaseRewardPool__factory = exports.IAdapter__factory = exports.Errors__factory = exports.Claimable__factory = exports.AddressProvider__factory = exports.interfaces = exports.iwstEthGatewaySol = exports.iwstEthSol = exports.istEthSol = exports.iWithdrawalManagerV3Sol = exports.iUniswapV3AdapterSol = exports.iUniswapV3Sol = exports.iUniswapV2AdapterSol = exports.iPoolV3Sol = exports.iPoolServiceSol = exports.iGearStakingV3Sol = exports.iDegenDistributorSol = exports.iCurvePool4Sol = exports.iCurvePool3Sol = exports.iCurvePool2Sol = exports.iCreditManagerV3Sol = exports.iCreditManagerV2Sol = exports.iCreditFacadeV3Sol = exports.iCreditFacadeV2Sol = exports.iCreditConfiguratorV3Sol = exports.iCreditConfiguratorV2Sol = exports.iConvexV1BoosterAdapterSol = exports.iAirdropDistributorSol = exports.iAddressProviderV3Sol = exports.iAddressProviderSol = exports.balancesSol = void 0;
|
|
27
27
|
exports.SafeERC20__factory = exports.Ownable__factory = exports.IwstETHV1Adapter__factory = exports.IZapper__factory = exports.IYearnV2Adapter__factory = exports.IYVault__factory = exports.IWETHGateway__factory = exports.IWETH__factory = exports.IVersion__factory = exports.IPriceOracleBase__factory = exports.IPermit2__factory = exports.IOffchainOracle__factory = exports.ILidoV1Adapter__factory = void 0;
|
|
28
28
|
/* Autogenerated file. Do not edit manually. */
|
|
29
29
|
/* tslint:disable */
|
|
@@ -92,12 +92,12 @@ var IERC20Metadata__factory_1 = require("./IERC20Metadata__factory");
|
|
|
92
92
|
Object.defineProperty(exports, "IERC20Metadata__factory", { enumerable: true, get: function () { return IERC20Metadata__factory_1.IERC20Metadata__factory; } });
|
|
93
93
|
var IERC20Permit__factory_1 = require("./IERC20Permit__factory");
|
|
94
94
|
Object.defineProperty(exports, "IERC20Permit__factory", { enumerable: true, get: function () { return IERC20Permit__factory_1.IERC20Permit__factory; } });
|
|
95
|
-
var
|
|
96
|
-
Object.defineProperty(exports, "
|
|
95
|
+
var IERC20ZapperDeposits__factory_1 = require("./IERC20ZapperDeposits__factory");
|
|
96
|
+
Object.defineProperty(exports, "IERC20ZapperDeposits__factory", { enumerable: true, get: function () { return IERC20ZapperDeposits__factory_1.IERC20ZapperDeposits__factory; } });
|
|
97
97
|
var IERC4626__factory_1 = require("./IERC4626__factory");
|
|
98
98
|
Object.defineProperty(exports, "IERC4626__factory", { enumerable: true, get: function () { return IERC4626__factory_1.IERC4626__factory; } });
|
|
99
|
-
var
|
|
100
|
-
Object.defineProperty(exports, "
|
|
99
|
+
var IETHZapperDeposits__factory_1 = require("./IETHZapperDeposits__factory");
|
|
100
|
+
Object.defineProperty(exports, "IETHZapperDeposits__factory", { enumerable: true, get: function () { return IETHZapperDeposits__factory_1.IETHZapperDeposits__factory; } });
|
|
101
101
|
var IGasPricer__factory_1 = require("./IGasPricer__factory");
|
|
102
102
|
Object.defineProperty(exports, "IGasPricer__factory", { enumerable: true, get: function () { return IGasPricer__factory_1.IGasPricer__factory; } });
|
|
103
103
|
var IInterestRateModel__factory_1 = require("./IInterestRateModel__factory");
|
package/lib/types/index.d.ts
CHANGED
|
@@ -69,9 +69,9 @@ export type { IDataCompressorV3_00 } from "./IDataCompressorV3_00";
|
|
|
69
69
|
export type { IERC20 } from "./IERC20";
|
|
70
70
|
export type { IERC20Metadata } from "./IERC20Metadata";
|
|
71
71
|
export type { IERC20Permit } from "./IERC20Permit";
|
|
72
|
-
export type {
|
|
72
|
+
export type { IERC20ZapperDeposits } from "./IERC20ZapperDeposits";
|
|
73
73
|
export type { IERC4626 } from "./IERC4626";
|
|
74
|
-
export type {
|
|
74
|
+
export type { IETHZapperDeposits } from "./IETHZapperDeposits";
|
|
75
75
|
export type { IGasPricer } from "./IGasPricer";
|
|
76
76
|
export type { IInterestRateModel } from "./IInterestRateModel";
|
|
77
77
|
export type { ILidoV1Adapter } from "./ILidoV1Adapter";
|
|
@@ -169,9 +169,9 @@ export { IDegenDistributorEvents__factory } from "./factories/IDegenDistributor.
|
|
|
169
169
|
export { IERC20__factory } from "./factories/IERC20__factory";
|
|
170
170
|
export { IERC20Metadata__factory } from "./factories/IERC20Metadata__factory";
|
|
171
171
|
export { IERC20Permit__factory } from "./factories/IERC20Permit__factory";
|
|
172
|
-
export {
|
|
172
|
+
export { IERC20ZapperDeposits__factory } from "./factories/IERC20ZapperDeposits__factory";
|
|
173
173
|
export { IERC4626__factory } from "./factories/IERC4626__factory";
|
|
174
|
-
export {
|
|
174
|
+
export { IETHZapperDeposits__factory } from "./factories/IETHZapperDeposits__factory";
|
|
175
175
|
export { IGasPricer__factory } from "./factories/IGasPricer__factory";
|
|
176
176
|
export type { IGearStakingV3 } from "./IGearStakingV3.sol/IGearStakingV3";
|
|
177
177
|
export { IGearStakingV3__factory } from "./factories/IGearStakingV3.sol/IGearStakingV3__factory";
|
package/lib/types/index.js
CHANGED
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.IERC20Metadata__factory = exports.IERC20__factory = exports.IDegenDistributorEvents__factory = exports.IDegenDistributor__factory = exports.IDataCompressorV3_00__factory = exports.IDataCompressorV2_10__factory = exports.IDaiLikePermit__factory = exports.ICurveV1Adapter__factory = exports.ICurveV1_4AssetsAdapter__factory = exports.ICurveV1_3AssetsAdapter__factory = exports.ICurveV1_2AssetsAdapter__factory = exports.ICurvePool__factory = exports.ICurvePool4Assets__factory = exports.ICurvePool3Assets__factory = exports.ICurvePool2Assets__factory = exports.ICreditManagerV3Events__factory = exports.ICreditManagerV3__factory = exports.ICreditManagerV2Exceptions__factory = exports.ICreditManagerV2Events__factory = exports.ICreditManagerV2__factory = exports.ICreditFacadeV3Multicall__factory = exports.ICreditFacadeV3Events__factory = exports.ICreditFacadeV3__factory = exports.ICreditFacadeV2V2__factory = exports.ICreditFacadeV2Extended__factory = exports.ICreditFacadeV2Exceptions__factory = exports.ICreditFacadeV2Events__factory = exports.ICreditFacadeV2__factory = exports.ICreditConfiguratorV3Events__factory = exports.ICreditConfiguratorV3__factory = exports.ICreditConfiguratorV2Exceptions__factory = exports.ICreditConfiguratorV2Events__factory = exports.ICreditConfiguratorV2__factory = exports.IConvexV1BoosterAdapterEvents__factory = exports.IConvexV1BoosterAdapter__factory = exports.IConvexV1BaseRewardPoolAdapter__factory = exports.IConvexToken__factory = exports.IBaseRewardPool__factory = exports.IAirdropDistributorEvents__factory = exports.IAirdropDistributor__factory = exports.IAddressProviderV3Events__factory = exports.IAddressProviderV3__factory = exports.IAddressProviderEvents__factory = exports.IAddressProvider__factory = exports.IAdapter__factory = exports.Errors__factory = exports.Claimable__factory = exports.BalanceOps__factory = exports.AddressProvider__factory = exports.factories = void 0;
|
|
27
|
-
exports.SafeERC20__factory = exports.Ownable__factory = exports.IZapper__factory = exports.IYVault__factory = exports.IYearnV2Adapter__factory = exports.IwstETHV1Adapter__factory = exports.IwstETHGateWay__factory = exports.IwstETHGetters__factory = exports.IwstETH__factory = exports.IWithdrawalManagerV3Events__factory = exports.IWithdrawalManagerV3__factory = exports.IWETHGateway__factory = exports.IWETH__factory = exports.IVersion__factory = exports.IUniswapV3AdapterExceptions__factory = exports.IUniswapV3AdapterEvents__factory = exports.IUniswapV3Adapter__factory = exports.ISwapRouter__factory = exports.IUniswapV2AdapterExceptions__factory = exports.IUniswapV2AdapterEvents__factory = exports.IUniswapV2Adapter__factory = exports.IstETHGetters__factory = exports.IstETH__factory = exports.IPriceOracleBase__factory = exports.IPoolV3Events__factory = exports.IPoolV3__factory = exports.IPoolServiceEvents__factory = exports.IPoolService__factory = exports.IPermit2__factory = exports.IOffchainOracle__factory = exports.IRouter__factory = exports.ILidoV1Adapter__factory = exports.IInterestRateModel__factory = exports.IGearStakingV3Events__factory = exports.IGearStakingV3__factory = exports.IGasPricer__factory = exports.
|
|
27
|
+
exports.SafeERC20__factory = exports.Ownable__factory = exports.IZapper__factory = exports.IYVault__factory = exports.IYearnV2Adapter__factory = exports.IwstETHV1Adapter__factory = exports.IwstETHGateWay__factory = exports.IwstETHGetters__factory = exports.IwstETH__factory = exports.IWithdrawalManagerV3Events__factory = exports.IWithdrawalManagerV3__factory = exports.IWETHGateway__factory = exports.IWETH__factory = exports.IVersion__factory = exports.IUniswapV3AdapterExceptions__factory = exports.IUniswapV3AdapterEvents__factory = exports.IUniswapV3Adapter__factory = exports.ISwapRouter__factory = exports.IUniswapV2AdapterExceptions__factory = exports.IUniswapV2AdapterEvents__factory = exports.IUniswapV2Adapter__factory = exports.IstETHGetters__factory = exports.IstETH__factory = exports.IPriceOracleBase__factory = exports.IPoolV3Events__factory = exports.IPoolV3__factory = exports.IPoolServiceEvents__factory = exports.IPoolService__factory = exports.IPermit2__factory = exports.IOffchainOracle__factory = exports.IRouter__factory = exports.ILidoV1Adapter__factory = exports.IInterestRateModel__factory = exports.IGearStakingV3Events__factory = exports.IGearStakingV3__factory = exports.IGasPricer__factory = exports.IETHZapperDeposits__factory = exports.IERC4626__factory = exports.IERC20ZapperDeposits__factory = exports.IERC20Permit__factory = void 0;
|
|
28
28
|
exports.factories = __importStar(require("./factories"));
|
|
29
29
|
var AddressProvider__factory_1 = require("./factories/AddressProvider__factory");
|
|
30
30
|
Object.defineProperty(exports, "AddressProvider__factory", { enumerable: true, get: function () { return AddressProvider__factory_1.AddressProvider__factory; } });
|
|
@@ -126,12 +126,12 @@ var IERC20Metadata__factory_1 = require("./factories/IERC20Metadata__factory");
|
|
|
126
126
|
Object.defineProperty(exports, "IERC20Metadata__factory", { enumerable: true, get: function () { return IERC20Metadata__factory_1.IERC20Metadata__factory; } });
|
|
127
127
|
var IERC20Permit__factory_1 = require("./factories/IERC20Permit__factory");
|
|
128
128
|
Object.defineProperty(exports, "IERC20Permit__factory", { enumerable: true, get: function () { return IERC20Permit__factory_1.IERC20Permit__factory; } });
|
|
129
|
-
var
|
|
130
|
-
Object.defineProperty(exports, "
|
|
129
|
+
var IERC20ZapperDeposits__factory_1 = require("./factories/IERC20ZapperDeposits__factory");
|
|
130
|
+
Object.defineProperty(exports, "IERC20ZapperDeposits__factory", { enumerable: true, get: function () { return IERC20ZapperDeposits__factory_1.IERC20ZapperDeposits__factory; } });
|
|
131
131
|
var IERC4626__factory_1 = require("./factories/IERC4626__factory");
|
|
132
132
|
Object.defineProperty(exports, "IERC4626__factory", { enumerable: true, get: function () { return IERC4626__factory_1.IERC4626__factory; } });
|
|
133
|
-
var
|
|
134
|
-
Object.defineProperty(exports, "
|
|
133
|
+
var IETHZapperDeposits__factory_1 = require("./factories/IETHZapperDeposits__factory");
|
|
134
|
+
Object.defineProperty(exports, "IETHZapperDeposits__factory", { enumerable: true, get: function () { return IETHZapperDeposits__factory_1.IETHZapperDeposits__factory; } });
|
|
135
135
|
var IGasPricer__factory_1 = require("./factories/IGasPricer__factory");
|
|
136
136
|
Object.defineProperty(exports, "IGasPricer__factory", { enumerable: true, get: function () { return IGasPricer__factory_1.IGasPricer__factory; } });
|
|
137
137
|
var IGearStakingV3__factory_1 = require("./factories/IGearStakingV3.sol/IGearStakingV3__factory");
|
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.45",
|
|
4
4
|
"description": "Gearbox SDK",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"@commitlint/cli": "^17.6.3",
|
|
42
42
|
"@commitlint/config-conventional": "^17.0.3",
|
|
43
43
|
"@gearbox-protocol/core-v2": "1.19.0-base.17",
|
|
44
|
-
"@gearbox-protocol/core-v3": "^1.42.
|
|
44
|
+
"@gearbox-protocol/core-v3": "^1.42.2",
|
|
45
45
|
"@gearbox-protocol/eslint-config": "^1.4.1",
|
|
46
|
-
"@gearbox-protocol/integrations-v3": "^1.20.
|
|
46
|
+
"@gearbox-protocol/integrations-v3": "^1.20.2",
|
|
47
47
|
"@gearbox-protocol/oracles-v3": "^1.7.6",
|
|
48
|
-
"@gearbox-protocol/periphery-v3": "^1.3.
|
|
48
|
+
"@gearbox-protocol/periphery-v3": "^1.3.8",
|
|
49
49
|
"@gearbox-protocol/prettier-config": "^1.4.1",
|
|
50
50
|
"@gearbox-protocol/router-v3": "^1.4.0",
|
|
51
51
|
"@openzeppelin/contracts": "^4.9.3",
|
|
File without changes
|
|
File without changes
|