Skip to content

Commit 012f068

Browse files
authored
Deploy 163 - Increase OETH redeem fee from 0.1% to 10% (#2734)
* Deploy script to remove the Morpho Gauntlet Prime USDC Strategy * Added proposal id of deploy * Increase OETH redeem fee from 10 to 50 basis points * Fix fork tests after Gauntlet strategy has been removed * Added entry in .migrations * Replaced governance proposal that increases the redeem fee to 10% * Fix OUSD AMO fork tests * Fix Base and OUSD AMO fork tests * More fixes to the AMO fork tests * Fixed fork tests with new 10% redeem fee on OETH Vault * Fix OETH fork tests
1 parent b2256b7 commit 012f068

File tree

6 files changed

+134
-54
lines changed

6 files changed

+134
-54
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const { deploymentWithGovernanceProposal } = require("../../utils/deploy");
2+
3+
module.exports = deploymentWithGovernanceProposal(
4+
{
5+
deployName: "163_increase_oeth_redeem_fee",
6+
forceDeploy: false,
7+
// forceSkip: true,
8+
// reduceQueueTime: true,
9+
deployerIsProposer: false,
10+
proposalId:
11+
"74087219166026533236211044968704800558008230594792107684752001539143606662996",
12+
},
13+
async () => {
14+
// Current contracts
15+
const cVaultProxy = await ethers.getContract("OETHVaultProxy");
16+
const cVaultAdmin = await ethers.getContractAt(
17+
"OETHVaultAdmin",
18+
cVaultProxy.address
19+
);
20+
21+
// Governance Actions
22+
// ----------------
23+
return {
24+
name: `Increase the OETH redeem fee from 0.1% to 10%. This is to prevent MEV bots taking WETH from the Vault after ETH from exited validators have been swept and accounted for.`,
25+
actions: [
26+
{
27+
contract: cVaultAdmin,
28+
signature: "setRedeemFeeBps(uint256)",
29+
args: [1000],
30+
},
31+
],
32+
};
33+
}
34+
);

contracts/deployments/mainnet/.migrations.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,6 @@
5656
"159_ousd_morpho_v2_proxy": 1765998626,
5757
"160_upgrade_morpho_strategies": 1766168031,
5858
"161_add_morpho_rewards": 1767070523,
59-
"162_remove_morpho_gauntlet_strat": 1767659015
59+
"162_remove_morpho_gauntlet_strat": 1767659015,
60+
"163_increase_oeth_redeem_fee": 1767817943
6061
}

