Diff
checker
Text
Text
Images
Documents
Excel
Folders
Legal
Enterprise
Desktop
Pricing
Sign in
Download Diffchecker Desktop
Compare text
Find the difference between two text files
Tools
History
Real-time editor
Hide unchanged lines
Disable line wrap
Layout
Split
Unified
Diff precision
Smart
Word
Char
Syntax highlighting
Choose syntax
Ignore
Transform text
Go to first change
Edit input
Diffchecker Desktop
The most secure way to run Diffchecker. Get the Diffchecker Desktop app: your diffs never leave your computer!
Get Desktop
StratFeeManagerInitializable.sol
Created
2 years ago
Diff never expires
Clear
Export
Share
The two texts are identical
There is no difference to show between these two texts
0 removals
Lines
Total
Removed
Characters
Total
Removed
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
136 lines
Copy
0 additions
Lines
Total
Added
Characters
Total
Added
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
136 lines
Copy
// 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 {}
}
}
Saved diffs
Original text
Open file
// 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 {} }
Changed text
Open file
// 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 {} }
Find difference