Diff
checker
Text
Text
Bilder
Dokumente
Excel
Ordner
Legal
Enterprise
Desktop-App
Preise
Einloggen
Diffchecker Desktop herunterladen
Texte vergleichen
Finde den Unterschied zwischen zwei Textdateien
Werkzeuge
Verlauf
Live-Editor
Gleiches ausblenden
Zeilenumbruch aus
Ansicht
Zweispaltig
Einspaltig
Vergleichsgenauigkeit
Intelligent
Wort
Zeichen
Syntaxhervorhebung
Syntax auswählen
Ignorieren
Text umwandeln
Zur ersten Änderung
Eingabe bearbeiten
Diffchecker Desktop
Der sicherste Weg, Diffchecker zu nutzen. Hol dir die Desktop-App: Deine Diffs verlassen nie deinen Computer!
Desktop holen
StratFeeManagerInitializable.sol
Erstellt
vor 2 Jahren
Diff läuft nie ab
Löschen
Exportieren
Teilen
Die beiden Texte sind identisch
Es gibt keinen Unterschied zwischen diesen beiden Texten
0 Entfernungen
Zeilen
Gesamt
Entfernt
Zeichen
Gesamt
Entfernt
Um diese Funktion weiterhin zu nutzen, aktualisiere auf
Diff
checker
Pro
Preise anzeigen
136 Zeilen
Kopieren
0 Hinzufügungen
Zeilen
Gesamt
Hinzugefügt
Zeichen
Gesamt
Hinzugefügt
Um diese Funktion weiterhin zu nutzen, aktualisiere auf
Diff
checker
Pro
Preise anzeigen
136 Zeilen
Kopieren
// 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 {}
}
}
Gespeicherte Diffs
Originaltext
Datei öffnen
// 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 {} }
Bearbeitung
Datei öffnen
// 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 {} }
Unterschied finden