Diff
checker
テキスト
テキスト
画像
ドキュメント
Excel
フォルダ
Legal
Enterprise
デスクトップ
料金
ログイン
Diffchecker デスクトップのダウンロード
テキスト比較
2 つのテキスト ファイルの違いを見つける
ツール
履歴
ライブエディター
未変更行を折りたたむ
折り返しなし
レイアウト
分割
統合
比較精度
スマート
単語
文字
シンタックスハイライト
構文を選択
無視
テキスト変換
最初の差分へ移動
入力を編集
Diffchecker Desktop
Diffcheckerを実行する最も安全な方法。Diffchecker Desktopアプリを入手:あなたの差分はコンピューターから出ることはありません!
Desktopを入手
StratFeeManagerInitializable.sol
作成日
2 年前
差分は期限切れになりません
クリア
エクスポート
共有
2つのテキストは同一です
これら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 {} }
違いを見つける