-
Notifications
You must be signed in to change notification settings - Fork 40
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
Showing
8 changed files
with
163 additions
and
33 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
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
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,39 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity ^0.8.20; | ||
|
||
import '../libraries/AdaptiveFee.sol'; | ||
import './DynamicFeeModule.sol'; | ||
|
||
|
||
contract DynamicFeeModuleFactory { | ||
event DefaultFeeConfiguration(AlgebraFeeConfiguration newConfig); | ||
|
||
bytes32 public constant ALGEBRA_BASE_PLUGIN_FACTORY_ADMINISTRATOR = keccak256('ALGEBRA_BASE_PLUGIN_FACTORY_ADMINISTRATOR'); | ||
|
||
address public immutable algebraFactory; | ||
|
||
AlgebraFeeConfiguration public defaultFeeConfiguration; // values of constants for sigmoids in fee calculation formula | ||
|
||
modifier onlyAdministrator() { | ||
require(IAlgebraFactory(algebraFactory).hasRoleOrOwner(ALGEBRA_BASE_PLUGIN_FACTORY_ADMINISTRATOR, msg.sender), 'Only administrator'); | ||
_; | ||
} | ||
|
||
constructor(address _algebraFactory) { | ||
algebraFactory = _algebraFactory; | ||
defaultFeeConfiguration = AdaptiveFee.initialFeeConfiguration(); | ||
} | ||
|
||
function setDefaultFeeConfiguration(AlgebraFeeConfiguration calldata newConfig) external onlyAdministrator { | ||
AdaptiveFee.validateFeeConfiguration(newConfig); | ||
defaultFeeConfiguration = newConfig; | ||
emit DefaultFeeConfiguration(newConfig); | ||
} | ||
|
||
function deploy(address oracleModule, address modularHub) external returns (address) { | ||
DynamicFeeModule dynamicFeeModule = new DynamicFeeModule(algebraFactory, address(this), oracleModule, modularHub); | ||
dynamicFeeModule.changeFeeConfiguration(defaultFeeConfiguration); | ||
|
||
return address(dynamicFeeModule); | ||
} | ||
} |
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
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