Diff
checker
文本
文本
圖像
文檔
Excel
文件夾
Legal
Enterprise
桌面版
定價
登入
下載 Diffchecker 桌面版
比較文本
尋找兩個文字檔案之間的差異
工具
歷史
即時編輯器
摺疊未變更行
關閉換行
檢視
拆分
統一
比對精度
智能
單詞
字符
語法突出顯示
選擇語法
忽略
文字轉換
前往第一個差異
編輯輸入
Diffchecker Desktop
執行Diffchecker最安全的方式。取得Diffchecker桌面應用程式:您的差異永遠不會離開您的電腦!
取得桌面版
StratFeeManagerInitializable.sol
建立於
2 年前
差異永不過期
清除
匯出
分享
兩個文本完全相同
這兩個文本之間沒有差異
0 刪除
行
總計
刪除
字符
總計
刪除
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
136 行
全部複製
0 新增
行
總計
新增
字符
總計
新增
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
136 行
全部複製
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "../../interfaces/common/IFeeConfig.sol";
import "../../interfaces/common/IFeeConfig.sol";
contract StratFeeManagerInitializable is OwnableUpgradeable, PausableUpgradeable {
contract StratFeeManagerInitializable is OwnableUpgradeable, PausableUpgradeable {
struct CommonAddresses {
struct CommonAddresses {
address vault;
address vault;
address unirouter;
address unirouter;
address keeper;
address keeper;
address strategist;
address strategist;
address beefyFeeRecipient;
address beefyFeeRecipient;
address beefyFeeConfig;
address beefyFeeConfig;
}
}
// common addresses for the strategy
// common addresses for the strategy
address public vault;
address public vault;
address public unirouter;
address public unirouter;
address public keeper;
address public keeper;
address public strategist;
address public strategist;
address public beefyFeeRecipient;
address public beefyFeeRecipient;
IFeeConfig public beefyFeeConfig;
IFeeConfig public beefyFeeConfig;
uint256 constant DIVISOR = 1 ether;
uint256 constant DIVISOR = 1 ether;
uint256 constant public WITHDRAWAL_FEE_CAP = 50;
uint256 constant public WITHDRAWAL_FEE_CAP = 50;
uint256 constant public WITHDRAWAL_MAX = 10000;
uint256 constant public WITHDRAWAL_MAX = 10000;
uint256 internal withdrawalFee;
uint256 internal withdrawalFee;
event SetStratFeeId(uint256 feeId);
event SetStratFeeId(uint256 feeId);
event SetWithdrawalFee(uint256 withdrawalFee);
event SetWithdrawalFee(uint256 withdrawalFee);
event SetVault(address vault);
event SetVault(address vault);
event SetUnirouter(address unirouter);
event SetUnirouter(address unirouter);
event SetKeeper(address keeper);
event SetKeeper(address keeper);
event SetStrategist(address strategist);
event SetStrategist(address strategist);
event SetBeefyFeeRecipient(address beefyFeeRecipient);
event SetBeefyFeeRecipient(address beefyFeeRecipient);
event SetBeefyFeeConfig(address beefyFeeConfig);
event SetBeefyFeeConfig(address beefyFeeConfig);
function __StratFeeManager_init(CommonAddresses calldata _commonAddresses) internal onlyInitializing {
function __StratFeeManager_init(CommonAddresses calldata _commonAddresses) internal onlyInitializing {
__Ownable_init();
__Ownable_init();
__Pausable_init();
__Pausable_init();
vault = _commonAddresses.vault;
vault = _commonAddresses.vault;
unirouter = _commonAddresses.unirouter;
unirouter = _commonAddresses.unirouter;
keeper = _commonAddresses.keeper;
keeper = _commonAddresses.keeper;
strategist = _commonAddresses.strategist;
strategist = _commonAddresses.strategist;
beefyFeeRecipient = _commonAddresses.beefyFeeRecipient;
beefyFeeRecipient = _commonAddresses.beefyFeeRecipient;
beefyFeeConfig = IFeeConfig(_commonAddresses.beefyFeeConfig);
beefyFeeConfig = IFeeConfig(_commonAddresses.beefyFeeConfig);
withdrawalFee = 10;
withdrawalFee = 10;
}
}
// checks that caller is either owner or keeper.
// checks that caller is either owner or keeper.
modifier onlyManager() {
modifier onlyManager() {
_checkManager();
_checkManager();
_;
_;
}
}
function _checkManager() internal view {
function _checkManager() internal view {
require(msg.sender == owner() || msg.sender == keeper, "!manager");
require(msg.sender == owner() || msg.sender == keeper, "!manager");
}
}
// fetch fees from config contract
// fetch fees from config contract
function getFees() internal view returns (IFeeConfig.FeeCategory memory) {
function getFees() internal view returns (IFeeConfig.FeeCategory memory) {
return beefyFeeConfig.getFees(address(this));
return beefyFeeConfig.getFees(address(this));
}
}
// fetch fees from config contract and dynamic deposit/withdraw fees
// fetch fees from config contract and dynamic deposit/withdraw fees
function getAllFees() external view returns (IFeeConfig.AllFees memory) {
function getAllFees() external view returns (IFeeConfig.AllFees memory) {
return IFeeConfig.AllFees(getFees(), depositFee(), withdrawFee());
return IFeeConfig.AllFees(getFees(), depositFee(), withdrawFee());
}
}
function getStratFeeId() external view returns (uint256) {
function getStratFeeId() external view returns (uint256) {
return beefyFeeConfig.stratFeeId(address(this));
return beefyFeeConfig.stratFeeId(address(this));
}
}
function setStratFeeId(uint256 _feeId) external onlyManager {
function setStratFeeId(uint256 _feeId) external onlyManager {
beefyFeeConfig.setStratFeeId(_feeId);
beefyFeeConfig.setStratFeeId(_feeId);
emit SetStratFeeId(_feeId);
emit SetStratFeeId(_feeId);
}
}
// adjust withdrawal fee
// adjust withdrawal fee
function setWithdrawalFee(uint256 _fee) public onlyManager {
function setWithdrawalFee(uint256 _fee) public onlyManager {
require(_fee <= WITHDRAWAL_FEE_CAP, "!cap");
require(_fee <= WITHDRAWAL_FEE_CAP, "!cap");
withdrawalFee = _fee;
withdrawalFee = _fee;
emit SetWithdrawalFee(_fee);
emit SetWithdrawalFee(_fee);
}
}
// set new vault (only for strategy upgrades)
// set new vault (only for strategy upgrades)
function setVault(address _vault) external onlyOwner {
function setVault(address _vault) external onlyOwner {
vault = _vault;
vault = _vault;
emit SetVault(_vault);
emit SetVault(_vault);
}
}
// set new unirouter
// set new unirouter
function setUnirouter(address _unirouter) external onlyOwner {
function setUnirouter(address _unirouter) external onlyOwner {
unirouter = _unirouter;
unirouter = _unirouter;
emit SetUnirouter(_unirouter);
emit SetUnirouter(_unirouter);
}
}
// set new keeper to manage strat
// set new keeper to manage strat
function setKeeper(address _keeper) external onlyManager {
function setKeeper(address _keeper) external onlyManager {
keeper = _keeper;
keeper = _keeper;
emit SetKeeper(_keeper);
emit SetKeeper(_keeper);
}
}
// set new strategist address to receive strat fees
// set new strategist address to receive strat fees
function setStrategist(address _strategist) external {
function setStrategist(address _strategist) external {
require(msg.sender == strategist, "!strategist");
require(msg.sender == strategist, "!strategist");
strategist = _strategist;
strategist = _strategist;
emit SetStrategist(_strategist);
emit SetStrategist(_strategist);
}
}
// set new beefy fee address to receive beefy fees
// set new beefy fee address to receive beefy fees
function setBeefyFeeRecipient(address _beefyFeeRecipient) external onlyOwner {
function setBeefyFeeRecipient(address _beefyFeeRecipient) external onlyOwner {
beefyFeeRecipient = _beefyFeeRecipient;
beefyFeeRecipient = _beefyFeeRecipient;
emit SetBeefyFeeRecipient(_beefyFeeRecipient);
emit SetBeefyFeeRecipient(_beefyFeeRecipient);
}
}
// set new fee config address to fetch fees
// set new fee config address to fetch fees
function setBeefyFeeConfig(address _beefyFeeConfig) external onlyOwner {
function setBeefyFeeConfig(address _beefyFeeConfig) external onlyOwner {
beefyFeeConfig = IFeeConfig(_beefyFeeConfig);
beefyFeeConfig = IFeeConfig(_beefyFeeConfig);
emit SetBeefyFeeConfig(_beefyFeeConfig);
emit SetBeefyFeeConfig(_beefyFeeConfig);
}
}
function depositFee() public virtual view returns (uint256) {
function depositFee() public virtual view returns (uint256) {
return 0;
return 0;
}
}
function withdrawFee() public virtual view returns (uint256) {
function withdrawFee() public virtual view returns (uint256) {
return paused() ? 0 : withdrawalFee;
return paused() ? 0 : withdrawalFee;
}
}
function beforeDeposit() external virtual {}
function beforeDeposit() external virtual {}
}
}
已保存差異
原始文本
開啟檔案
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "../../interfaces/common/IFeeConfig.sol"; contract StratFeeManagerInitializable is OwnableUpgradeable, PausableUpgradeable { struct CommonAddresses { address vault; address unirouter; address keeper; address strategist; address beefyFeeRecipient; address beefyFeeConfig; } // common addresses for the strategy address public vault; address public unirouter; address public keeper; address public strategist; address public beefyFeeRecipient; IFeeConfig public beefyFeeConfig; uint256 constant DIVISOR = 1 ether; uint256 constant public WITHDRAWAL_FEE_CAP = 50; uint256 constant public WITHDRAWAL_MAX = 10000; uint256 internal withdrawalFee; event SetStratFeeId(uint256 feeId); event SetWithdrawalFee(uint256 withdrawalFee); event SetVault(address vault); event SetUnirouter(address unirouter); event SetKeeper(address keeper); event SetStrategist(address strategist); event SetBeefyFeeRecipient(address beefyFeeRecipient); event SetBeefyFeeConfig(address beefyFeeConfig); function __StratFeeManager_init(CommonAddresses calldata _commonAddresses) internal onlyInitializing { __Ownable_init(); __Pausable_init(); vault = _commonAddresses.vault; unirouter = _commonAddresses.unirouter; keeper = _commonAddresses.keeper; strategist = _commonAddresses.strategist; beefyFeeRecipient = _commonAddresses.beefyFeeRecipient; beefyFeeConfig = IFeeConfig(_commonAddresses.beefyFeeConfig); withdrawalFee = 10; } // checks that caller is either owner or keeper. modifier onlyManager() { _checkManager(); _; } function _checkManager() internal view { require(msg.sender == owner() || msg.sender == keeper, "!manager"); } // fetch fees from config contract function getFees() internal view returns (IFeeConfig.FeeCategory memory) { return beefyFeeConfig.getFees(address(this)); } // fetch fees from config contract and dynamic deposit/withdraw fees function getAllFees() external view returns (IFeeConfig.AllFees memory) { return IFeeConfig.AllFees(getFees(), depositFee(), withdrawFee()); } function getStratFeeId() external view returns (uint256) { return beefyFeeConfig.stratFeeId(address(this)); } function setStratFeeId(uint256 _feeId) external onlyManager { beefyFeeConfig.setStratFeeId(_feeId); emit SetStratFeeId(_feeId); } // adjust withdrawal fee function setWithdrawalFee(uint256 _fee) public onlyManager { require(_fee <= WITHDRAWAL_FEE_CAP, "!cap"); withdrawalFee = _fee; emit SetWithdrawalFee(_fee); } // set new vault (only for strategy upgrades) function setVault(address _vault) external onlyOwner { vault = _vault; emit SetVault(_vault); } // set new unirouter function setUnirouter(address _unirouter) external onlyOwner { unirouter = _unirouter; emit SetUnirouter(_unirouter); } // set new keeper to manage strat function setKeeper(address _keeper) external onlyManager { keeper = _keeper; emit SetKeeper(_keeper); } // set new strategist address to receive strat fees function setStrategist(address _strategist) external { require(msg.sender == strategist, "!strategist"); strategist = _strategist; emit SetStrategist(_strategist); } // set new beefy fee address to receive beefy fees function setBeefyFeeRecipient(address _beefyFeeRecipient) external onlyOwner { beefyFeeRecipient = _beefyFeeRecipient; emit SetBeefyFeeRecipient(_beefyFeeRecipient); } // set new fee config address to fetch fees function setBeefyFeeConfig(address _beefyFeeConfig) external onlyOwner { beefyFeeConfig = IFeeConfig(_beefyFeeConfig); emit SetBeefyFeeConfig(_beefyFeeConfig); } function depositFee() public virtual view returns (uint256) { return 0; } function withdrawFee() public virtual view returns (uint256) { return paused() ? 0 : withdrawalFee; } function beforeDeposit() external virtual {} }
更改後文本
開啟檔案
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "../../interfaces/common/IFeeConfig.sol"; contract StratFeeManagerInitializable is OwnableUpgradeable, PausableUpgradeable { struct CommonAddresses { address vault; address unirouter; address keeper; address strategist; address beefyFeeRecipient; address beefyFeeConfig; } // common addresses for the strategy address public vault; address public unirouter; address public keeper; address public strategist; address public beefyFeeRecipient; IFeeConfig public beefyFeeConfig; uint256 constant DIVISOR = 1 ether; uint256 constant public WITHDRAWAL_FEE_CAP = 50; uint256 constant public WITHDRAWAL_MAX = 10000; uint256 internal withdrawalFee; event SetStratFeeId(uint256 feeId); event SetWithdrawalFee(uint256 withdrawalFee); event SetVault(address vault); event SetUnirouter(address unirouter); event SetKeeper(address keeper); event SetStrategist(address strategist); event SetBeefyFeeRecipient(address beefyFeeRecipient); event SetBeefyFeeConfig(address beefyFeeConfig); function __StratFeeManager_init(CommonAddresses calldata _commonAddresses) internal onlyInitializing { __Ownable_init(); __Pausable_init(); vault = _commonAddresses.vault; unirouter = _commonAddresses.unirouter; keeper = _commonAddresses.keeper; strategist = _commonAddresses.strategist; beefyFeeRecipient = _commonAddresses.beefyFeeRecipient; beefyFeeConfig = IFeeConfig(_commonAddresses.beefyFeeConfig); withdrawalFee = 10; } // checks that caller is either owner or keeper. modifier onlyManager() { _checkManager(); _; } function _checkManager() internal view { require(msg.sender == owner() || msg.sender == keeper, "!manager"); } // fetch fees from config contract function getFees() internal view returns (IFeeConfig.FeeCategory memory) { return beefyFeeConfig.getFees(address(this)); } // fetch fees from config contract and dynamic deposit/withdraw fees function getAllFees() external view returns (IFeeConfig.AllFees memory) { return IFeeConfig.AllFees(getFees(), depositFee(), withdrawFee()); } function getStratFeeId() external view returns (uint256) { return beefyFeeConfig.stratFeeId(address(this)); } function setStratFeeId(uint256 _feeId) external onlyManager { beefyFeeConfig.setStratFeeId(_feeId); emit SetStratFeeId(_feeId); } // adjust withdrawal fee function setWithdrawalFee(uint256 _fee) public onlyManager { require(_fee <= WITHDRAWAL_FEE_CAP, "!cap"); withdrawalFee = _fee; emit SetWithdrawalFee(_fee); } // set new vault (only for strategy upgrades) function setVault(address _vault) external onlyOwner { vault = _vault; emit SetVault(_vault); } // set new unirouter function setUnirouter(address _unirouter) external onlyOwner { unirouter = _unirouter; emit SetUnirouter(_unirouter); } // set new keeper to manage strat function setKeeper(address _keeper) external onlyManager { keeper = _keeper; emit SetKeeper(_keeper); } // set new strategist address to receive strat fees function setStrategist(address _strategist) external { require(msg.sender == strategist, "!strategist"); strategist = _strategist; emit SetStrategist(_strategist); } // set new beefy fee address to receive beefy fees function setBeefyFeeRecipient(address _beefyFeeRecipient) external onlyOwner { beefyFeeRecipient = _beefyFeeRecipient; emit SetBeefyFeeRecipient(_beefyFeeRecipient); } // set new fee config address to fetch fees function setBeefyFeeConfig(address _beefyFeeConfig) external onlyOwner { beefyFeeConfig = IFeeConfig(_beefyFeeConfig); emit SetBeefyFeeConfig(_beefyFeeConfig); } function depositFee() public virtual view returns (uint256) { return 0; } function withdrawFee() public virtual view returns (uint256) { return paused() ? 0 : withdrawalFee; } function beforeDeposit() external virtual {} }
尋找差異