-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
26100bd
commit bb8ff99
Showing
5 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
pragma solidity ^0.8.24; | ||
|
||
import { IERC4626 } from "@openzeppelin/contracts/interfaces/IERC4626.sol"; | ||
import { IPermit2 } from "permit2/src/interfaces/IPermit2.sol"; | ||
|
||
import { IWETH } from "@balancer-labs/v3-interfaces/contracts/solidity-utils/misc/IWETH.sol"; | ||
import { IVault } from "@balancer-labs/v3-interfaces/contracts/vault/IVault.sol"; | ||
|
||
import { MevRouter } from "../MevRouter.sol"; | ||
|
||
string constant MOCK_MEV_ROUTER_VERSION = "Mock Router v1"; | ||
|
||
contract MevRouterMock is MevRouter { | ||
error MockErrorCode(); | ||
|
||
constructor( | ||
IVault vault, | ||
IWETH weth, | ||
IPermit2 permit2, | ||
MevRouterParams memory params | ||
) MevRouter(vault, weth, permit2, MOCK_MEV_ROUTER_VERSION, params) { | ||
// solhint-disable-previous-line no-empty-blocks | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
pragma solidity ^0.8.24; | ||
|
||
import { IMevTaxCollector } from "@balancer-labs/v3-interfaces/contracts/vault/IMevTaxCollector.sol"; | ||
|
||
contract MevTaxCollectorMock is IMevTaxCollector { | ||
function chargeMevTax(address pool) external payable { | ||
return; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
pragma solidity ^0.8.24; | ||
|
||
import "forge-std/Test.sol"; | ||
|
||
import { IAuthentication } from "@balancer-labs/v3-interfaces/contracts/solidity-utils/helpers/IAuthentication.sol"; | ||
import { IMevRouter } from "@balancer-labs/v3-interfaces/contracts/vault/IMevRouter.sol"; | ||
|
||
import { BaseVaultTest } from "./utils/BaseVaultTest.sol"; | ||
|
||
contract MevRouterTest is BaseVaultTest { | ||
function setUp() public override { | ||
super.setUp(); | ||
|
||
authorizer.grantRole(mevRouter.getActionId(IMevRouter.disableMevTax.selector), admin); | ||
authorizer.grantRole(mevRouter.getActionId(IMevRouter.enableMevTax.selector), admin); | ||
} | ||
|
||
function testDisableMevTax() public { | ||
assertTrue(mevRouter.isMevTaxEnabled(), "Mev Tax is not enabled"); | ||
vm.prank(admin); | ||
mevRouter.disableMevTax(); | ||
assertFalse(mevRouter.isMevTaxEnabled(), "Mev Tax is not disabled"); | ||
} | ||
|
||
function testDisableMevTaxIsAuthenticated() public { | ||
vm.expectRevert(IAuthentication.SenderNotAllowed.selector); | ||
mevRouter.disableMevTax(); | ||
} | ||
|
||
function testEnableMevTax() public { | ||
vm.prank(admin); | ||
mevRouter.disableMevTax(); | ||
assertFalse(mevRouter.isMevTaxEnabled(), "Mev Tax is not disabled"); | ||
vm.prank(admin); | ||
mevRouter.enableMevTax(); | ||
assertTrue(mevRouter.isMevTaxEnabled(), "Mev Tax is not enabled"); | ||
} | ||
|
||
function testEnableMevTaxIsAuthenticated() public { | ||
vm.expectRevert(IAuthentication.SenderNotAllowed.selector); | ||
mevRouter.enableMevTax(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters