VPOOL
VPool
All Vesper pools are implementations of VPOOL. This contract performs the core functions for all Vesper pools, including deposits, withdrawals, fee calculation
VERSION
MAX_BPS
ONE_YEAR
UpdatedMaximumProfitAsFee
UpdatedMinimumDepositLimit
Deposit
Withdraw
UpdatedUniversalFee
UpdatedPoolRewards
UpdatedWithdrawFee
UniversalFeePaid
constructor
initialize
Equivalent to a constructor for the proxy. It can be called only once per proxy.
deposit
Deposit ERC20 tokens and receive pool shares depending on the current share price.
_amount
uint256
ERC20 token amount.
depositAndClaim
Deposit ERC20 tokens and claim rewards, if there are any.
_amount
uint256
ERC20 token amount.
depositWithPermit
Deposit ERC20 tokens with permit, aka gasless approval.
_amount
uint256
ERC20 token amount.
_deadline
uint256
The time at which signature will expire
_v
uint8
The recovery byte of the signature
_r
bytes32
Half of the ECDSA signature pair
_s
bytes32
Half of the ECDSA signature pair
whitelistedWithdraw
Withdraw collateral based on given shares and the current share price. Burn remaining shares and return collateral. Claim rewards if there are any
Deprecated method. Keeping this method here for backward compatibility.
_shares
uint256
Pool shares. It will be in 18 decimals.
withdraw
Withdraw collateral based on given shares and the current share price. Burn remaining shares and return collateral.
_shares
uint256
Pool shares. It will be in 18 decimals.
withdrawAndClaim
Withdraw collateral and claim rewards, if any.
_shares
uint256
Pool shares. It will be in 18 decimals.
multiTransfer
Transfer tokens to multiple recipients
Address array and amount array are 1:1 and are in order.
_recipients
address[]
array of recipient addresses
_amounts
uint256[]
array of token amounts
[0]
bool
true/false
reportEarning
Strategy call this in regular interval. Only strategy function.
_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
Report loss outside of rebalance activity.
Some strategies pay deposit fee thus realizing loss at deposit. For example: Curve's 3pool has some slippage due to deposit of one asset in 3pool. Strategy may want report this loss instead of waiting for next rebalance.
_loss
uint256
Loss that strategy want to report
sweepERC20
Transfer given ERC20 token to governor
_fromToken
address
Token address to sweep
availableCreditLimit
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
_strategy
address
Strategy address
calculateUniversalFee
Calculate universal fee for calling strategy. This is only strategy function.
Earn strategies will call this during rebalance.
excessDebt
Debt above current debt limit
_strategy
address
Address of strategy
getStrategies
totalDebt
Get total debt of pool
totalDebtOf
Get total debt of given strategy
_strategy
address
Strategy address
totalDebtRatio
Get total debt ratio. Total debt ratio helps us keep buffer in pool
calculateMintage
Calculate how much shares user will get for given amount. Also return externalDepositFee if any.
Amount should be >= minimum deposit limit which default to 1
_amount
uint256
Collateral amount
_shares
uint256
Amount of share that user will get
getWithdrawQueue
pricePerShare
Get price per share
Return value will be in token defined decimals.
strategy
tokensHere
Returns the token stored in the pool. It will be in token defined decimals.
totalValue
Returns sum of token locked in other contracts and token stored in the pool. It will be in token defined decimals.
_beforeBurning
Before burning hook. withdraw amount from strategies
_calculateShares
Calculate shares to mint/burn based on the current share price and given amount.
_amount
uint256
Collateral amount in collateral token defined decimals.
[0]
uint256
share amount in 18 decimal
_calculateUniversalFee
Calculate universal fee based on strategy's TVL, profit earned and duration between rebalance and now.
_calculateUniversalFee
migrateStrategy
Migrate existing strategy to new strategy.
Migrating strategy aka old and new strategy should be of same type.
_old
address
Address of strategy being migrated
_new
address
Address of new strategy
setup
OnlyGovernor:: Helper function for V5 upgrade
updateMaximumProfitAsFee
Only Governor:: Update maximum profit that can be used as universal fee
_newMaxProfitAsFee
uint256
New max profit as fee
updateMinimumDepositLimit
Only Governor:: Update minimum deposit limit
_newLimit
uint256
New minimum deposit limit
updateUniversalFee
Update universal fee for this pool
Format: 1500 = 15% fee, 100 = 1%
_newUniversalFee
uint256
new universal fee
updatePoolRewards
Update pool rewards address for this pool
_newPoolRewards
address
new pool rewards address
pause
unpause
shutdown
open
keepers
Return list of keepers
isKeeper
addKeeper
Add given address in keepers list.
_keeperAddress
address
keeper address to add.
removeKeeper
Remove given address from keepers list.
_keeperAddress
address
keeper address to remove.
maintainers
Return list of maintainers
isMaintainer
addMaintainer
Add given address in maintainers list.
_maintainerAddress
address
maintainer address to add.
removeMaintainer
Remove given address from maintainers list.
_maintainerAddress
address
maintainer address to remove.
Last updated