VaultV3.vy
vyper:
0.3.7
author:yearn.finance
license:GNU AGPLv3
Yearn V3 Vault
The Yearn VaultV3 is designed as a non-opinionated system to distribute funds of depositors for a specific asset
into different opportunities (aka Strategies) and manage accounting in a robust way. Depositors receive shares (aka vaults tokens) proportional to their deposit amount. Vault tokens are yield-bearing and can be redeemed at any time to get back deposit plus any yield generated. Addresses that are given different permissioned roles by the role_manager
are then able to allocate funds as they best see fit to different strategies and adjust the strategies and allocations as needed, as well as reporting realized profits or losses. Strategies are any ERC-4626 compliant contracts that use the same underlying asset
as the vault. The vault provides no assurances as to the safety of any strategy and it is the responsibility of those that hold the corresponding roles to choose and fund strategies that best fit their desired specifications. Those holding vault tokens are able to redeem the tokens for the corresponding amount of underlying asset based on any reported profits or losses since their initial deposit. The vault is built to be customized by the management to be able to fit their specific desired needs. Including the customization of strategies, accountants, ownership etc.
Events​
Deposit​
sender
: address, indexedowner
: address, indexedassets
: uint256, notIndexedshares
: uint256, notIndexed
Withdraw​
sender
: address, indexedreceiver
: address, indexedowner
: address, indexedassets
: uint256, notIndexedshares
: uint256, notIndexed
Transfer​
sender
: address, indexedreceiver
: address, indexedvalue
: uint256, notIndexed
Approval​
owner
: address, indexedspender
: address, indexedvalue
: uint256, notIndexed
StrategyChanged​
strategy
: address, indexedchange_type
: uint256, indexed
StrategyReported​
strategy
: address, indexedgain
: uint256, notIndexedloss
: uint256, notIndexedcurrent_debt
: uint256, notIndexedprotocol_fees
: uint256, notIndexedtotal_fees
: uint256, notIndexedtotal_refunds
: uint256, notIndexed
DebtUpdated​
strategy
: address, indexedcurrent_debt
: uint256, notIndexednew_debt
: uint256, notIndexed
RoleSet​
account
: address, indexedrole
: uint256, indexed
UpdateRoleManager​
role_manager
: address, indexed
UpdateAccountant​
accountant
: address, indexed
UpdateDepositLimitModule​
deposit_limit_module
: address, indexed
UpdateWithdrawLimitModule​
withdraw_limit_module
: address, indexed
UpdateDefaultQueue​
new_default_queue
: address[], notIndexed
UpdateUseDefaultQueue​
use_default_queue
: bool, notIndexed
UpdatedMaxDebtForStrategy​
sender
: address, indexedstrategy
: address, indexednew_debt
: uint256, notIndexed
UpdateDepositLimit​
deposit_limit
: uint256, notIndexed
UpdateMinimumTotalIdle​
minimum_total_idle
: uint256, notIndexed
UpdateProfitMaxUnlockTime​
profit_max_unlock_time
: uint256, notIndexed
DebtPurchased​
strategy
: address, indexedamount
: uint256, notIndexed
Shutdown​
Methods​
initialize​
type:
nonpayable function
Initialize a new vault. Sets the asset, name, symbol, and role manager.
Arguments:
-
asset
: - The address of the asset that the vault will accept. -
name
: - The name of the vault token. -
symbol
: - The symbol of the vault token. -
role_manager
: - The address that can add and remove roles to addresses -
profit_max_unlock_time
: - The amount of time that the profit will be locked for
set_accountant​
type:
nonpayable function
Set the new accountant address.
Arguments:
new_accountant
: - The new accountant address.
set_default_queue​
type:
nonpayable function
Set the new default queue array.
Will check each strategy to make sure it is active. But will not check that the same strategy is not added twice. maxRedeem and maxWithdraw return values may be inaccurate if a strategy is added twice.
Arguments:
new_default_queue
: - The new default queue array.
set_use_default_queue​
type:
nonpayable function
Set a new value for use_default_queue
.
If set True
the default queue will always be used no matter whats passed in.
Arguments:
use_default_queue
: - new value.
set_deposit_limit​
type:
nonpayable function
Set the new deposit limit.
Can not be changed if a deposit_limit_module is set unless the override flag is true or if shutdown.
Arguments:
-
deposit_limit
: - The new deposit limit. -
override
: - If adeposit_limit_module
already set should be overridden.
set_deposit_limit_module​
type:
nonpayable function
Set a contract to handle the deposit limit.
The default deposit_limit
will need to be set to max uint256 since the module will override it or the override flag must be set to true to set it to max in 1 tx..
Arguments:
-
deposit_limit_module
: - Address of the module. -
override
: - If adeposit_limit
already set should be overridden.
set_deposit_limit_module​
type:
nonpayable function
The default deposit_limit
will need to be set to max uint256 since the module will override it or the override flag must be set to true to set it to max in 1 tx..
Arguments:
-
deposit_limit_module
: - Address of the module. -
override
: - If adeposit_limit
already set should be overridden.
set_withdraw_limit_module​
type:
nonpayable function
Set a contract to handle the withdraw limit.
This will override the default max_withdraw
.
Arguments:
withdraw_limit_module
: - Address of the module.
set_minimum_total_idle​
type:
nonpayable function
Set the new minimum total idle.
Arguments:
minimum_total_idle
: - The new minimum total idle.
setProfitMaxUnlockTime​
type:
nonpayable function
Set the new profit max unlock time.
The time is denominated in seconds and must be less than 1 year. We only need to update locking period if setting to 0, since the current period will use the old rate and on the next report it will be reset with the new unlocking time. Setting to 0 will cause any currently locked profit to instantly unlock and an immediate increase in the vaults Price Per Share.
Arguments:
new_profit_max_unlock_time
: - The new profit max unlock time.
set_role​
type:
nonpayable function
Set the roles for an account.
This will fully override an accounts current roles so it should include all roles the account should hold.
Arguments:
-
account
: - The account to set the role for. -
role
: - The roles the account should hold.
add_role​
type:
nonpayable function
Add a new role to an address.
This will add a new role to the account without effecting any of the previously held roles.
Arguments:
-
account
: - The account to add a role to. -
role
: - The new role to add to account.
remove_role​
type:
nonpayable function
Remove a single role from an account.
This will leave all other roles for the account unchanged.
Arguments:
-
account
: - The account to remove a Role from. -
role
: - The Role to remove.
transfer_role_manager​
type:
nonpayable function
Step 1 of 2 in order to transfer the role manager to a new address. This will set the future_role_manager. Which will then need to be accepted by the new manager.
Arguments:
role_manager
: - The new role manager address.
isShutdown​
type:
view function
Get if the vault is shutdown.
Returns:
_0
- Bool representing the shutdown status
unlockedShares​
type:
view function
Get the amount of shares that have been unlocked.
Returns:
_0
- The amount of shares that are have been unlocked.
pricePerShare​
type:
view function
Get the price per share (pps) of the vault.
This value offers limited precision. Integrations that require exact precision should use convertToAssets or convertToShares instead.
Returns:
_0
- The price per share.
get_default_queue​
type:
view function
Get the full default queue currently set.
Returns:
_0
- The current default withdrawal queue.
process_report​
type:
nonpayable function
Process the report of a strategy.
Arguments:
strategy
: - The strategy to process the report for.
Returns:
_0
- The gain and loss of the strategy.