PoolAccountant
PoolAccountant
This contract is the "accountant" for Vesper pools which keeps records of strategies. Each deployed pool has one associated accountant.
VERSION
MAX_BPS
EarningReported
LossReported
StrategyAdded
StrategyRemoved
StrategyMigrated
UpdatedExternalDepositFee
UpdatedPoolExternalDepositFee
UpdatedStrategyDebtRatio
init
This init function meant to be called after proxy deployment. DO NOT CALL it with proxy deploy; only after the proxy has been successfully deployed.
_pool
address
Address of Vesper pool proxy
addStrategy
Add strategy. Once a strategy is added it can call rebalance and borrow funds from the pool and invest those funds in a provider/lender.
Recalculate pool level external deposit fee after all state variables are updated.
_strategy
address
Strategy address
_debtRatio
uint256
Pool fund allocation to this strategy
_externalDepositFee
uint256
External deposit fee of strategy
setup
OnlyPool:: Helper function for V5 upgrade
removeStrategy
Remove strategy and recalculate the pool level external deposit fee.
Revoke and remove strategy from the strategy array. Update withdraw queue. Withdraw queue order should not change after remove. Strategy can be removed only after it has paid all debt. Use he migratestrategy function if debt is not paid and you want to upgrade the strategy.
updateExternalDepositFee
Update external deposit fee of the strategy and recalculate the pool level external deposit fee.
_strategy
address
Strategy address for which external deposit fee is being updated
_externalDepositFee
uint256
New external deposit fee
recalculatePoolExternalDepositFee
Recalculate the pool external deposit fee. It is calculated using debtRatio and the external deposit fee of each strategy.
Whenever debtRatio changes, recalculation is required. DebtRatio changes if a strategy reports loss, in which case an off-chain application can watch for it and take action accordingly. This function is 'gas heavy', so we do not want to call it during reportLoss.
sweepERC20
Transfer given ERC20 token to pool
_fromToken
address
Token address to sweep
updateDebtRatio
Update debt ratio.
A strategy is retired when its debtRatio is 0. As debtRatio impacts pool level external deposit fee, it must be recalculated after updating debtRatio.
_strategy
address
Strategy address for which debt ratio is being updated
_debtRatio
uint256
New debt ratio
updateWithdrawQueue
Update withdraw queue. Withdraw queue is a list of strategies in the order in which funds should be withdrawn.
Pool always keeps some buffer amount to satisfy withdrawal requests. Any withdrawal request higher than what is in the buffer will cause withdrawal from the withdraw queue. So withdrawQueue[0] will be the first strategy where withdrawal request will be sent.
_withdrawQueue
address[]
Ordered list of strategy.
migrateStrategy
Migrate an existing strategy to new strategy.
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.
_old
address
Address of strategy being migrated
_new
address
Address of new strategy
reportEarning
Strategy calls this at regular intervals.
_strategy
address
_profit
uint256
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.
reportLoss
Update strategy loss.
_strategy
address
Strategy which incur loss
_loss
uint256
Loss of strategy
decreaseDebt
Decrease debt of strategy; this also decreases totalDebt.
In case of withdraw from strategy, pool will decrease debt by the amount withdrawn
_strategy
address
Strategy Address
_decreaseBy
uint256
Amount by which strategy debt will be decreased
availableCreditLimit
Get available credit limit of strategy. This is the amount strategy can borrow from the pool.
Available credit limit is calculated based on current debt of pool and strategy and the current debt limit of pool and strategy. credit available = min(pool's debt limit, strategy's debt limit, max debt per rebalance). When any strategy does not pay back its outstanding debt, this impacts the credit line of other strategies if totalDebt of pool >= debtLimit of pool
_strategy
address
Strategy address
excessDebt
Debt above current debt limit
_strategy
address
Address of strategy
getStrategies
Return the strategies array.
getWithdrawQueue
Return withdrawQueue array.
totalDebtOf
Get total debt of given strategy.
_strategy
address
Strategy address
Last updated