Diff
checker
Texto
Texto
Imagens
Documentos
Excel
Pastas
Legal
Enterprise
Aplicativo para desktop
Preços
Fazer login
Baixar o Diffchecker Desktop
Comparar texto
Encontre a diferença entre dois arquivos de texto
Ferramentas
Histórico
Editor live
Recolher inalteradas
Sem quebra de linha
Layout
Dividido
Unificado
Nível de detalhe
Inteligente
Palavra
Caractere
Realce de sintaxe
Escolher sintaxe
Ignorar
Transformar texto
Ir à primeira mudança
Editar entrada
Diffchecker Desktop
A maneira mais segura de usar o Diffchecker. Obtenha o aplicativo Diffchecker Desktop: seus diffs nunca saem do seu computador!
Obter Desktop
StratFeeManagerInitializable.sol
Criado
há 2 anos
O diff nunca expira
Limpar
Exportar
Compartilhar
Os dois textos são idênticos
Não há diferença entre estes dois textos
0 remoções
Linhas
Total
Removido
Caracteres
Total
Removido
Para continuar usando este recurso, atualize para
Diff
checker
Pro
Ver preços
136 linhas
Copiar tudo
0 adições
Linhas
Total
Adicionado
Caracteres
Total
Adicionado
Para continuar usando este recurso, atualize para
Diff
checker
Pro
Ver preços
136 linhas
Copiar tudo
// 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 {}
}
}
Diferenças salvas
Texto original
Abrir arquivo
// 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 {} }
Texto alterado
Abrir arquivo
// 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 {} }
Encontrar Diferença