StrategVault
Strateg vault implementation
Methods
DOMAIN_SEPARATOR
function DOMAIN_SEPARATOR() external view returns (bytes32)
Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
Returns
_0
bytes32
undefined
addressProvider
function addressProvider() external view returns (contract IStrategAddressesProvider)
The address of the operator
Returns
_0
contract IStrategAddressesProvider
undefined
allowance
function allowance(address owner, address spender) external view returns (uint256)
See {IERC20-allowance}.
Parameters
owner
address
undefined
spender
address
undefined
Returns
_0
uint256
undefined
approve
function approve(address spender, uint256 value) external nonpayable returns (bool)
See {IERC20-approve}. NOTE: If value
is the maximum uint256
, the allowance is not updated on transferFrom
. This is semantically equivalent to an infinite approval. Requirements: - spender
cannot be the zero address.
Parameters
spender
address
undefined
value
uint256
undefined
Returns
_0
bool
undefined
asset
function asset() external view returns (address)
See {IERC4626-asset}.
Returns
_0
address
undefined
balanceOf
function balanceOf(address account) external view returns (uint256)
See {IERC20-balanceOf}.
Parameters
account
address
undefined
Returns
_0
uint256
undefined
buffer
function buffer() external view returns (address)
The address of the buffer contract
Returns
_0
address
undefined
convertToAssets
function convertToAssets(uint256 shares) external view returns (uint256)
See {IERC4626-convertToAssets}.
Parameters
shares
uint256
undefined
Returns
_0
uint256
undefined
convertToShares
function convertToShares(uint256 assets) external view returns (uint256)
See {IERC4626-convertToShares}.
Parameters
assets
uint256
undefined
Returns
_0
uint256
undefined
decimals
function decimals() external view returns (uint8)
Set the decimal value for the vault token.
Returns
_0
uint8
The number of decimals for the vault token.
deposit
function deposit(uint256 assets, address receiver) external nonpayable returns (uint256)
Deposit assets into the vault and mint shares to the receiver.
Parameters
assets
uint256
The amount of assets to deposit.
receiver
address
The address to receive the minted shares.
Returns
_0
uint256
The amount of shares minted.
eip712Domain
function eip712Domain() external view returns (bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions)
See {IERC-5267}.
Returns
fields
bytes1
undefined
name
string
undefined
version
string
undefined
chainId
uint256
undefined
verifyingContract
address
undefined
salt
bytes32
undefined
extensions
uint256[]
undefined
erc3525
function erc3525() external view returns (address)
Strateg ERC3525 which define vault ownership
Returns
_0
address
undefined
factory
function factory() external view returns (address)
Strateg vault factory address
Returns
_0
address
undefined
getStrat
function getStrat() external view returns (address[] _strategyBlocks, bytes[] _strategyBlocksParameters, bool[] _isFinalBlock, address[] _harvestBlocks, bytes[] _harvestBlocksParameters)
Get the strategy blocks for the vault.
Returns
_strategyBlocks
address[]
Array of strategy blocks addresses.
_strategyBlocksParameters
bytes[]
Array of strategy blocks parameters.
_isFinalBlock
bool[]
Array of boolean indicating if a block is a final block.
_harvestBlocks
address[]
Array of harvest blocks addresses.
_harvestBlocksParameters
bytes[]
Array of harvest blocks parameters.
harvest
function harvest(uint256[] _dynParamsIndex, bytes[] _dynParams) external nonpayable
Internal function to harvest strategy rewards. Only callable by the operator proxy.
Parameters
_dynParamsIndex
uint256[]
The array of dynamic parameter indices.
_dynParams
bytes[]
The array of dynamic parameter values.
harvestBlocksLength
function harvestBlocksLength() external view returns (uint256)
Mapping of harvest block numbers to their corresponding addresses
Returns
_0
uint256
undefined
initialize
function initialize(address _erc3525, string _name, string _symbol, address _asset) external nonpayable
Initalize function call by the factory on deployment
Parameters
_erc3525
address
ERC3525 address
_name
string
vault name
_symbol
string
vault symbol
_asset
address
native asset
isLive
function isLive() external view returns (bool)
Indicates whether the vault is live
Returns
_0
bool
undefined
lastHarvestIndex
function lastHarvestIndex() external view returns (uint256)
Last index of harvest operation
Returns
_0
uint256
undefined
maxDeposit
function maxDeposit(address) external view returns (uint256)
See {IERC4626-maxDeposit}.
Parameters
_0
address
undefined
Returns
_0
uint256
undefined
maxMint
function maxMint(address) external view returns (uint256)
See {IERC4626-maxMint}.
Parameters
_0
address
undefined
Returns
_0
uint256
undefined
maxRedeem
function maxRedeem(address __owner) external view returns (uint256)
See {IERC4626-maxRedeem}.
Parameters
__owner
address
undefined
Returns
_0
uint256
undefined
maxWithdraw
function maxWithdraw(address __owner) external view returns (uint256)
See {IERC4626-maxWithdraw}.
Parameters
__owner
address
undefined
Returns
_0
uint256
undefined
mint
function mint(uint256 shares, address receiver) external nonpayable returns (uint256)
Mint shares to the receiver.
Parameters
shares
uint256
The amount of shares to mint.
receiver
address
The address to receive the minted shares.
Returns
_0
uint256
The amount of assets minted.
name
function name() external view returns (string)
Returns the name of the token.
Returns
_0
string
undefined
nonces
function nonces(address owner) external view returns (uint256)
Returns the current nonce for owner
. This value must be included whenever a signature is generated for {permit}. Every successful call to {permit} increases owner
's nonce by one. This prevents a signature from being used multiple times.
Parameters
owner
address
undefined
Returns
_0
uint256
undefined
owner
function owner() external view returns (address)
return current owner of the vault
Returns
_0
address
Owner of the vault
partialStrategyExecution
function partialStrategyExecution(bool _isEnter, address _neededTokenToRebalance, uint256[] _from, uint256[] _to, uint256[] _dynParamsIndex, bytes[] _dynParams) external nonpayable
Executes partial strategy enter for a given range of strategy blocks. Only callable by a position manager owned by the vault.
Executes the strategy enter function for a subset of strategy blocks, starting from _from
index. The _dynParamsIndex
array and _dynParams
array provide dynamic parameters for the strategy blocks.
Parameters
_isEnter
bool
Boolean indicating if the strategy blocks are entering or exiting the vault.
_neededTokenToRebalance
address
The token needed for the position manager to rebalance.
_from
uint256[]
The starting index of the strategy blocks.
_to
uint256[]
The ending index of the strategy blocks.
_dynParamsIndex
uint256[]
The array of dynamic parameter indices.
_dynParams
bytes[]
The array of dynamic parameter values.
permit
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external nonpayable
Sets value
as the allowance of spender
over owner
's tokens, given owner
's signed approval. IMPORTANT: The same issues {IERC20-approve} has related to transaction ordering also apply here. Emits an {Approval} event. Requirements: - spender
cannot be the zero address. - deadline
must be a timestamp in the future. - v
, r
and s
must be a valid secp256k1
signature from owner
over the EIP712-formatted function arguments. - the signature must use owner
's current nonce (see {nonces}). For more information on the signature format, see the https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP section]. CAUTION: See Security Considerations above.
Parameters
owner
address
undefined
spender
address
undefined
value
uint256
undefined
deadline
uint256
undefined
v
uint8
undefined
r
bytes32
undefined
s
bytes32
undefined
previewDeposit
function previewDeposit(uint256 assets) external view returns (uint256)
See {IERC4626-previewDeposit}.
Parameters
assets
uint256
undefined
Returns
_0
uint256
undefined
previewMint
function previewMint(uint256 shares) external view returns (uint256)
See {IERC4626-previewMint}.
Parameters
shares
uint256
undefined
Returns
_0
uint256
undefined
previewRedeem
function previewRedeem(uint256 shares) external view returns (uint256)
See {IERC4626-previewRedeem}.
Parameters
shares
uint256
undefined
Returns
_0
uint256
undefined
previewWithdraw
function previewWithdraw(uint256 assets) external view returns (uint256)
See {IERC4626-previewWithdraw}.
Parameters
assets
uint256
undefined
Returns
_0
uint256
undefined
rebalance
function rebalance(uint256[] _dynParamsIndexEnter, bytes[] _dynParamsEnter, uint256[] _dynParamsIndexExit, bytes[] _dynParamsExit) external nonpayable
Function to execute the buffer rebalancing process. Only callable by the operator proxy.
Parameters
_dynParamsIndexEnter
uint256[]
The array of dynamic parameter indices for strategy enter.
_dynParamsEnter
bytes[]
The array of dynamic parameters for strategy enter.
_dynParamsIndexExit
uint256[]
The array of dynamic parameter indices for strategy exit.
_dynParamsExit
bytes[]
The array of dynamic parameters for strategy exit.
redeem
function redeem(uint256 _shares, address _receiver, address __owner) external nonpayable returns (uint256)
Redeem shares for assets from the vault.
Parameters
_shares
uint256
The amount of shares to redeem.
_receiver
address
The address to receive the redeemed assets.
__owner
address
The owner of the shares being redeemed.
Returns
_0
uint256
The amount of assets redeemed.
setStrat
function setStrat(address[] _positionManagers, address[] _stratBlocks, bytes[] _stratBlocksParameters, bool[] _isFinalBlock, address[] _harvestBlocks, bytes[] _harvestBlocksParameters) external nonpayable
Set the strategy blocks for the vault. Only callable by the factory.
Parameters
_positionManagers
address[]
Array of position managers.
_stratBlocks
address[]
Array of strategy blocks.
_stratBlocksParameters
bytes[]
Array of strategy block parameters.
_isFinalBlock
bool[]
Array of boolean indicating if a block is a final block..
_harvestBlocks
address[]
Array of harvest blocks.
_harvestBlocksParameters
bytes[]
Array of harvest block parameters.
stopStrategy
function stopStrategy(uint256[] _dynParamsIndex, bytes[] _dynParams) external nonpayable
Internal function to stop the strategy, harvest fees, and perform rebalancing. Only callable by the operator proxy.
Parameters
_dynParamsIndex
uint256[]
The array of dynamic parameter indices.
_dynParams
bytes[]
The array of dynamic parameter values.
stratInitialized
function stratInitialized() external view returns (bool)
Indicates whether the strategy has been initialized
Returns
_0
bool
undefined
strategyBlocksLength
function strategyBlocksLength() external view returns (uint256)
Mapping of strategy block numbers to their corresponding addresses
Returns
_0
uint256
undefined
symbol
function symbol() external view returns (string)
Returns the symbol of the token, usually a shorter version of the name.
Returns
_0
string
undefined
timelocks
function timelocks(address) external view returns (uint256)
User Timelocks
Parameters
_0
address
undefined
Returns
_0
uint256
undefined
totalAssets
function totalAssets() external view returns (uint256)
Get the total assets (TVL) of the vault.
Returns
_0
uint256
The total assets (TVL) of the vault.
totalSupply
function totalSupply() external view returns (uint256)
See {IERC20-totalSupply}.
Returns
_0
uint256
undefined
transfer
function transfer(address to, uint256 value) external nonpayable returns (bool)
See {IERC20-transfer}. Requirements: - to
cannot be the zero address. - the caller must have a balance of at least value
.
Parameters
to
address
undefined
value
uint256
undefined
Returns
_0
bool
undefined
transferFrom
function transferFrom(address from, address to, uint256 value) external nonpayable returns (bool)
See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum uint256
. Requirements: - from
and to
cannot be the zero address. - from
must have a balance of at least value
. - the caller must have allowance for from
's tokens of at least value
.
Parameters
from
address
undefined
to
address
undefined
value
uint256
undefined
Returns
_0
bool
undefined
userDeposit
function userDeposit(address) external view returns (uint256)
Mapping of addresses to their deposited amounts.
Parameters
_0
address
undefined
Returns
_0
uint256
undefined
withdraw
function withdraw(uint256 _assets, address _receiver, address __owner) external nonpayable returns (uint256)
Withdraw assets from the vault and burn the corresponding shares.
Parameters
_assets
uint256
The amount of assets to withdraw.
_receiver
address
The address to receive the withdrawn assets.
__owner
address
The owner of the shares being burned.
Returns
_0
uint256
The amount of shares burned.
withdrawalRebalance
function withdrawalRebalance(address _user, uint256 _amount, uint256[] _dynParamsIndexExit, bytes[] _dynParamsExit) external nonpayable returns (uint256 totalWithdraw)
Function to perform a withdrawal rebalance. Only callable by the operator proxy.
Parameters
_user
address
The user address requesting the withdrawal.
_amount
uint256
The amount of shares to be withdrawn.
_dynParamsIndexExit
uint256[]
The array of dynamic parameter indices for strategy exit.
_dynParamsExit
bytes[]
The array of dynamic parameters for strategy exit.
Returns
totalWithdraw
uint256
undefined
Events
Approval
event Approval(address indexed owner, address indexed spender, uint256 value)
Emitted when the allowance of a spender
for an owner
is set by a call to {approve}. value
is the new allowance.
Parameters
owner indexed
address
undefined
spender indexed
address
undefined
value
uint256
undefined
Deposit
event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares)
Parameters
sender indexed
address
undefined
owner indexed
address
undefined
assets
uint256
undefined
shares
uint256
undefined
EIP712DomainChanged
event EIP712DomainChanged()
MAY be emitted to signal that the domain could have changed.
Initialized
event Initialized(uint64 version)
Triggered when the contract has been initialized or reinitialized.
Parameters
version
uint64
undefined
StrategVaultUpdate
event StrategVaultUpdate(enum IStrategVault.StrategVaultUpdateType indexed update, bytes data)
Emitted when a StrategVault is updated.
Parameters
update indexed
enum IStrategVault.StrategVaultUpdateType
The type of update being performed.
data
bytes
Data relevant to the update.
Transfer
event Transfer(address indexed from, address indexed to, uint256 value)
Emitted when value
tokens are moved from one account (from
) to another (to
). Note that value
may be zero.
Parameters
from indexed
address
undefined
to indexed
address
undefined
value
uint256
undefined
Withdraw
event Withdraw(address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares)
Parameters
sender indexed
address
undefined
receiver indexed
address
undefined
owner indexed
address
undefined
assets
uint256
undefined
shares
uint256
undefined
Errors
AddressEmptyCode
error AddressEmptyCode(address target)
There's no code at target
(it is not a contract).
Parameters
target
address
undefined
AddressInsufficientBalance
error AddressInsufficientBalance(address account)
The ETH balance of the account is not enough to perform the operation.
Parameters
account
address
undefined
BlockListNotValid
error BlockListNotValid()
Error triggered when you try to include not approved block in a vault strategy
DepositMoreThanMax
error DepositMoreThanMax()
Error triggered when you try to deposit more than the maximum of assets depositable
ECDSAInvalidSignature
error ECDSAInvalidSignature()
The signature derives the address(0)
.
ECDSAInvalidSignatureLength
error ECDSAInvalidSignatureLength(uint256 length)
The signature has an invalid length.
Parameters
length
uint256
undefined
ECDSAInvalidSignatureS
error ECDSAInvalidSignatureS(bytes32 s)
The signature has an S value that is in the upper half order.
Parameters
s
bytes32
undefined
ERC20InsufficientAllowance
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed)
Indicates a failure with the spender
’s allowance
. Used in transfers.
Parameters
spender
address
Address that may be allowed to operate on tokens without being their owner.
allowance
uint256
Amount of tokens a spender
is allowed to operate with.
needed
uint256
Minimum amount required to perform a transfer.
ERC20InsufficientBalance
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed)
Indicates an error related to the current balance
of a sender
. Used in transfers.
Parameters
sender
address
Address whose tokens are being transferred.
balance
uint256
Current balance for the interacting account.
needed
uint256
Minimum amount required to perform a transfer.
ERC20InvalidApprover
error ERC20InvalidApprover(address approver)
Indicates a failure with the approver
of a token to be approved. Used in approvals.
Parameters
approver
address
Address initiating an approval operation.
ERC20InvalidReceiver
error ERC20InvalidReceiver(address receiver)
Indicates a failure with the token receiver
. Used in transfers.
Parameters
receiver
address
Address to which tokens are being transferred.
ERC20InvalidSender
error ERC20InvalidSender(address sender)
Indicates a failure with the token sender
. Used in transfers.
Parameters
sender
address
Address whose tokens are being transferred.
ERC20InvalidSpender
error ERC20InvalidSpender(address spender)
Indicates a failure with the spender
to be approved. Used in approvals.
Parameters
spender
address
Address that may be allowed to operate on tokens without being their owner.
ERC2612ExpiredSignature
error ERC2612ExpiredSignature(uint256 deadline)
Permit deadline has expired.
Parameters
deadline
uint256
undefined
ERC2612InvalidSigner
error ERC2612InvalidSigner(address signer, address owner)
Mismatched signature.
Parameters
signer
address
undefined
owner
address
undefined
ERC4626ExceededMaxDeposit
error ERC4626ExceededMaxDeposit(address receiver, uint256 assets, uint256 max)
Attempted to deposit more assets than the max amount for receiver
.
Parameters
receiver
address
undefined
assets
uint256
undefined
max
uint256
undefined
ERC4626ExceededMaxMint
error ERC4626ExceededMaxMint(address receiver, uint256 shares, uint256 max)
Attempted to mint more shares than the max amount for receiver
.
Parameters
receiver
address
undefined
shares
uint256
undefined
max
uint256
undefined
ERC4626ExceededMaxRedeem
error ERC4626ExceededMaxRedeem(address owner, uint256 shares, uint256 max)
Attempted to redeem more shares than the max amount for receiver
.
Parameters
owner
address
undefined
shares
uint256
undefined
max
uint256
undefined
ERC4626ExceededMaxWithdraw
error ERC4626ExceededMaxWithdraw(address owner, uint256 assets, uint256 max)
Attempted to withdraw more assets than the max amount for receiver
.
Parameters
owner
address
undefined
assets
uint256
undefined
max
uint256
undefined
FailedInnerCall
error FailedInnerCall()
A call to an address target failed. The target may have reverted.
HarvestReverted
error HarvestReverted(address _block, uint256 _index, bytes _data)
Error triggered when the harvest function reverts
Parameters
_block
address
The address of the harvest block
_index
uint256
The index of the harvest block
_data
bytes
The data associated with the revert
HoldAmountNotReached
error HoldAmountNotReached()
Error thrown when the required hold amount is not reached.
HookReverted
error HookReverted(address _block, uint256 _index, bytes _data)
Error triggered when the hook function reverts
Parameters
_block
address
The address of the harvest block
_index
uint256
The index of the harvest block
_data
bytes
The data associated with the revert
InvalidAccountNonce
error InvalidAccountNonce(address account, uint256 currentNonce)
The nonce used for an account
is not the expected current nonce.
Parameters
account
address
undefined
currentNonce
uint256
undefined
InvalidInitialization
error InvalidInitialization()
The contract is already initialized.
MathOverflowedMulDiv
error MathOverflowedMulDiv()
Muldiv operation overflow.
MaxUserDepositReached
error MaxUserDepositReached()
Error thrown when the user's maximum deposit amount is reached.
MaxVaultDepositReached
error MaxVaultDepositReached()
Error thrown when the vault's maximum deposit amount is reached.
MinDepositNotReached
error MinDepositNotReached()
Error thrown when the minimum deposit amount is not reached.
NoSharesMinted
error NoSharesMinted()
Error triggered when you try to deposit and the amount of share is 0
NotFactory
error NotFactory()
Error thrown when the caller is not the factory contract.
NotInitializing
error NotInitializing()
The contract is not initializing.
NotOperator
error NotOperator()
Error triggered on operator proxy reserved function when the sender is not the proxy
NotOwner
error NotOwner()
Error thrown when the caller is not the owner.
NotPositionManager
error NotPositionManager()
Error triggered on position manager reserved function when the sender is not a position manager
NotWhitelisted
error NotWhitelisted()
Error thrown when the caller is not whitelisted.
ReentrancyGuardReentrantCall
error ReentrancyGuardReentrantCall()
Unauthorized reentrant call.
SafeERC20FailedOperation
error SafeERC20FailedOperation(address token)
An operation with an ERC20 token failed.
Parameters
token
address
undefined
StrategyAlreadyInitialized
error StrategyAlreadyInitialized()
Error triggered when you try to setup the vault strategy a second time
StrategyEnterReverted
error StrategyEnterReverted(address _block, uint256 _index, bytes _data)
Error triggered when the strategy enter function reverts
Parameters
_block
address
The address of the strategy block
_index
uint256
The index of the strategy block
_data
bytes
The data associated with the revert
StrategyExitReverted
error StrategyExitReverted(address _block, uint256 _index, bytes _data)
Error triggered when the strategy exit function reverts
Parameters
_block
address
The address of the strategy block
_index
uint256
The index of the strategy block
_data
bytes
The data associated with the revert
StrategyNotInitialized
error StrategyNotInitialized()
Error triggered on strategy related function when strategy isn't set
TimelockNotReached
error TimelockNotReached()
Error thrown when the timelock for withdrawal has not been reached.
WithdrawMoreThanMax
error WithdrawMoreThanMax()
Error triggered when you try to withdraw more than the maximum of assets withdrawable
WithdrawalRebalanceIssue
error WithdrawalRebalanceIssue()
Error triggered when there is an issue during the withdrawal rebalance
Last updated