contracts/test/strategies/base/curve-amo.base.fork-test.js

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,13 @@ describe("Base Fork Test: Curve AMO strategy", function () {
162162
);
163163

164164
const balance = await weth.balanceOf(user.address);
165-
if (balance < amount) {
166-
await setERC20TokenBalance(user.address, weth, amount + balance, hre);
165+
if (balance.lt(amount)) {
166+
await setERC20TokenBalance(
167+
user.address,
168+
weth,
169+
amount.add(balance),
170+
hre
171+
);
167172
}
168173
await weth.connect(user).transfer(curveAMOStrategy.address, amount);
169174

@@ -395,7 +400,7 @@ describe("Base Fork Test: Curve AMO strategy", function () {
395400
});
396401

397402
it("Should deposit when pool is heavily unbalanced with OETH", async () => {
398-
await unbalancePool({ oethbAmount: defaultDeposit.mul(20) });
403+
await unbalancePool({ oethbAmount: defaultDeposit.mul(3) });
399404

400405
const checkBalanceBefore = await curveAMOStrategy.checkBalance(
401406
weth.address
@@ -427,7 +432,7 @@ describe("Base Fork Test: Curve AMO strategy", function () {
427432
});
428433

429434
it("Should deposit when pool is heavily unbalanced with WETH", async () => {
430-
await unbalancePool({ wethbAmount: defaultDeposit.mul(20) });
435+
await unbalancePool({ wethbAmount: defaultDeposit.mul(10) });
431436

432437
const checkBalanceBefore = await curveAMOStrategy.checkBalance(
433438
weth.address
@@ -450,10 +455,10 @@ describe("Base Fork Test: Curve AMO strategy", function () {
450455

451456
expect(
452457
await curveAMOStrategy.checkBalance(weth.address)
453-
).to.approxEqualTolerance(defaultDeposit.mul(2).add(checkBalanceBefore));
458+
).to.approxEqualTolerance(defaultDeposit.mul(3).add(checkBalanceBefore));
454459
expect(
455460
await curveGauge.balanceOf(curveAMOStrategy.address)
456-
).to.approxEqualTolerance(defaultDeposit.mul(2).add(gaugeTokensBefore));
461+
).to.approxEqualTolerance(defaultDeposit.mul(3).add(gaugeTokensBefore));
457462
expect(await weth.balanceOf(curveAMOStrategy.address)).to.equal(0);
458463
});
459464

@@ -767,8 +772,8 @@ describe("Base Fork Test: Curve AMO strategy", function () {
767772
amount = amount || defaultDeposit;
768773

769774
const balance = await weth.balanceOf(user.address);
770-
if (balance < amount) {
771-
await setERC20TokenBalance(user.address, weth, amount + balance, hre);
775+
if (balance.lt(amount)) {
776+
await setERC20TokenBalance(user.address, weth, amount.add(balance), hre);
772777
}
773778
await weth.connect(user).approve(oethbVault.address, amount);
774779
await oethbVault.connect(user).mint(weth.address, amount, amount);
@@ -793,9 +798,14 @@ describe("Base Fork Test: Curve AMO strategy", function () {
793798

794799
if (balanceWETH.gt(balanceOETH)) {
795800
const amount = balanceWETH.sub(balanceOETH);
796-
const balance = weth.balanceOf(nick.address);
797-
if (balance < amount) {
798-
await setERC20TokenBalance(nick.address, weth, amount + balance, hre);
801+
const balance = await weth.balanceOf(nick.address);
802+
if (balance.lt(amount)) {
803+
await setERC20TokenBalance(
804+
nick.address,
805+
weth,
806+
amount.add(balance),
807+
hre
808+
);
799809
}
800810
await weth
801811
.connect(nick)
@@ -809,9 +819,14 @@ describe("Base Fork Test: Curve AMO strategy", function () {
809819
.connect(nick)["add_liquidity(uint256[],uint256)"]([0, amount], 0);
810820
} else if (balanceWETH.lt(balanceOETH)) {
811821
const amount = balanceOETH.sub(balanceWETH);
812-
const balance = weth.balanceOf(nick.address);
813-
if (balance < amount) {
814-
await setERC20TokenBalance(nick.address, weth, amount + balance, hre);
822+
const balance = await weth.balanceOf(nick.address);
823+
if (balance.lt(amount)) {
824+
await setERC20TokenBalance(
825+
nick.address,
826+
weth,
827+
amount.add(balance),
828+
hre
829+
);
815830
}
816831
await weth.connect(nick).approve(curvePool.address, amount);
817832
// prettier-ignore
@@ -836,12 +851,12 @@ describe("Base Fork Test: Curve AMO strategy", function () {
836851
}
837852

838853
if (wethbAmount) {
839-
const balance = weth.balanceOf(nick.address);
840-
if (balance < wethbAmount) {
854+
const balance = await weth.balanceOf(nick.address);
855+
if (balance.lt(wethbAmount)) {
841856
await setERC20TokenBalance(
842857
nick.address,
843858
weth,
844-
wethbAmount + balance,
859+
wethbAmount.add(balance),
845860
hre
846861
);
847862
}
@@ -855,12 +870,12 @@ describe("Base Fork Test: Curve AMO strategy", function () {
855870
await curvePool
856871
.connect(nick)["add_liquidity(uint256[],uint256)"]([wethbAmount, 0], 0);
857872
} else {
858-
const balance = weth.balanceOf(nick.address);
859-
if (balance < oethbAmount) {
873+
const balance = await weth.balanceOf(nick.address);
874+
if (balance.lt(oethbAmount)) {
860875
await setERC20TokenBalance(
861876
nick.address,
862877
weth,
863-
oethbAmount + balance,
878+
oethbAmount.add(balance),
864879
hre
865880
);
866881
}

contracts/test/strategies/curve-amo-oeth.mainnet.fork-test.js

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,13 @@ describe("Curve AMO OETH strategy", function () {
167167
);
168168

169169
const balance = await weth.balanceOf(user.address);
170-
if (balance < amount) {
171-
await setERC20TokenBalance(user.address, weth, amount + balance, hre);
170+
if (balance.lt(amount)) {
171+
await setERC20TokenBalance(
172+
user.address,
173+
weth,
174+
amount.add(balance),
175+
hre
176+
);
172177
}
173178
await weth.connect(user).transfer(curveAMOStrategy.address, amount);
174179

@@ -971,8 +976,8 @@ describe("Curve AMO OETH strategy", function () {
971976
amount = amount || defaultDeposit;
972977

973978
const balance = await weth.balanceOf(user.address);
974-
if (balance < amount) {
975-
await setERC20TokenBalance(user.address, weth, amount + balance, hre);
979+
if (balance.lt(amount)) {
980+
await setERC20TokenBalance(user.address, weth, amount.add(balance), hre);
976981
}
977982

978983
await weth.connect(user).approve(oethVault.address, 0);
@@ -999,9 +1004,14 @@ describe("Curve AMO OETH strategy", function () {
9991004

10001005
if (balanceHardAsset.sub(balanceOToken) > 0) {
10011006
const amount = balanceHardAsset.sub(balanceOToken);
1002-
const balance = weth.balanceOf(nick.address);
1003-
if (balance < amount) {
1004-
await setERC20TokenBalance(nick.address, weth, amount + balance, hre);
1007+
const balance = await weth.balanceOf(nick.address);
1008+
if (balance.lt(amount)) {
1009+
await setERC20TokenBalance(
1010+
nick.address,
1011+
weth,
1012+
amount.add(balance),
1013+
hre
1014+
);
10051015
}
10061016
await weth
10071017
.connect(nick)
@@ -1013,11 +1023,16 @@ describe("Curve AMO OETH strategy", function () {
10131023
// prettier-ignore
10141024
await curvePool
10151025
.connect(nick)["add_liquidity(uint256[],uint256)"]([amount, 0], 0);
1016-
} else if (balanceHardAsset.sub(balanceOToken) < 0) {
1026+
} else if (balanceHardAsset.sub(balanceOToken).lt(0)) {
10171027
const amount = balanceOToken.sub(balanceHardAsset);
1018-
const balance = weth.balanceOf(nick.address);
1019-
if (balance < amount) {
1020-
await setERC20TokenBalance(nick.address, weth, amount + balance, hre);
1028+
const balance = await weth.balanceOf(nick.address);
1029+
if (balance.lt(amount)) {
1030+
await setERC20TokenBalance(
1031+
nick.address,
1032+
weth,
1033+
amount.add(balance),
1034+
hre
1035+
);
10211036
}
10221037
await weth.connect(nick).approve(curvePool.address, 0);
10231038
await weth.connect(nick).approve(curvePool.address, amount);
@@ -1041,11 +1056,11 @@ describe("Curve AMO OETH strategy", function () {
10411056

10421057
if (wethAmount) {
10431058
const balance = await weth.balanceOf(nick.address);
1044-
if (balance < wethAmount) {
1059+
if (balance.lt(wethAmount)) {
10451060
await setERC20TokenBalance(
10461061
nick.address,
10471062
weth,
1048-
wethAmount + balance,
1063+
wethAmount.add(balance),
10491064
hre
10501065
);
10511066
}
@@ -1056,7 +1071,7 @@ describe("Curve AMO OETH strategy", function () {
10561071
.connect(nick)["add_liquidity(uint256[],uint256)"]([0, wethAmount], 0);
10571072
} else {
10581073
const balance = await weth.balanceOf(nick.address);
1059-
if (balance < ousdAmount) {
1074+
if (balance.lt(ousdAmount)) {
10601075
await setERC20TokenBalance(
10611076
nick.address,
10621077
weth,

contracts/test/strategies/curve-amo-ousd.mainnet.fork-test.js

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,13 @@ describe("Curve AMO OUSD strategy", function () {
163163
);
164164

165165
const balance = await usdc.balanceOf(user.address);
166-
if (balance < amount) {
167-
await setERC20TokenBalance(user.address, usdc, amount + balance, hre);
166+
if (balance.lt(amount)) {
167+
await setERC20TokenBalance(
168+
user.address,
169+
usdc,
170+
amount.add(balance),
171+
hre
172+
);
168173
}
169174
await usdc.connect(user).transfer(curveAMOStrategy.address, amount);
170175

@@ -974,8 +979,8 @@ describe("Curve AMO OUSD strategy", function () {
974979
amount = amount || defaultDeposit.div(1e12);
975980

976981
const balance = await usdc.balanceOf(user.address);
977-
if (balance < amount) {
978-
await setERC20TokenBalance(user.address, usdc, amount + balance, hre);
982+
if (balance.lt(amount)) {
983+
await setERC20TokenBalance(user.address, usdc, amount.add(balance), hre);
979984
}
980985

981986
await usdc.connect(user).approve(ousdVault.address, 0);
@@ -1002,9 +1007,14 @@ describe("Curve AMO OUSD strategy", function () {
10021007

10031008
if (balanceHardAsset.sub(balanceOToken) > 0) {
10041009
const amount = balanceHardAsset.sub(balanceOToken).div(1e12);
1005-
const balance = usdc.balanceOf(nick.address);
1006-
if (balance < amount) {
1007-
await setERC20TokenBalance(nick.address, usdc, amount + balance, hre);
1010+
const balance = await usdc.balanceOf(nick.address);
1011+
if (balance.lt(amount)) {
1012+
await setERC20TokenBalance(
1013+
nick.address,
1014+
usdc,
1015+
amount.add(balance),
1016+
hre
1017+
);
10081018
}
10091019
await usdc
10101020
.connect(nick)
@@ -1016,11 +1026,16 @@ describe("Curve AMO OUSD strategy", function () {
10161026
// prettier-ignore
10171027
await curvePool
10181028
.connect(nick)["add_liquidity(uint256[],uint256)"]([amount, 0], 0);
1019-
} else if (balanceHardAsset.sub(balanceOToken) < 0) {
1029+
} else if (balanceHardAsset.sub(balanceOToken).lt(0)) {
10201030
const amount = balanceOToken.sub(balanceHardAsset).div(1e12);
1021-
const balance = usdc.balanceOf(nick.address);
1022-
if (balance < amount) {
1023-
await setERC20TokenBalance(nick.address, usdc, amount + balance, hre);
1031+
const balance = await usdc.balanceOf(nick.address);
1032+
if (balance.lt(amount)) {
1033+
await setERC20TokenBalance(
1034+
nick.address,
1035+
usdc,
1036+
amount.add(balance),
1037+
hre
1038+
);
10241039
}
10251040
await usdc.connect(nick).approve(curvePool.address, 0);
10261041
await usdc.connect(nick).approve(curvePool.address, amount);
@@ -1044,11 +1059,11 @@ describe("Curve AMO OUSD strategy", function () {
10441059

10451060
if (usdcAmount) {
10461061
const balance = await usdc.balanceOf(nick.address);
1047-
if (balance < usdcAmount) {
1062+
if (balance.lt(usdcAmount)) {
10481063
await setERC20TokenBalance(
10491064
nick.address,
10501065
usdc,
1051-
usdcAmount + balance,
1066+
usdcAmount.add(balance),
10521067
hre
10531068
);
10541069
}
@@ -1059,7 +1074,7 @@ describe("Curve AMO OUSD strategy", function () {
10591074
.connect(nick)["add_liquidity(uint256[],uint256)"]([0, usdcAmount], 0);
10601075
} else {
10611076
const balance = await usdc.balanceOf(nick.address);
1062-
if (balance < ousdAmount.div(1e12)) {
1077+
if (balance.lt(ousdAmount.div(1e12))) {
10631078
await setERC20TokenBalance(
10641079
nick.address,
10651080
usdc,

contracts/test/vault/oeth-vault.mainnet.fork-test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,10 @@ describe("ForkTest: OETH Vault", function () {
145145
}
146146
});
147147

148-
it("should have 0.1% redeem fee", async () => {
148+
it("should have redeem fee", async () => {
149149
const { oethVault } = fixture;
150150

151-
expect(await oethVault.redeemFeeBps()).to.equal(10);
151+
expect(await oethVault.redeemFeeBps()).to.equal(1000);
152152
});
153153

154154
it("should return only WETH in redeem calculations", async () => {
@@ -157,7 +157,7 @@ describe("ForkTest: OETH Vault", function () {
157157
const output = await oethVault.calculateRedeemOutputs(oethUnits("123"));
158158
const index = await oethVault.wethAssetIndex();
159159

160-
expect(output[index]).to.equal(oethUnits("123").mul("9990").div("10000"));
160+
expect(output[index]).to.equal(oethUnits("123").mul("9000").div("10000"));
161161

162162
output.map((x, i) => {
163163
if (i !== index.toNumber()) {
@@ -204,7 +204,7 @@ describe("ForkTest: OETH Vault", function () {
204204
await weth.connect(matt).transfer(oethVault.address, oethUnits("1000"));
205205

206206
const amount = oethUnits("10");
207-
const expectedWETH = amount.mul("9990").div("10000");
207+
const expectedWETH = amount.mul("9000").div("10000");
208208

209209
await weth.connect(josh).approve(oethVault.address, amount);
210210

@@ -230,7 +230,7 @@ describe("ForkTest: OETH Vault", function () {
230230
expect(await oeth.balanceOf(oethWhaleAddress)).to.gt(10);
231231

232232
const redeemAmount = parseUnits("10", 18);
233-
const minEth = parseUnits("9.94", 18);
233+
const minEth = parseUnits("9", 18);
234234

235235
// Calculate how much to mint based on the WETH in the vault,
236236
// the withdrawal queue, and the WETH to be redeemed

0 commit comments

Comments
 (0)