added adjuster role to FeeManager
This commit is contained in:
@@ -68,6 +68,7 @@ contract FeeManager is IFeeManager {
|
||||
|
||||
|
||||
address public immutable override admin;
|
||||
address public override adjuster;
|
||||
|
||||
address payable public override orderFeeAccount;
|
||||
address payable public override gasFeeAccount;
|
||||
@@ -83,6 +84,7 @@ contract FeeManager is IFeeManager {
|
||||
FeeSchedule limits;
|
||||
|
||||
address admin;
|
||||
address adjuster;
|
||||
address payable orderFeeAccount;
|
||||
address payable gasFeeAccount;
|
||||
address payable fillFeeAccount;
|
||||
@@ -127,6 +129,12 @@ contract FeeManager is IFeeManager {
|
||||
}
|
||||
|
||||
|
||||
modifier onlyAdminOrAdjuster() {
|
||||
require(msg.sender == admin || msg.sender == adjuster, "not admin or adjuster");
|
||||
_;
|
||||
}
|
||||
|
||||
|
||||
function _push() internal {
|
||||
// if existing proposals have become active, set them as the main schedules.
|
||||
if (proposedLimitActivationTime != 0 && proposedLimitActivationTime <= block.timestamp) {
|
||||
@@ -155,7 +163,7 @@ contract FeeManager is IFeeManager {
|
||||
}
|
||||
|
||||
|
||||
function setFees(FeeSchedule calldata sched) public override onlyAdmin {
|
||||
function setFees(FeeSchedule calldata sched) public override onlyAdminOrAdjuster {
|
||||
_push();
|
||||
|
||||
// check limits
|
||||
@@ -187,10 +195,12 @@ contract FeeManager is IFeeManager {
|
||||
|
||||
|
||||
function setFeeAccounts(
|
||||
address adjuster_,
|
||||
address payable fillFeeAccount_,
|
||||
address payable orderFeeAccount_,
|
||||
address payable gasFeeAccount_
|
||||
) public override onlyAdmin {
|
||||
adjuster = adjuster_;
|
||||
fillFeeAccount = fillFeeAccount_;
|
||||
orderFeeAccount = orderFeeAccount_;
|
||||
gasFeeAccount = gasFeeAccount_;
|
||||
|
||||
@@ -43,19 +43,23 @@ interface IFeeManager {
|
||||
// The admin account may change the fees, limits, and fee account addresses.
|
||||
function admin() external view returns (address);
|
||||
|
||||
// The adjuster account may change the fees.
|
||||
function adjuster() external view returns (address);
|
||||
|
||||
// The three fee types are each sent to a separate address for accounting.
|
||||
function orderFeeAccount() external view returns (address payable);
|
||||
function gasFeeAccount() external view returns (address payable);
|
||||
function fillFeeAccount() external view returns (address payable);
|
||||
|
||||
// The admin may change the fees within the limits after only a short delay
|
||||
// The admin or the adjuster may change the fees within the limits after only a short delay
|
||||
function setFees(FeeSchedule calldata sched) external;
|
||||
|
||||
// The admin may change the fee limits themselves after a long delay
|
||||
// Only the admin may change the fee limits themselves after a long delay
|
||||
function setLimits(FeeSchedule calldata sched) external;
|
||||
|
||||
// The admin may adjust the destination of fees at any time
|
||||
function setFeeAccounts(
|
||||
address adjuster,
|
||||
address payable fillFeeAccount,
|
||||
address payable orderFeeAccount,
|
||||
address payable gasFeeAccount
|
||||
|
||||
@@ -12,12 +12,13 @@ library FeeManagerLib {
|
||||
|
||||
|
||||
function defaultFeeManager(address payable owner) internal returns (FeeManager) {
|
||||
return FeeManagerLib.defaultFeeManager(owner, owner, owner, owner);
|
||||
return FeeManagerLib.defaultFeeManager(owner, owner, owner, owner, owner);
|
||||
}
|
||||
|
||||
|
||||
function defaultFeeManager(
|
||||
address admin,
|
||||
address adjuster,
|
||||
address payable orderFeeAccount,
|
||||
address payable gasFeeAccount,
|
||||
address payable fillFeeAccount
|
||||
@@ -47,7 +48,7 @@ library FeeManagerLib {
|
||||
);
|
||||
FeeManager.ConstructorArgs memory args = FeeManager.ConstructorArgs(
|
||||
limitChangeNoticeDuration, feeChangeNoticeDuration, maxIncreaseOrderFeePct, maxIncreaseTrancheFeePct,
|
||||
fees, limits, admin, orderFeeAccount, gasFeeAccount, fillFeeAccount
|
||||
fees, limits, admin, adjuster, orderFeeAccount, gasFeeAccount, fillFeeAccount
|
||||
);
|
||||
return new FeeManager(args);
|
||||
}
|
||||
@@ -60,12 +61,13 @@ library FeeManagerLib {
|
||||
|
||||
|
||||
function freeFeeManager(address payable owner) internal returns (FeeManager) {
|
||||
return FeeManagerLib.freeFeeManager(owner, owner, owner, owner);
|
||||
return FeeManagerLib.freeFeeManager(owner, owner, owner, owner, owner);
|
||||
}
|
||||
|
||||
|
||||
function freeFeeManager(
|
||||
address admin,
|
||||
address adjuster,
|
||||
address payable orderFeeAccount,
|
||||
address payable gasFeeAccount,
|
||||
address payable fillFeeAccount
|
||||
@@ -94,7 +96,7 @@ library FeeManagerLib {
|
||||
);
|
||||
FeeManager.ConstructorArgs memory args = FeeManager.ConstructorArgs(
|
||||
limitChangeNoticeDuration, feeChangeNoticeDuration, maxIncreaseOrderFeePct, maxIncreaseTrancheFeePct,
|
||||
fees, limits, admin, orderFeeAccount, gasFeeAccount, fillFeeAccount
|
||||
fees, limits, admin, adjuster, orderFeeAccount, gasFeeAccount, fillFeeAccount
|
||||
);
|
||||
return new FeeManager(args);
|
||||
}
|
||||
@@ -106,12 +108,13 @@ library FeeManagerLib {
|
||||
|
||||
|
||||
function debugFeeManager(address payable owner) internal returns (FeeManager) {
|
||||
return FeeManagerLib.debugFeeManager(owner, owner, owner, owner);
|
||||
return FeeManagerLib.debugFeeManager(owner, owner, owner, owner, owner);
|
||||
}
|
||||
|
||||
|
||||
function debugFeeManager(
|
||||
address admin,
|
||||
address adjuster,
|
||||
address payable orderFeeAccount,
|
||||
address payable gasFeeAccount,
|
||||
address payable fillFeeAccount
|
||||
@@ -143,7 +146,7 @@ library FeeManagerLib {
|
||||
);
|
||||
FeeManager.ConstructorArgs memory args = FeeManager.ConstructorArgs(
|
||||
limitChangeNoticeDuration, feeChangeNoticeDuration, maxIncreaseOrderFeePct, maxIncreaseTrancheFeePct,
|
||||
fees, limits, admin, orderFeeAccount, gasFeeAccount, fillFeeAccount
|
||||
fees, limits, admin, adjuster, orderFeeAccount, gasFeeAccount, fillFeeAccount
|
||||
);
|
||||
return new FeeManager(args);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import "@forge-std/console2.sol";
|
||||
|
||||
library VaultAddress {
|
||||
// keccak-256 hash of the Vault's bytecode (not the deployed bytecode but the initialization bytecode)
|
||||
bytes32 public constant VAULT_INIT_CODE_HASH = 0xe5e6257bee9f182ff5b35a3356108ff2bc9bb2ac3017abc40a342f8d338d4d77;
|
||||
bytes32 public constant VAULT_INIT_CODE_HASH = 0x8b1347850b0b1f2e05548c065af07c78f2c0617f70a2915b3cb7e0ba1bd20630;
|
||||
|
||||
// the contract being constructed must not have any constructor arguments or the determinism will be broken.
|
||||
// instead, use a callback to get construction arguments
|
||||
|
||||
Reference in New Issue
Block a user