Beefy
English
Ask or search…
K

StratFeeManager Contract

Last Update: February 2023
The StratFeeManager Contract is collection of important dependencies which are imported and used in every Beefy Strategy Contract.
Originally, these dependencies were split into two contracts - StratManager.sol and FeeManager.sol. After the move to Solidity V0.8, the two were combined into a single contract - StratFeeManager.sol. The current verison - StratFeeManagerInitializable.sol - facilitated a move to proxy clone strategies (which must be initialized with the relevant arguments for the strategy and its dependencies), to avoid the need to deploy every single strategy individually.

Dependencies

The StratFeeManager contracts also introduce addition dependencies themselves, specifically Ownable.sol - which introduces functionality to set a contract's owner and restrict functionality to them alone - and Pausable.sol - which introduces functionality to freeze functionality in a contract by putting the contract on pause. Both dependencies are ultimately included in every Beefy Strategy Contract.

Modifiers

Introduces an onlyManager() modifier to constrain functions to use by the strategy manager only.
modifier onlyManager() {
require(msg.sender == owner() || msg.sender == keeper, "!manager");
_;
}

View Functions

getFees()

Returns the value of all fees from the fee configuration contract.
function getFees() internal view returns (IFeeConfig.FeeCategory memory) {
return beefyFeeConfig.getFees(address(this));
}

getAllFees()

Returns the value of all fees from the fee configuration contract, as well the dynamic deposit and withdrawal fees.
function getAllFees() external view returns (IFeeConfig.AllFees memory) {
return IFeeConfig.AllFees(getFees(), depositFee(), withdrawFee());
}

getStratFeeId()

Returns the integer value of the strategy fee ID from the fee configuration contract.
function getStratFeeId() external view returns (uint256) {
return beefyFeeConfig.stratFeeId(address(this));
}

Write Functions

setStratFeeId()

Sets a new integer value for the strategy's fee ID, which indicates the relevant fee for the strategy.
function setStratFeeId(uint256 _feeId) external onlyManager {
beefyFeeConfig.setStratFeeId(_feeId);
emit SetStratFeeId(_feeId);
}

setWithdrawalFee()

Sets a new integer value for the contract's withdrawal fee which is charged on each harvest.
function setWithdrawalFee(uint256 _fee) public onlyManager {
require(_fee <= WITHDRAWAL_FEE_CAP, "!cap");
withdrawalFee = _fee;
emit SetWithdrawalFee(_fee);
}

setVault()

Sets a new address for the contract's vault, which manages user funds.
function setVault(address _vault) external onlyOwner {
vault = _vault;
emit SetVault(_vault);
}

setUnirouter()

Sets a new address for the contract's router which processes swaps within the contract.
function setUnirouter(address _unirouter) external onlyOwner {
unirouter = _unirouter;
emit SetUnirouter(_unirouter);
}

setKeeper()

Sets a new address for the contract's keeper, who can "panic" the strategy.
function setKeeper(address _keeper) external onlyManager {
keeper = _keeper;
emit SetKeeper(_keeper);
}

setStrategist()

Sets a new address for the contract's strategist who receives the strategist fee.
function setStrategist(address _strategist) external {
require(msg.sender == strategist, "!strategist");
strategist = _strategist;
emit SetStrategist(_strategist);
}

setBeefyFeeRecipient()

Sets a new address for the recipient of Beefy's fee on harvests, typically a Beefy treasury contract.
function setBeefyFeeRecipient(address _beefyFeeRecipient) external onlyOwner {
beefyFeeRecipient = _beefyFeeRecipient;
emit SetBeefyFeeRecipient(_beefyFeeRecipient);
}

setBeefyFeeConfig()

Sets a new address for the fee configuration contract used by the strategy to fetch fees.
function setBeefyFeeConfig(address _beefyFeeConfig) external onlyOwner {
beefyFeeConfig = IFeeConfig(_beefyFeeConfig);
emit SetBeefyFeeConfig(_beefyFeeConfig);
}
Last modified 1yr ago