Add strategy. Once a strategy is added it can call rebalance and borrow funds from pool and invest those funds in provider/lender.
Recalculate pool level external deposit fee after all state variables are updated.
Name
Type
Description
_strategy
address
Strategy address
_debtRatio
uint256
Pool fund allocation to this strategy
_externalDepositFee
uint256
External deposit fee of strategy
setup
1
functionsetup()external
Copied!
OnlyPool:: Helper function for V5 upgrade
removeStrategy
1
functionremoveStrategy(uint256 _index)external
Copied!
Remove strategy and recalculate pool level external deposit fee.
Revoke and remove strategy from array. Update withdraw queue. Withdraw queue order should not change after remove. Strategy can be removed only after it has paid all debt. Use migrate strategy if debt is not paid and want to upgrade strategy.
Recalculate pool external deposit fee. It is calculated using debtRatio and external deposit fee of each strategy.
Whenever debtRatio changes recalculation is required. DebtRatio changes if strategy reports loss and in that case an off chain application can watch for it and take action accordingly. This function is gas heavy hence we do not want to call during reportLoss.
Update withdraw queue. Withdraw queue is list of strategy in the order in which funds should be withdrawn.
Pool always keep some buffer amount to satisfy withdrawal request, any withdrawal request higher than buffer will withdraw from withdraw queue. So withdrawQueue[0] will be the first strategy where withdrawal request will be send.
Migrating strategy aka old and new strategy should be of same type. New strategy will replace old strategy in strategy mapping, strategies array, withdraw queue.
yield generated by strategy. Strategy get performance fee on this amount
_loss
uint256
Reduce debt ,also reduce debtRatio, increase loss in record.
_payback
uint256
strategy willing to payback outstanding above debtLimit. no performance fee on this amount. when governance has reduced debtRatio of strategy, strategy will report profit and payback amount separately.
Get available credit limit of strategy. This is the amount strategy can borrow from pool
Available credit limit is calculated based on current debt of pool and strategy, current debt limit of pool and strategy. credit available = min(pool's debt limit, strategy's debt limit, max debt per rebalance) when some strategy do not pay back outstanding debt, this impact credit line of other strategy if totalDebt of pool >= debtLimit of pool