From 3c795870b2411c6c4aa3b2d2930e3765468ea6fd Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 18 Feb 2025 15:50:17 +0400 Subject: [PATCH] docs: add descriptions --- src/contracts/vault/v1.1/VaultTokenized.sol | 2 + src/interfaces/vault/v1.1/IVault.sol | 37 ++++++++++++++----- src/interfaces/vault/v1.1/IVaultTokenized.sol | 10 ++--- src/interfaces/vault/v1.1/IVaultVotes.sol | 2 +- 4 files changed, 35 insertions(+), 16 deletions(-) diff --git a/src/contracts/vault/v1.1/VaultTokenized.sol b/src/contracts/vault/v1.1/VaultTokenized.sol index 18767c4..7d5a9e1 100644 --- a/src/contracts/vault/v1.1/VaultTokenized.sol +++ b/src/contracts/vault/v1.1/VaultTokenized.sol @@ -33,7 +33,9 @@ contract VaultTokenized is Vault { if (oldVersion == 1) { (IVaultTokenized.MigrateParamsTokenized memory params) = abi.decode(data, (IVaultTokenized.MigrateParamsTokenized)); + super._migrate(oldVersion, newVersion, params.baseParams); + _implementation().functionDelegateCall( abi.encodeCall(VaultTokenizedImplementation._VaultTokenized_init, (params.name, params.symbol)) ); diff --git a/src/interfaces/vault/v1.1/IVault.sol b/src/interfaces/vault/v1.1/IVault.sol index 84cc1a3..9546016 100644 --- a/src/interfaces/vault/v1.1/IVault.sol +++ b/src/interfaces/vault/v1.1/IVault.sol @@ -23,28 +23,28 @@ interface IVault is IVaultStorage, IAccessControl, IERC165, IERC3156FlashLender error InvalidDelegator(); error InvalidEpoch(); error InvalidEpochDuration(); + error InvalidEpochDurationSetEpochsDelay(); + error InvalidFlashParams(); error InvalidLengthEpochs(); + error InvalidNewEpochDuration(); error InvalidOnBehalfOf(); + error InvalidReceiver(); error InvalidRecipient(); + error InvalidReturnAmount(); error InvalidSlasher(); + error InvalidTimestamp(); + error MaxLoanExceeded(); error MissingRoles(); + error NewEpochDurationNotReady(); + error NoDepositWhitelist(); + error NoPreviousEpoch(); error NotDelegator(); error NotSlasher(); error NotWhitelistedDepositor(); error SlasherAlreadyInitialized(); error TooMuchRedeem(); error TooMuchWithdraw(); - error InvalidEpochDurationSetEpochsDelay(); - error InvalidNewEpochDuration(); - error NewEpochDurationNotReady(); - error NoDepositWhitelist(); error UnsupportedToken(); - error MaxLoanExceeded(); - error InvalidReceiver(); - error InvalidReturnAmount(); - error InvalidFlashParams(); - error InvalidTimestamp(); - error NoPreviousEpoch(); /** * @notice Initial parameters needed for a vault deployment. @@ -54,11 +54,18 @@ interface IVault is IVaultStorage, IAccessControl, IERC165, IERC3156FlashLender * @param depositWhitelist if enabling deposit whitelist * @param isDepositLimit if enabling deposit limit * @param depositLimit deposit limit (maximum amount of the collateral that can be in the vault simultaneously) + * @param epochDurationSetEpochsDelay number of epochs to wait before accepting a new epoch duration + * @param flashFeeRate flash fee rate (100% = 1_000_000_000; 0.03% = 300_000) + * @param flashFeeReceiver address of the flash fee receiver * @param defaultAdminRoleHolder address of the initial DEFAULT_ADMIN_ROLE holder * @param depositWhitelistSetRoleHolder address of the initial DEPOSIT_WHITELIST_SET_ROLE holder * @param depositorWhitelistRoleHolder address of the initial DEPOSITOR_WHITELIST_ROLE holder + * @param depositorsWhitelisted addresses of the whitelisted depositors * @param isDepositLimitSetRoleHolder address of the initial IS_DEPOSIT_LIMIT_SET_ROLE holder * @param depositLimitSetRoleHolder address of the initial DEPOSIT_LIMIT_SET_ROLE holder + * @param epochDurationSetRoleHolder address of the initial EPOCH_DURATION_SET_ROLE holder + * @param flashFeeRateSetRoleHolder address of the initial FLASH_FEE_RATE_SET_ROLE holder + * @param flashFeeReceiverSetRoleHolder address of the initial FLASH_FEE_RECEIVER_SET_ROLE holder */ struct InitParams { address collateral; @@ -81,6 +88,16 @@ interface IVault is IVaultStorage, IAccessControl, IERC165, IERC3156FlashLender address flashFeeReceiverSetRoleHolder; } + /** + * @notice Parameters needed for a vault migration. + * @param epochDurationSetEpochsDelay number of epochs to wait before accepting a new epoch duration + * @param flashFeeRate flash fee rate (100% = 1_000_000_000; 0.03% = 300_000) + * @param flashFeeReceiver address of the flash fee receiver + * @param epochDurationSetRoleHolder address of the initial EPOCH_DURATION_SET_ROLE holder + * @param flashFeeRateSetRoleHolder address of the initial FLASH_FEE_RATE_SET_ROLE holder + * @param flashFeeReceiverSetRoleHolder address of the initial FLASH_FEE_RECEIVER_SET_ROLE holder + * @dev Version 1 and 2 -> version 3 vaults migration. + */ struct MigrateParams { uint256 epochDurationSetEpochsDelay; uint256 flashFeeRate; diff --git a/src/interfaces/vault/v1.1/IVaultTokenized.sol b/src/interfaces/vault/v1.1/IVaultTokenized.sol index 923e523..9dae817 100644 --- a/src/interfaces/vault/v1.1/IVaultTokenized.sol +++ b/src/interfaces/vault/v1.1/IVaultTokenized.sol @@ -1,16 +1,14 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {IVault} from "./IVault.sol"; - -import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import {IERC20Errors} from "@openzeppelin/contracts/interfaces/draft-IERC6093.sol"; +import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; +import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IVaultTokenized is IERC20, IERC20Metadata, IERC20Errors { /** * @notice Initial parameters needed for a tokenized vault deployment. - * @param baseParams initial parameters needed for a vault deployment (InitParams) + * @param baseParams initial parameters needed for a vault deployment (abi.encode(IVault.InitParams)) * @param name name for the ERC20 tokenized vault * @param symbol symbol for the ERC20 tokenized vault */ @@ -22,8 +20,10 @@ interface IVaultTokenized is IERC20, IERC20Metadata, IERC20Errors { /** * @notice Parameters needed for a tokenized vault migration. + * @param baseParams parameters needed for a vault migration (abi.encode(IVault.MigrateParams)) * @param name name for the ERC20 tokenized vault * @param symbol symbol for the ERC20 tokenized vault + * @dev Version 1 -> version 3 vaults migration. */ struct MigrateParamsTokenized { bytes baseParams; diff --git a/src/interfaces/vault/v1.1/IVaultVotes.sol b/src/interfaces/vault/v1.1/IVaultVotes.sol index 53ab46a..5aa243e 100644 --- a/src/interfaces/vault/v1.1/IVaultVotes.sol +++ b/src/interfaces/vault/v1.1/IVaultVotes.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.0; import {IERC5805} from "@openzeppelin/contracts/interfaces/IERC5805.sol"; interface IVaultVotes is IERC5805 { - error SafeSupplyExceeded(); error ImproperMigration(); error InvalidData(); + error SafeSupplyExceeded(); }