Skip to content

Commit 97f1e5c

Browse files
committed
building with protocol fee owner
1 parent 503245f commit 97f1e5c

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

src/EulerSwapFactory.sol

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ import {EVCUtil} from "ethereum-vault-connector/utils/EVCUtil.sol";
66
import {GenericFactory} from "evk/GenericFactory/GenericFactory.sol";
77

88
import {EulerSwap} from "./EulerSwap.sol";
9+
import {ProtocolFee} from "./utils/ProtocolFee.sol";
910
import {MetaProxyDeployer} from "./MetaProxyDeployer.sol";
1011

1112
/// @title EulerSwapFactory contract
1213
/// @custom:security-contact [email protected]
1314
/// @author Euler Labs (https://www.eulerlabs.com/)
14-
contract EulerSwapFactory is IEulerSwapFactory, EVCUtil {
15+
contract EulerSwapFactory is IEulerSwapFactory, EVCUtil, ProtocolFee {
1516
/// @dev An array to store all pools addresses.
1617
address[] private allPools;
1718
/// @dev Vaults must be deployed by this factory
@@ -33,7 +34,10 @@ contract EulerSwapFactory is IEulerSwapFactory, EVCUtil {
3334
error InvalidVaultImplementation();
3435
error SliceOutOfBounds();
3536

36-
constructor(address evc, address evkFactory_, address eulerSwapImpl_) EVCUtil(evc) {
37+
constructor(address evc, address evkFactory_, address eulerSwapImpl_, address feeOwner_)
38+
EVCUtil(evc)
39+
ProtocolFee(feeOwner_)
40+
{
3741
evkFactory = evkFactory_;
3842
eulerSwapImpl = eulerSwapImpl_;
3943
}
@@ -51,6 +55,10 @@ contract EulerSwapFactory is IEulerSwapFactory, EVCUtil {
5155

5256
uninstall(params.eulerAccount);
5357

58+
// set protocol fee
59+
params.protocolFee = protocolFee;
60+
params.protocolFeeRecipient = protocolFeeRecipient;
61+
5462
EulerSwap pool = EulerSwap(
5563
MetaProxyDeployer.deployMetaProxy(
5664
eulerSwapImpl, abi.encode(params), keccak256(abi.encode(params.eulerAccount, salt))

src/utils/ProtocolFee.sol

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
pragma solidity ^0.8.27;
3+
4+
import {Owned} from "solmate/src/auth/Owned.sol";
5+
6+
abstract contract ProtocolFee is Owned {
7+
uint256 public protocolFee;
8+
address public protocolFeeRecipient;
9+
10+
error InvalidFee();
11+
12+
constructor(address _feeOwner) Owned(_feeOwner) {}
13+
14+
/// @notice Set the protocol fee, expressed as a percentage of LP fee
15+
/// @param newFee The new protocol fee, in WAD units (0.10e18 = 10%)
16+
function setProtocolFee(uint256 newFee) external onlyOwner {
17+
require(newFee < 1e18, InvalidFee());
18+
protocolFee = newFee;
19+
}
20+
21+
function setProtocolFeeRecipient(address newRecipient) external onlyOwner {
22+
protocolFeeRecipient = newRecipient;
23+
}
24+
}

test/EulerSwapTestBase.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ contract EulerSwapTestBase is EVaultTestBase {
3838

3939
function deployEulerSwap(address poolManager_) public {
4040
eulerSwapImpl = address(new EulerSwap(address(evc), poolManager_));
41-
eulerSwapFactory = new EulerSwapFactory(address(evc), address(factory), eulerSwapImpl);
41+
eulerSwapFactory = new EulerSwapFactory(address(evc), address(factory), eulerSwapImpl, address(this));
4242
periphery = new EulerSwapPeriphery();
4343
}
4444

0 commit comments

Comments
 (0)