Skip to content

Commit 71b362d

Browse files
authored
[OUSD-13] removeStrategy() Does Not Reset Mint Whitelist Flag. (#2778)
* Reset mintWhiteList flag when removing strategy. * Add test to reset mint whitelist flag when removing a strategy
1 parent 0f516d5 commit 71b362d

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

contracts/contracts/vault/VaultAdmin.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ abstract contract VaultAdmin is VaultCore {
200200

201201
// Mark the strategy as not supported
202202
strategies[_addr].isSupported = false;
203+
isMintWhitelistedStrategy[_addr] = false;
203204

204205
// Withdraw all asset
205206
IStrategy strategy = IStrategy(_addr);

contracts/test/vault/oeth-vault.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,39 @@ describe("OETH Vault", function () {
256256
weth.address,
257257
]);
258258
});
259+
260+
it("Should reset mint whitelist flag when removing a strategy", async () => {
261+
const { oethVault, weth, governor } = fixture;
262+
263+
// Deploy a mock strategy that can be removed
264+
const dMockStrategy = await deployWithConfirmation("MockStrategy");
265+
const mockStrategy = await ethers.getContractAt(
266+
"MockStrategy",
267+
dMockStrategy.address
268+
);
269+
270+
// Set up the mock strategy to support withdrawAll
271+
await mockStrategy.setWithdrawAll(weth.address, oethVault.address);
272+
273+
// Approve the strategy
274+
await oethVault.connect(governor).approveStrategy(mockStrategy.address);
275+
276+
// Add strategy to mint whitelist
277+
await oethVault
278+
.connect(governor)
279+
.addStrategyToMintWhitelist(mockStrategy.address);
280+
281+
// Verify it's whitelisted
282+
expect(await oethVault.isMintWhitelistedStrategy(mockStrategy.address)).to
283+
.be.true;
284+
285+
// Remove the strategy
286+
await oethVault.connect(governor).removeStrategy(mockStrategy.address);
287+
288+
// Verify the mint whitelist flag is reset
289+
expect(await oethVault.isMintWhitelistedStrategy(mockStrategy.address)).to
290+
.be.false;
291+
});
259292
});
260293

261294
describe("Remove Asset", () => {

0 commit comments

Comments
 (0)