ProtocolConfig
This contract defines a set of configurable parameters that are used throughout the protocol. It also defines a set of setter functions for these parameters that can be called by the contract owner.
State Variables
The state variables of this contract are as follows:
feeManager: an instance of theIFeeManagerinterface that manages the fees charged by the protocol.depositFee: auint256that represents the deposit fee charged by the protocol as a percentage of the deposited amount (default is 0.5% or 50 basis points).withdrawFee: auint256that represents the withdrawal fee charged by the protocol as a percentage of the withdrawn amount (default is 0.5% or 50 basis points).rewardFee: auint256that represents the reward fee charged by the protocol as a percentage of the total reward amount (default is 10% or 1000 basis points).withdrawVaultFee: auint256that represents the withdrawal fee charged by the protocol's liquidity vault (default is 1% or 100 basis points).withdrawVaultFeeWindow: auint256that represents the time window during which the withdrawal fee charged by the protocol's liquidity vault is applied (default is 60 days).withdrawVaultFeeWindowStartTime: auint256that represents the start time of the window during which the withdrawal fee charged by the protocol's liquidity vault is applied (default is 0).maxSlippageOfClose: auint256that represents the maximum slippage of converting withdrawn reserves to debt tokens when closing a position (default is 3% or 300 basis points).treasuryFeeRate: auint256that represents the percentage of the deposit/withdraw fee that is directed to the protocol's treasury (default is 0.15% or 30 basis points). *NOT UTILIZED IN THIS VERSION YET*blbStablePoolFeeRate: auint256that represents the percentage of the deposit/withdraw fee that is directed to the protocol's stability pool (default is 0.175% or 35 basis points). *NOT UTILIZED IN THIS VERSION YET*treasury: anaddressthat represents the wallet address of the protocol's treasury.blbUsdcIchiVault: anaddressthat represents the address of the protocol's fee split for ICHI vault. *NOT UTILIZED IN THIS VERSION YET*blbStabilityPool: anaddressthat represents the address *NOT UTILIZED IN THIS VERSION YET*
Functions
initialize
function initialize(address treasury_) external initializerThis function is the initializer function which is called once when the contract is deployed. It sets the initial values for the contract's state variables such as depositFee, withdrawFee, rewardFee, treasuryFeeRate, blbStablePoolFeeRate, blbIchiVaultFeeRate, withdrawVaultFee, maxSlippageOfClose, and treasury. The treasury_ argument is used to set the treasury address for the contract.
startVaultWithdrawFee
function startVaultWithdrawFee() external onlyOwnerThis function is called by the owner to start the timer for the vault withdraw fee window. It sets the withdrawVaultFeeWindowStartTime to the current block timestamp.
setDepositFee
function setDepositFee(uint256 depositFee_) external onlyOwnerThis function is called by the owner to set the deposit fee on isolated collateral provided when opening a leverage position. It sets the deposit fee to the specified depositFee_ argument, which is capped at 20%.
setWithdrawFee
function setWithdrawFee(uint256 withdrawFee_) external onlyOwnerThis function is called by the owner to set the withdraw fee on isolated collateral provided when opening a leverage position. It sets the withdraw fee to the specified withdrawFee_ argument, which is capped at 20%.
setWithdrawVaultFeeWindow
function setWithdrawFeeWindow(uint256 withdrawVaultFeeWindow_) external onlyOwnerThis function is called by the owner to set the withdraw fee window for vaults on collateral supplied to vaults. It sets the window to the specified withdrawVaultFeeWindow_ argument, which is capped at 60 days.
setMaxSlippageOfClose
function setMaxSlippageOfClose(uint256 slippage_) external onlyOwner This function is called by the owner to set the maximum slippage of converting withdrawn reserves to debt tokens when closing position. It sets the maxSlippageOfClose to the specified slippage_ argument, which is capped at 20%.
setRewardFee
function setRewardFee(uint256 rewardFee_) external onlyOwner This function is called by the owner to set the reward fee. This fee applies to any rewards that are earned through a leverage position. It sets the reward fee to the specified rewardFee_ argument, which is capped at 20%.
setFeeDistribution *Not Used in this version yet*
setFeeDistribution(uint256 treasuryFeeRate_, uint256 blbStablePoolFeeRate_, uint256 blbIchiVaultFeeRate_) external onlyOwnerThis function is called by the owner to set the fee distribution rates. It sets the treasuryFeeRate, blbStablePoolFeeRate, and blbIchiVaultFeeRate variables to the specified arguments, and checks that the sum of these values is equal to the DENOMINATOR constant defined in the BlueBerryConst.sol library.
setTreasuryWallet
function setTreasuryWallet(address treasury_) external onlyOwnerThis function is called by the owner to set the treasury address for the contract. It sets the treasury variable to the specified treasury_ argument.
setFeeManager
function setFeeManager(address feeManager_) external onlyOwner This function is called by the owner to set the fee manager address for the contract. It sets the feeManager variable to the specified feeManager_ argument.
setBlbUsdcIchiVault *Not used in this version yet*
function setBlbUsdcIchiVault(address vault_) external onlyOwnerThis function is called by the owner to set the $BLB liquidity pool against stablecoins address for the contract. It sets the blbUsdcIchiVault variable to the specified vault_ argument.
setBlbStabilityPool *Not used in this version yet*
function setBlbStabilityPool(address pool_) external onlyOwnerThis function is called by the owner to set the $BLB liquidity pool against stablecoins address for the contract. It sets the blbStabilityPool variable to the specified pool_ argument.
Last updated