ContractRegistry
Inherits from Multicall, ContractMeta ⛽ 1.82MFunctions
constructor
addresses
names
versions
versionAddress
latestVersion
registerContract
⛽ 256K (254K - 259K)
Specs
- ✅ registers IContractMeta compatible contract and updates respective view methods - #addresses - #versions - #names - #latestVersion - #versionAddress
- ✅ allowed: operator (deployer)
- ✅ denied with FRB: random address
- ✅ allowed: protocol admin
- ✅ when new contract major version differs more, than on one reverts with INVA
- ✅ when new contract version lower or equal existing one reverts with INVA
- ✅ when contract has invalid version reverts with INVA
- ✅ when contract name is not alphanumeric reverts with INV
- ✅ when address is already registered reverts with DUP
Events
ContractRegistered
ProtocolGovernance
Inherits from Multicall, UnitPricesGovernance, DefaultAccessControl, AccessControlEnumerable, AccessControl, ERC165, Context, ContractMeta ⛽ 4.68M Governance that manages all params common for Mellow Permissionless Vaults protocol.Functions
constructor
Specs
- ✅ deploys a new contract
stagedParams
- ✅ imestamp timestamp equals #stageParams’s block.timestamp + governanceDelay
- ✅ imestamp clears by #commitParams
- ✅ imestamp edge cases when nothing is set returns zero
- ✅ imestamp access control allowed: any address
- ✅ allowed: any address
- ✅ updates by #stageParams
- ✅ clears by #commitParams
params
stagedValidatorsAddresses
validatorsAddresses
validatorsAddress
Return Values:
Specs
- ✅ returns correct value
- ✅ s properties @property: updates when committed validator grant for a new address
- ✅ s properties @property: doesn’t update when committed validator grant for an existing address
- ✅ s access control allowed: any address
permissionAddresses
stagedPermissionGrantsAddresses
addressesByPermission
Return Values:
Specs
- ✅ returns addresses that has the given permission set to true
- ✅ allowed: any address
- ✅ updates by #stagePermissionGrants + #commitPermissionGrants or #revokePermissions
- ✅ is not affected by forceAllowMask
- ✅ returns empty array on unknown permissionId
hasPermission
hasAllPermissions
Specs
- ✅ checks if an address has all permissions set to true
- ✅ allowed: any address
- ✅ returns false on random address
- ✅ is not affected by staged permissions
- ✅ is affected by committed permissions
- ✅ returns true for any address when forceAllowMask is set to true
- ✅ on unknown permission id returns false
maxTokensPerVault
- ✅ returns correct value
governanceDelay
- ✅ returns correct value
protocolTreasury
- ✅ returns correct value
forceAllowMask
- ✅ returns correct value
withdrawLimit
Return Values:
Specs
- ✅ returns correct value
supportsInterface
- ✅ returns true for IProtocolGovernance interface (0xca11fe03)
- ✅ access control: allowed: any address
- ✅ edge cases: when contract does not support the given interface returns false
stageValidator
⛽ 129K (43K - 142K)
Specs
- ✅ emits ValidatorStaged event
- ✅ allowed: admin
- ✅ denied: deployer
- ✅ denied: random address
- ✅ when attempting to stage grant to zero address reverts with AZ when target has zero address
- ✅ when attempting to stage grant to zero address reverts with AZ when validator has zero address
rollbackStagedValidators
⛽ 39K (28K - 42K)- ✅ rolls back all staged validators
- ✅ emits AllStagedValidatorsRolledBack event
- ✅ allowed: admin
- ✅ denied: deployer
- ✅ denied: random address
commitValidator
⛽ 86K (47K - 117K)
Specs
- ✅ commits staged validators
- ✅ emits ValidatorCommitted event
- ✅ allowed: admin
- ✅ denied: deployer
- ✅ denied: random address
- ✅ when attempting to commit validator for zero address reverts with NULL
- ✅ when nothing is staged for the given address reverts with NULL
- ✅ when attempting to commit validator too early reverts with TS
commitAllValidatorsSurpassedDelay
⛽ 132K (27K - 463K)
Specs
- ✅ emits ValidatorCommitted event
- ✅ allowed: admin
- ✅ denied: deployer
- ✅ denied: random address
- ✅ commits all staged validators
- ✅ commits all staged validators after delay
- ✅ when attempting to commit a single validator too early does not commit validator
- ✅ when attempting to commit multiple validators too early does not commit these validators
revokeValidator
⛽ 38K
Specs
- ✅ emits ValidatorRevoked event
- ✅ when attempting to revoke from zero address reverts with NULL
rollbackStagedPermissionGrants
⛽ 37K (28K - 42K)- ✅ rolls back all staged permission grants
- ✅ emits AllStagedPermissionGrantsRolledBack event
- ✅ allowed: admin
- ✅ denied: deployer
- ✅ denied: random address
commitPermissionGrants
⛽ 71K (46K - 117K)
Specs
- ✅ commits staged permission grants
- ✅ emits PermissionGrantsCommitted event
- ✅ allowed: admin
- ✅ denied: deployer
- ✅ denied: random address
- ✅ when attempting to commit permissions for zero address reverts with NULL
- ✅ when nothing is staged for the given address reverts with NULL
- ✅ when attempting to commit permissions too early reverts with TS
commitAllPermissionGrantsSurpassedDelay
⛽ 145K (27K - 248K)
Specs
- ✅ emits PermissionGrantsCommitted event
- ✅ allowed: admin
- ✅ denied: deployer
- ✅ denied: random address
- ✅ commits all staged permission grants
- ✅ commits all staged permission grants after delay
- ✅ when attempting to commit a single permission too early does not commit permission
- ✅ when attempting to commit multiple permissions too early does not commit these permissions
revokePermissions
⛽ 62K (32K - 275K)
Specs
- ✅ emits PermissionRevoked event
- ✅ when attempting to revoke from zero address reverts with NULL
commitParams
⛽ 66K (54K - 81K)- ✅ emits ParamsCommitted event
- ✅ allowed: protocol admin
- ✅ denied: deployer
- ✅ denied: random address
- ✅ when attempting to commit params too early reverts with TS
- ✅ when attempting to commit params without setting pending params reverts with NULL
stagePermissionGrants
⛽ 166K (44K - 383K)
Specs
- ✅ emits PermissionGrantsStaged event
- ✅ allowed: admin
- ✅ denied: deployer
- ✅ denied: random address
- ✅ when attempting to stage grant to zero address reverts with NULL
stageParams
⛽ 140K (62K - 165K)
Specs
- ✅ emits ParamsStaged event
- ✅ allowed: admin
- ✅ denied: random address
- ✅ when given invalid params when maxTokensPerVault is zero reverts with NULL
- ✅ when given invalid params when governanceDelay is zero reverts with NULL
- ✅ when given invalid params when governanceDelay exceeds MAX_GOVERNANCE_DELAY reverts with LIMO
- ✅ when given invalid params when withdrawLimit less than MIN_WITHDRAW_LIMIT reverts with LIMO
Structs
Events
ValidatorStaged
ValidatorRevoked
AllStagedValidatorsRolledBack
ValidatorCommitted
PermissionGrantsStaged
PermissionsRevoked
AllStagedPermissionGrantsRolledBack
PermissionGrantsCommitted
ParamsStaged
ParamsCommitted
UnitPricesGovernance
Inherits from DefaultAccessControl, AccessControlEnumerable, AccessControl, ERC165, Context ⛽ 1.82MFunctions
constructor
supportsInterface
interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified\[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.
stageUnitPrice
⛽ 72K (54K - 74K)rollbackUnitPrice
⛽ 31K (30K - 31K)commitUnitPrice
⛽ 50KStructs
Events
UnitPriceStaged
UnitPriceRolledBack
UnitPriceCommitted
VaultRegistry
Inherits from ERC721, ERC165, Context, ContractMeta ⛽ 3.07M This contract is used to manage ERC721 NFT for all Vaults.Functions
constructor
Specs
- ✅ creates VaultRegistry
- ✅ initializes ProtocolGovernance address
- ✅ initializes ERC721 token name
- ✅ initializes ERC721 token symbol
vaults
- ✅ returns all registered vaults
- ✅ access control: allowed: any address
- ✅ ount returns the number of registered vaults
- ✅ ount access control: allowed: any address
- ✅ ount properties @property: when N new vaults have been registered, vaults count will be increased by N
vaultForNft
Return Values:
Specs
- ✅ resolves Vault address by VaultRegistry NFT
- ✅ access control: allowed: any address
- ✅ when Vault NFT is not registered in VaultRegistry returns zero address
nftForVault
Return Values:
Specs
- ✅ resolves VaultRegistry NFT by Vault address
- ✅ access control: allowed: any address
- ✅ when Vault is not registered in VaultRegistry returns zero
isLocked
Return Values:
Specs
- ✅ checks if token is locked (not transferable)
- ✅ access control: allowed: any address
- ✅ when VaultRegistry NFT is not registered in VaultRegistry returns false
protocolGovernance
- ✅ returns ProtocolGovernance address
- ✅ access control: allowed: any address
stagedProtocolGovernance
- ✅ returns ProtocolGovernance address staged for commit
- ✅ access control: allowed: any address
- ✅ imestamp returns timestamp after which #commitStagedProtocolGovernance can be called
- ✅ imestamp access control: allowed: any address
- ✅ imestamp edge cases when nothing is staged returns 0
- ✅ imestamp edge cases right after #commitStagedProtocolGovernance was called returns 0
- ✅ when nothing is staged returns zero address
- ✅ right after #commitStagedProtocolGovernance was called returns zero address
stagedProtocolGovernanceTimestamp
- ✅ returns timestamp after which #commitStagedProtocolGovernance can be called
- ✅ access control: allowed: any address
- ✅ when nothing is staged returns 0
- ✅ right after #commitStagedProtocolGovernance was called returns 0
vaultsCount
- ✅ returns the number of registered vaults
- ✅ access control: allowed: any address
- ✅ when N new vaults have been registered, vaults count will be increased by N
supportsInterface
- ✅ returns true if this contract supports a certain interface
- ✅ access control: allowed: any address
- ✅ edge cases: when contract does not support the given interface returns false
registerVault
⛽ 167K (154K - 188K)
Return Values:
Specs
- ✅ binds minted ERC721 NFT to Vault address and transfers minted NFT to owner specified in args
- ✅ emits VaultRegistered event
- ✅ access control: allowed: any account with Register Vault permissions
- ✅ access control: denied: any other address
- ✅ access control: denied: protocol governance admin
- ✅ minted NFT equals to vaultRegistry#vaultsCount
- ✅ when address doesn’t conform to IVault interface (IERC165) reverts with INVI
- ✅ when vault has already been registered reverts with DUP
- ✅ when owner address is zero reverts with AZ
stageProtocolGovernance
⛽ 75K (43K - 80K)
Specs
- ✅ stages new ProtocolGovernance for commit
- ✅ sets the stagedProtocolGovernanceTimestamp after which #commitStagedProtocolGovernance can be called
- ✅ access control: allowed: ProtocolGovernance Admin
- ✅ access control: denied: any other address
- ✅ access control: denied: deployer
- ✅ when new ProtocolGovernance is a zero address reverts with AZ
commitStagedProtocolGovernance
⛽ 34K- ✅ commits staged ProtocolGovernance
- ✅ resets staged ProtocolGovernanceTimestamp
- ✅ resets staged ProtocolGovernance
- ✅ access control: allowed: ProtocolGovernance Admin
- ✅ access control: denied: any other address
- ✅ when nothing is staged reverts with INIT
- ✅ when called before stagedProtocolGovernanceTimestamp reverts with TS
- ✅ when called before stagedProtocolGovernanceTimestamp reverts with TS
lockNft
⛽ 46K (29K - 49K)- ✅ locks NFT (disables any transfer)
- ✅ emits TokenLocked event
- ✅ access control: allowed: NFT owner
- ✅ access control: denied: any other address
- ✅ access control: denied: protocol admin
- ✅ when NFT has already been locked succeeds
Events
TokenLocked
VaultRegistered
StagedProtocolGovernance
CommitedProtocolGovernance
CommonLibrary
CommonLibrary shared utilitiesExceptionsLibrary
Exceptions stores project`s smart-contracts exceptionsPermissionIdsLibrary
Stores permission ids for addressesSemverLibrary
ChainlinkOracle
Inherits from DefaultAccessControl, AccessControlEnumerable, AccessControl, ERC165, Context, ContractMeta ⛽ 2.77M Contract for getting chainlink dataFunctions
constructor
hasOracle
Return Values:
Specs
- ✅ returns true if oracle is supported
- ✅ edge cases: when oracle is not supported returns false
supportedTokens
- ✅ returns list of supported tokens
priceX96
Return Values:
supportsInterface
interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified\[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.
Specs
- ✅ returns true for ChainlinkOracle interface (0x8e3bd5d7)
- ✅ edge cases: when contract does not support the given interface returns false
addChainlinkOracles
⛽ 82K (81K - 83K)
Specs
- ✅ emits OraclesAdded event
- ✅ when oracles have set by addChainLinkOracles function returns prices
- ✅ edge cases: when arrays have different lengths reverts with INV
- ✅ edge cases: when sender has no admin righs reverts with FRB
Structs
Events
OraclesAdded
MellowOracle
Inherits from ERC165, ContractMeta ⛽ 783Kconstructor
priceX96
supportsInterface
interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified\[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.
Specs
- ✅ returns true for IUniV3Oracle interface (0x6d80125b)
- ✅ edge cases: when contract does not support the given interface returns false
UniV2Oracle
Inherits from ERC165, ContractMeta ⛽ 671Kconstructor
priceX96
Return Values:
supportsInterface
interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified\[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.
Specs
- ✅ returns true for IUniV2Oracle interface (0x2748645e)
- ✅ edge cases: when contract does not support the given interface returns false
UniV3Oracle
Inherits from DefaultAccessControl, AccessControlEnumerable, AccessControl, ERC165, Context, ContractMeta ⛽ 3.44MFunctions
constructor
priceX96
Return Values:
supportsInterface
interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified\[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.
Specs
- ✅ returns true for IUniV3Oracle interface (0x2a3602d6)
- ✅ when contract does not support the given interface returns false
addUniV3Pools
⛽ 73K (39K - 89K)
Specs
- ✅ when adding [weth, usdc] pools with fee = 500 adds pools
- ✅ when adding [weth, usdc] pools with fee = 3000 adds pools
- ✅ when adding [weth, usdc] pools with fee = 10000 does not return prices
Structs
Events
PoolsUpdated
HStrategy
Inherits from DefaultAccessControlLateInit, AccessControlEnumerable, AccessControl, ERC165, Context, Multicall, ContractMeta ⛽ 7.59MFunctions
constructor
Specs
- ✅ deploys a new contract
initialize
createStrategy
⛽ 536K (536K - 539K)
Return Values:
Specs
- ✅ creates a new strategy and initializes it
updateStrategyParams
⛽ 48K (44K - 51K)updateMintingParams
updateOracleParams
updateRatioParams
⛽ 39K (38K - 40K)updateSwapFees
manualPull
⛽ 468K (256K - 517K)
Specs
- ✅ pulls token amounts from fromVault to toVault
rebalance
⛽ 1.44M (352K - 1.75M)
Return Values:
Specs
- ✅ performs a rebalance according to strategy params
Structs
Events
MintUniV3Position
BurnUniV3Position
SwapTokensOnERC20Vault
UpdateStrategyParams
UpdateMintingParams
UpdateOracleParams
UpdateRatioParams
UpdateSwapFees
LStrategy
Inherits from DefaultAccessControl, AccessControlEnumerable, AccessControl, ERC165, Context ⛽ 7.65MFunctions
constructor
getTargetPriceX96
targetUniV3LiquidityRatio
rebalanceERC20UniV3Vaults
⛽ 505K (326K - 1.69M)
Return Values:
rebalanceUniV3Vaults
⛽ 432K (138K - 900K)
Return Values:
postPreOrder
⛽ 144K (140K - 180K)
Return Values:
signOrder
⛽ 210K (103K - 233K)resetCowswapAllowance
⛽ 117K (116K - 118K)collectUniFees
⛽ 279K (239K - 320K)manualPull
⛽ 345K (297K - 487K)updateTradingParams
⛽ 68K (42K - 119K)updateRatioParams
⛽ 37K (36K - 53K)updateOtherParams
⛽ 41K (33K - 94K)Structs
Events
PreOrderPosted
OrderSigned
ManualPull
SwapVault
RebalancedErc20UniV3
RebalancedUniV3
TradingParamsUpdated
RatioParamsUpdated
OtherParamsUpdated
CowswapAllowanceReset
FeesCollected
MStrategy
Inherits from DefaultAccessControlLateInit, AccessControlEnumerable, AccessControl, ERC165, Context, Multicall, ContractMeta ⛽ 6.64MFunctions
constructor
Specs
- ✅ deploys a new contract
- ✅ when positionManager_ address is zero reverts with AZ
- ✅ when router_ address is zero passes
getAverageTick
Specs
- ✅ returns average UniswapV3Pool price tick
initialize
createStrategy
⛽ 571K (570K - 573K)
Specs
- ✅ creates a new strategy and initializes it
- ✅ allowed: any address
- ✅ when tokens.length is not equal 2 reverts with INVL
- ✅ when erc20Vault vaultTokens do not match tokens_ reverts with INVA
- ✅ when moneyVault vaultTokens do not match tokens_ reverts with INVA
- ✅ when UniSwapV3 pool for tokens does not exist reverts with AZ
rebalance
⛽ 725K (240K - 851K)
Return Values:
Specs
- ✅ performs a rebalance according to target ratios when token0/token1 ratio is greater than required
- ✅ performs a rebalance according to target ratios when token0/token1 ratio is less than required
- ✅ allowed: MStrategy admin
- ✅ allowed: MStrategy operator
- ✅ denied: any other address
- ✅ when absolute tick deviation >= oracle.maxTickDeviation reverts with INVA
- ✅ when tick is greater than tickMax - tickNeiborhood the upper bound of the interval is expanded by tickIncrease amount
- ✅ when tick is less than tickMin + tickNeiborhood the lower bound of the interval is expanded by tickIncrease amount
- ✅ when current tick has not deviated from the previous rebalance tick reverts with LIMU
manualPull
Specs
- ✅ pulls token amounts from fromVault to toVault
- ✅ allowed: MStrategy admin
- ✅ denied: any other address
- ✅ when token pull amounts are 0 passes
setOracleParams
⛽ 64K (41K - 75K)
Specs
- ✅ sets new params for oracle
- ✅ edge cases: when maxSlippageD is more than DENOMINATOR reverts with INVA
- ✅ allowed: MStrategy admin
- ✅ denied: any other address
setRatioParams
⛽ 65K (44K - 124K)
Specs
- ✅ sets new ratio params
- ✅ edge cases: tickMin is greater than tickMax reverts with INVA
- ✅ edge cases: when erc20MoneyRatioD is more than DENOMINATOR reverts with INVA
- ✅ edge cases: when minErc20MoneyRatioDeviationD is more than DENOMINATOR reverts with INVA
- ✅ allowed: MStrategy admin
- ✅ denied: any other address
Structs
Events
RebalancedPools
SwappedTokens
SetOracleParams
SetRatioParams
MultiPoolHStrategy
Inherits from DefaultAccessControlLateInit, AccessControlEnumerable, AccessControl, ERC165, Context, Multicall, ContractMeta ⛽ 5.84MFunctions
constructor
initialize
createStrategy
⛽ 1.2M (1.18M - 1.25M)
Return Values:
updateMutableParams
rebalance
⛽ 3.41M
Return Values:
Specs
- ✅ works correctly
checkMutableParams
Structs
Events
UpdateMutableParams
Rebalance
PulseRouteStrategy
Inherits from DefaultAccessControlLateInit, AccessControlEnumerable, AccessControl, ERC165, Context, Multicall, ContractMetaFunctions
constructor
initialize
updateMutableParams
rebalance
- Function checks the current states of the pools, and if the volatility is significant, the transaction reverts.
- If necessary, a new position is minted on uniV3Vault, and the previous one is burned.
- Tokens on erc20Vault are swapped via swapRouter so that the proportion matches the tokens on uniV3Vault.
- The strategy transfers all possible tokens from erc20Vault to uniV3Vault. Only users with administrator or operator roles can call the function.
calculateNewInterval
Return Values:
checkMutableParams
checkImmutableParams
checkTickDeviations
calculateTargetRatioOfToken1
Return Values:
calculateAmountsForSwap
Return Values:
depositCallback
withdrawCallback
Structs
Events
TokensSwapped
UpdateMutableParams
Rebalance
PositionMinted
PositionBurned
PulseStrategy
Inherits from DefaultAccessControlLateInit, AccessControlEnumerable, AccessControl, ERC165, Context, Multicall, ContractMetaFunctions
constructor
initialize
updateMutableParams
rebalance
- Function checks the current states of the pools, and if the volatility is significant, the transaction reverts.
- If necessary, a new position is minted on uniV3Vault, and the previous one is burned.
- Tokens on erc20Vault are swapped via AggregationRouterV5 so that the proportion matches the tokens on uniV3Vault.
- The strategy transfers all possible tokens from erc20Vault to uniV3Vault. Only users with administrator or operator roles can call the function.
checkMutableParams
checkImmutableParams
checkTickDeviation
calculateNewPosition
Return Values:
calculateTargetRatioOfToken1
Return Values:
calculateAmountsForSwap
Return Values:
depositCallback
withdrawCallback
Structs
Events
TokensSwapped
UpdateMutableParams
Rebalance
PositionMinted
PositionBurned
PulseStrategyV2
Inherits from DefaultAccessControlLateInit, AccessControlEnumerable, AccessControl, ERC165, Context, Multicall, ContractMetaFunctions
constructor
initialize
setForceRebalanceFlag
updateDesiredAmounts
updateMutableParams
rebalance
- Function checks the current states of the pools, and if the volatility is significant, the transaction reverts.
- If necessary, a new position is minted on uniV3Vault, and the previous one is burned.
- Tokens on erc20Vault are swapped via AggregationRouterV5 so that the proportion matches the tokens on uniV3Vault.
- The strategy transfers all possible tokens from erc20Vault to uniV3Vault. Only users with administrator or operator roles can call the function.
checkMutableParams
checkImmutableParams
checkTickDeviation
formPositionWithSpotTickInCenter
calculateNewPosition
Return Values:
calculateTargetRatioOfToken1
Return Values:
calculateAmountsForSwap
Return Values:
depositCallback
withdrawCallback
Structs
Events
TokensSwapped
UpdateMutableParams
Rebalance
PositionMinted
PositionBurned
QuickPulseStrategy
Inherits from DefaultAccessControlLateInit, AccessControlEnumerable, AccessControl, ERC165, Context, Multicall, ContractMetaFunctions
constructor
initialize
updateMutableParams
rebalance
- Function checks the current states of the pools, and if the volatility is significant, the transaction reverts.
- If necessary, a new position is minted on quickSwapVault, and the previous one is burned.
- Tokens on erc20Vault are swapped via AggregationRouterV5 so that the proportion matches the tokens on quickSwapVault.
- The strategy transfers all possible tokens from erc20Vault to quickSwapVault. Only users with administrator or operator roles can call the function.
checkMutableParams
checkImmutableParams
checkTickDeviation
calculateNewPosition
Return Values:
calculateTargetRatioOfToken1
Return Values:
calculateAmountsForSwap
Return Values:
depositCallback
withdrawCallback
onERC721Received
⛽ 105KIERC721 tokenId token is transferred to this contract via IERC721-safeTransferFrom by operator from from, this function is called. It must return its Solidity selector to confirm the token transfer. If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. The selector can be obtained in Solidity with IERC721.onERC721Received.selector.
Structs
Events
TokensSwapped
UpdateMutableParams
Rebalance
PositionMinted
PositionBurned
SinglePositionQuickSwapStrategy
Inherits from DefaultAccessControlLateInit, AccessControlEnumerable, AccessControl, ERC165, Context, Multicall, ContractMetaFunctions
constructor
initialize
updateMutableParams
rebalance
- Function checks the current states of the pools, and if the volatility is significant, the transaction reverts.
- If necessary, a new position is minted on quickSwapVault, and the previous one is burned.
- Tokens on erc20Vault are swapped via swapRouter so that the proportion matches the tokens on quickSwapVault.
- The strategy transfers all possible tokens from erc20Vault to quickSwapVault. Only users with administrator or operator roles can call the function.
calculateNewInterval
Return Values:
checkMutableParams
checkImmutableParams
checkTickDeviations
calculateTargetRatioOfToken1
Return Values:
calculateAmountsForSwap
Return Values:
depositCallback
withdrawCallback
Structs
Events
TokensSwapped
UpdateMutableParams
Rebalance
PositionMinted
PositionBurned
SinglePositionStrategy
Inherits from DefaultAccessControlLateInit, AccessControlEnumerable, AccessControl, ERC165, Context, Multicall, ContractMeta ⛽ 7.31MFunctions
constructor
Specs
- ✅ creates contract
initialize
⛽ 671KupdateMutableParams
⛽ 120K (89K - 245K)rebalance
⛽ 1.16M (804K - 1.38M)- Function checks the current states of the pools, and if the volatility is significant, the transaction reverts.
- If necessary, a new position is minted on uniV3Vault, and the previous one is burned.
- Tokens on erc20Vault are swapped via swapRouter so that the proportion matches the tokens on uniV3Vault.
- The strategy transfers all possible tokens from erc20Vault to uniV3Vault. Only users with administrator or operator roles can call the function.
Specs
- ✅ works correctly
calculateNewInterval
Return Values:
checkMutableParams
checkImmutableParams
checkTickDeviations
calculateTargetRatioOfToken1
Return Values:
calculateAmountsForSwap
Return Values:
depositCallback
withdrawCallback
Structs
Events
TokensSwapped
UpdateMutableParams
Rebalance
PositionMinted
PositionBurned
BatchCall
⛽ 435Kbatchcall
⛽ 23K- ✅ returns results
- ✅ edge cases: when arrays have different lengths reverts with INVL
- ✅ edge cases: when targets arrays not only of contracts reverts with “Address: delegate call to non-contract”
ContractMeta
contractName
contractNameBytes
contractVersion
contractVersionBytes
DefaultAccessControl
Inherits from AccessControlEnumerable, AccessControl, ERC165, Context ⛽ 1.35M This is a default access control with 3 roles:- ADMIN: allowed to do anything
- ADMIN_DELEGATE: allowed to do anything except assigning ADMIN and ADMIN_DELEGATE roles
- OPERATOR: low-privileged role, generally keeper or some other bot
Functions
constructor
isAdmin
Return Values:
isOperator
Return Values:
Structs
DefaultAccessControlLateInit
Inherits from AccessControlEnumerable, AccessControl, ERC165, Context ⛽ 1.25M This is a default access control with 3 roles:- ADMIN: allowed to do anything
- ADMIN_DELEGATE: allowed to do anything except assigning ADMIN and ADMIN_DELEGATE roles
- OPERATOR: low-privileged role, generally keeper or some other bot
Functions
isAdmin
Return Values:
Specs
- ✅ returns
trueif sender is an admin,falseotherwise
isOperator
Return Values:
Specs
- ✅ returns
trueif sender is an operator,falseotherwise
init
⛽ 301KStructs
DefaultProxy
Inherits from TransparentUpgradeableProxy, ERC1967Proxy, ERC1967Upgrade, Proxyconstructor
DefaultProxyAdmin
Inherits from ProxyAdmin, Ownable, ContextERC20RootVaultHelper
⛽ 445KgetTvlToken0
ERC20Token
⛽ 1.01MDOMAIN_SEPARATOR
- ✅ returns domaint separator
approve
- ✅ allows
senderto transferspenderanamountand emits Approval
transfer
- ✅ transfers
amountfrommsg.sendertoto - ✅ rom transfers
amountfromfromtotoif allowed
transferFrom
- ✅ transfers
amountfromfromtotoif allowed
permit
- ✅ emits Approval
- ✅ edge cases: when deadline less than current timestamp reverts with TS
- ✅ edge cases: when incorrect signature reverts with FRB
GearboxHelper
Functions
setParameters
verifyInstances
calculateEarnedCvxAmountByEarnedCrvAmount
calculateClaimableRewards
calculateDesiredTotalValue
calcConvexTokensToWithdraw
calcRateRAY
calculateAmountInMaximum
createUniswapMulticall
checkNecessaryDepositExchange
claimRewards
withdrawFromConvex
depositToConvex
adjustPosition
swapExactOutput
pullFromAddress
openCreditAccount
Events
CreditAccountOpened
PositionAdjusted
HStrategyHelper
⛽ 3.26McalculateExpectedRatios
Return Values:
calculateMissingTokenAmounts
Return Values:
calculateExtraTokenAmountsForUniV3Vault
Return Values:
calculateExtraTokenAmountsForMoneyVault
Return Values:
calculateExpectedTokenAmountsByExpectedRatios
Return Values:
calculateCurrentTokenAmounts
Return Values:
calculateCurrentCapitalInToken0
Return Values:
calculateExpectedTokenAmountsInToken0
Return Values:
swapNeeded
Return Values:
tokenRebalanceNeeded
Return Values:
calculateAndCheckDomainPositionParams
checkSpotTickDeviationFromAverage
calculateNewPositionTicks
Return Values:
calculateExpectedTokenAmounts
Return Values:
LStrategyHelper
⛽ 1.5Mconstructor
checkOrder
tickFromPriceX96
MultiPoolHStrategyRebalancer
Inherits from DefaultAccessControlLateInit, AccessControlEnumerable, AccessControl, ERC165, Context ⛽ 7.09MFunctions
constructor
initialize
createRebalancer
Return Values:
getTvls
processRebalance
calculateExpectedAmounts
calculateNewPosition
Structs
Events
PositionsMinted
PositionsBurned
TokensSwapped
PulseStrategyHelper
getStrategyParams
calculateAmountForSwap
PulseStrategyV2Helper
getStrategyParams
calculateAmountForSwap
QuickPulseStrategyHelper
getStrategyParams
calculateAmountForSwap
QuickSwapHelper
constructor
calculateTvl
liquidityToTokenAmounts
tokenAmountsToLiquidity
tokenAmountsToMaxLiquidity
calculateLiquidityToPull
increaseCumulative
calculateInnerFeesGrow
calculateCollectableRewards
convertTokenToUnderlying
SinglePositionStrategyHelper
checkUniV3PoolState
checkAlgebraPoolState
UniV3Helper
⛽ 2.82Mconstructor
liquidityToTokenAmounts
- ✅ returns correct vaulues for type(uint128).max
tokenAmountsToLiquidity
tokenAmountsToMaximalLiquidity
getPoolByNft
getFeesByNft
calculateTvlBySqrtPriceX96
calculateTvlByMinMaxPrices
getTickDeviationForTimeSpan
- ✅ returns withFail=true if there is no observation in the pool that was not made before secondsAgo
getPositionTokenAmountsByCapitalOfToken0
- ✅ test uniV3Helper, borders: -600 0
- ✅ test uniV3Helper, borders: 600 1200
- ✅ test uniV3Helper, borders: -600 600
WhiteList
Inherits from DefaultAccessControl, AccessControlEnumerable, AccessControl, ERC165, Context ⛽ 2.49MFunctions
constructor
deposit
⛽ 483K- ✅ works correctly
- ✅ reverts on wrong address
updateRoot
⛽ 47KStructs
Events
Deposit
AllowAllValidator
Inherits from Validator, BaseValidator, ERC165, ContractMeta ⛽ 851KFunctions
constructor
- ✅ deploys a new contract
validate
- ✅ successful validate
Structs
BaseValidator
Functions
constructor
stagedValidatorParams
stagedValidatorParamsTimestamp
validatorParams
stageValidatorParams
commitValidatorParams
Structs
Events
StagedValidatorParams
CommittedValidatorParams
CowswapValidator
Inherits from Validator, BaseValidator, ERC165, ContractMeta ⛽ 909KFunctions
constructor
- ✅ deploys a new contract
validate
- ✅ successful validate
- ✅ edge cases: when selector is not 0xec6cb13f reverts with INVS
Structs
CurveValidator
Inherits from Validator, BaseValidator, ERC165, ContractMeta ⛽ 1.14MFunctions
constructor
- ✅ deploys a new contract
validate
- ✅ successful validate
- ✅ edge cases: when selector is not 0x3df02124 reverts with INVS
- ✅ edge cases: when token ids are equal reverts with INV
- ✅ edge cases: when not a vault token reverts with INVTO
- ✅ edge cases: when pool has no approve permission reverts with FRB
Structs
ERC20Validator
Inherits from Validator, BaseValidator, ERC165, ContractMeta ⛽ 1.14MFunctions
constructor
- ✅ deploys a new contract
validate
- ✅ successful validate, spender can approve
- ✅ successful validate, sender is trusted strategy
- ✅ edge cases: when value is not zero reverts with INV
- ✅ edge cases: when selector is not 0x095ea7b3 reverts with INVS
- ✅ edge cases: when no transfer permission reverts with FRB
- ✅ edge cases: when no approve permission reverts with FRB
Structs
QuickSwapValidator
Inherits from Validator, BaseValidator, ERC165, ContractMetaFunctions
constructor
validate
Structs
UniV2Validator
Inherits from Validator, BaseValidator, ERC165, ContractMeta ⛽ 1.58MFunctions
constructor
- ✅ deploys a new contract
validate
- ✅ selector is 0x7ff36ab5 or 0xfb3bdb41 successful validate
- ✅ selector is 0x7ff36ab5 or 0xfb3bdb41 edge cases: when addr is not swap reverts with INVTR
- ✅ selector is 0x7ff36ab5 or 0xfb3bdb41 edge cases: when selector is wrong reverts with INVS
- ✅ selector is 0x7ff36ab5 or 0xfb3bdb41 edge cases: when path is too small reverts with INVL
- ✅ selector is 0x7ff36ab5 or 0xfb3bdb41 edge cases: when not a vault token reverts with INVTO
- ✅ selector is 0x7ff36ab5 or 0xfb3bdb41 edge cases: when tokens are the same reverts with INVTO
- ✅ selector is 0x7ff36ab5 or 0xfb3bdb41 edge cases: when pool has no approve permission reverts with FRB
- ✅ selector is 0x7ff36ab5 or 0xfb3bdb41 edge cases: when sender is not a reciever reverts
- ✅ selector is one of: 0x4a25d94a, 0x18cbafe5, 0x38ed1739, 0x8803dbee successful validate
- ✅ selector is one of: 0x4a25d94a, 0x18cbafe5, 0x38ed1739, 0x8803dbee edge cases: when value is not zero reverts with INV
- ✅ selector is one of: 0x4a25d94a, 0x18cbafe5, 0x38ed1739, 0x8803dbee edge cases: when sender is not reciever reverts
- ✅ selector is one of: 0x4a25d94a, 0x18cbafe5, 0x38ed1739, 0x8803dbee edge cases: when path too small reverts with INVL
- ✅ selector is one of: 0x4a25d94a, 0x18cbafe5, 0x38ed1739, 0x8803dbee edge cases: when not a vault token reverts with INVTO
- ✅ selector is one of: 0x4a25d94a, 0x18cbafe5, 0x38ed1739, 0x8803dbee edge cases: when tokens are the same reverts with INVTO
- ✅ selector is one of: 0x4a25d94a, 0x18cbafe5, 0x38ed1739, 0x8803dbee edge cases: when pool has no approve permission reverts with FRB
Structs
UniV3Validator
Inherits from Validator, BaseValidator, ERC165, ContractMeta ⛽ 1.75MFunctions
constructor
- ✅ deploys a new contract
validate
- ✅ edge cases: if addr is not swap reverts with INVTR
- ✅ edge cases: if value is not zero reverts with INV
- ✅ edge cases: if selector is wrong reverts with INVS
- ✅ selector is 0x414bf389 successful validate
- ✅ selector is 0x414bf389 edge cases: if recipient is not sender reverts with INVTR
- ✅ selector is 0x414bf389 edge cases: if not a vault token reverts with INVTO
- ✅ selector is 0x414bf389 edge cases: if tokens are the same reverts with INVTO
- ✅ selector is 0x414bf389 edge cases: if pool has no permisson reverts with FRB
- ✅ selector is 0xdb3e2198 successfull validate
- ✅ selector is 0xdb3e2198 edge cases: if recipient is not sender reverts with INVTR
- ✅ selector is 0xdb3e2198 edge cases: if not a vault token reverts with INVTO
- ✅ selector is 0xdb3e2198 edge cases: if tokens are the same reverts with INVTO
- ✅ selector is 0xdb3e2198 edge cases: if pool has no permisson reverts with FRB
- ✅ selector is 0xc04b8d59 successfull validate
- ✅ selector is 0xc04b8d59 edge cases: if recipient is not sender reverts with INVTR
- ✅ selector is 0xc04b8d59 edge cases: if tokens are the same reverts with INVTO
- ✅ selector is 0xc04b8d59 edge cases: if pool has no approve permission reverts with FRB
- ✅ selector is 0xc04b8d59 edge cases: if not a vault token reverts with INVTO
- ✅ selector is 0xf28c0498 successfull validate
- ✅ selector is 0xf28c0498 edge cases: if recipient is not sender reverts with INVTR
- ✅ selector is 0xf28c0498 edge cases: if tokens are the same reverts with INVTO
- ✅ selector is 0xf28c0498 edge cases: if pool has no approve permission reverts with FRB
- ✅ selector is 0xf28c0498 edge cases: if not a vault token reverts with INVTO
Structs
Validator
Inherits from BaseValidator, ERC165Functions
supportsInterface
interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified\[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.
Structs
AaveVault
Inherits from Vault, ERC165, ReentrancyGuard ⛽ 4.96M Vault that interfaces Aave protocol in the integration layer. 📕 Notes: TVL The TVL of the vault is cached and updated after each deposit withdraw. So essentiallytvl call doesn’t take into account accrued interest / donations to Aave since the last deposit / withdraw
aTokens aTokens are fixed at the token creation and addresses are taken from Aave Lending Pool. So essentially each aToken is fixed for life of the AaveVault. If the aToken is missing for some vaultToken, the AaveVault cannot be created.
Push / Pull It is assumed that any amounts of tokens can be deposited / withdrawn from Aave. The contract’s vaultTokens are fully allowed to Aave Lending Pool.
tvl
Specs
- ✅ returns total value locked
- ✅ returns total value locked, no time passed from initialization
- ✅ edge cases: when there are no initial funds returns zeroes
lendingPool
- ✅ returns ILendingPool
- ✅ access control: allowed: any address
supportsInterface
interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified\[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.
Specs
- ✅ returns true if this contract supports 0x18026500 interface
- ✅ access control: allowed: any address
- ✅ returns true if this contract supports 0x7a63aa3a interface
- ✅ access control: allowed: any address
- ✅ edge cases: when contract does not support the given interface returns false
updateTvls
⛽ 94K (93K - 95K)- ✅ updates total value locked
initialize
⛽ 200K (159K - 245K)
Specs
- ✅ emits Initialized event
- ✅ initializes contract successfully
- ✅ edge cases: when vault’s nft is not 0 reverts with INIT
- ✅ edge cases: when tokens are not sorted reverts with INVA
- ✅ edge cases: when tokens are not unique reverts with INVA
- ✅ edge cases: when setting zero nft reverts with VZ
- ✅ edge cases: when setting token with address zero reverts with AZ
- ✅ edge cases: when token has no permission to become a vault token reverts with FRB
AaveVaultGovernance
Inherits from VaultGovernance, ERC165, ContractMeta ⛽ 2.31M Governance that manages all Aave Vaults params and can deploy a new Aave Vault.Functions
constructor
Specs
- ✅ deploys a new contract
- ✅ initializes internalParams
- ✅ when lendingPool address is 0 reverts
- ✅ when estimatedAaveAPY is 0 reverts
- ✅ when estimatedAaaveAPY is larger than limit reverts
- ✅ when protocolGovernance address is 0 reverts
- ✅ when vaultRegistry address is 0 reverts
delayedProtocolParams
- ✅ returns current DelayedProtocolParams
- ✅ allowed: any address
- ✅ staging DelayedProtocolParams doesn’t change delayedProtocolParams
- ✅ when no params were committed returns non-zero params initialized in constructor
supportsInterface
interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified\[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.
Specs
- ✅ returns true if this contract supports 0x2f8c3ff3 interface
- ✅ access control: allowed: any address
stagedDelayedProtocolParams
- ✅ returns DelayedProtocolParams staged for commit
- ✅ allowed: any address
- ✅ always equals to params that were just staged
- ✅ when no params are staged for commit returns zero struct
- ✅ when params were just committed returns zero struct
stageDelayedProtocolParams
⛽ 88K (52K - 129K)
Specs
- ✅ stages DelayedProtocolParams for commit
- ✅ sets delay for commit
- ✅ emits StageDelayedProtocolParams event
- ✅ allowed: ProtocolGovernance admin
- ✅ denied: Vault NFT Owner (aka liquidity provider)
- ✅ denied: Vault NFT Approved (aka strategy)
- ✅ denied: deployer
- ✅ denied: random address
- ✅ cannot be called by random address
- ✅ when estimated Aave APY is larger than limit reverts
- ✅ when called twice succeeds with the last value
- ✅ when called with zero params reverts with zero params
commitDelayedProtocolParams
⛽ 50K (49K - 54K)- ✅ commits staged DelayedProtocolParams
- ✅ resets delay for commit
- ✅ emits CommitDelayedProtocolParams event
- ✅ allowed: ProtocolGovernance admin
- ✅ denied: Vault NFT Owner (aka liquidity provider)
- ✅ denied: Vault NFT Approved (aka strategy)
- ✅ denied: deployer
- ✅ denied: random address
- ✅ cannot be called by random address
- ✅ reverts if called before the delay has elapsed
- ✅ succeeds if called after the delay has elapsed
- ✅ when called twice reverts
- ✅ when nothing is staged reverts
- ✅ when delay has not elapsed reverts
createVault
⛽ 729K (665K - 942K)
Specs
- ✅ deploys a new vault
- ✅ registers vault with vault registry and issues nft
- ✅ the nft is owned by the owner from #createVault arguments
- ✅ vault is initialized with nft
- ✅ when permissionless allowed: any address
- ✅ when not permissionless allowed: protocol governance admin
- ✅ when not permissionless denied: any address
Structs
Events
StageDelayedProtocolParams
CommitDelayedProtocolParams
AggregateVault
Inherits from Vault, ERC165 Vault that combines several integration layer Vaults into one Vault.subvaultNfts
subvaultOneBasedIndex
Return Values:
hasSubvault
Return Values:
subvaultAt
Return Values:
tvl
supportsInterface
interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified\[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.
ERC20RootVault
Inherits from AggregateVault, Vault, ERC165, ReentrancyGuard, ERC20Token ⛽ 7.12M Contract that mints and burns LP tokens in exchange for ERC20 liquidity.Functions
depositorsAllowlist
- ✅ returns non zero length of depositorsAllowlist
- ✅ access control: allowed: any address
supportsInterface
interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified\[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.
Specs
- ✅ returns true if this contract supports 0x23040f0a interface
- ✅ edge cases: when contract does not support the given interface returns false
- ✅ access control: allowed: any address
addDepositorsToAllowlist
⛽ 112K (22K - 126K)
Specs
- ✅ adds depositor to allow list
- ✅ access control: allowed: admin
- ✅ access control: not allowed: deployer
- ✅ access control: not allowed: any address
removeDepositorsFromAllowlist
⛽ 50K (49K - 53K)
Specs
- ✅ removes depositor to allow list
- ✅ access control: allowed: admin
- ✅ access control: not allowed: deployer
- ✅ access control: not allowed: any address
initialize
Specs
- ✅ edge cases: when root vault is not owner of subvault nft reverts with FRB
- ✅ edge cases: when subVault index is 0 (rootVault has itself as subVaul) reverts with DUP
- ✅ edge cases: when subVault index index is 0 reverts with DUP
deposit
⛽ 467K (357K - 750K)
Return Values:
Specs
- ✅ rsAllowlist returns non zero length of depositorsAllowlist
- ✅ rsAllowlist access control: allowed: any address
- ✅ emits Deposit event
- ✅ checking protocol fees charges fees
- ✅ edge cases: when performance fee is zero do not charge performance fees
- ✅ edge cases: when management fee is zero not charges management fees
- ✅ edge cases: when deposit is disabled reverts with FRB
- ✅ edge cases: when there is no depositor in allow list reverts with FRB
- ✅ edge cases: when there is a private vault in delayedStrategyParams reverts with FRB
- ✅ edge cases: when minLpTokens is greater than lpAmount reverts with LIMU
- ✅ edge cases: when tokenAmounts is less than or equal to FIRST_DEPOSIT_LIMIT reverts with LIMU
- ✅ edge cases: when depositCallback Address is set emits deposits callback called
- ✅ edge cases: when lpAmount is zero reverts with VZ
- ✅ edge cases: when sum of lpAmount and sender balance is greater than tokenLimitPerAddress reverts with LIMO
- ✅ edge cases: when sum of lpAmount and totalSupply is greater than tokenLimit reverts with LIMO
- ✅ access control: allowed: any address
withdraw
⛽ 499K (364K - 983K)
Return Values:
Specs
- ✅ emits Withdraw event
- ✅ edge cases: when total supply is 0 reverts with VZ
- ✅ edge cases: when length of vaultsOptions and length of _subvaultNfts are different reverts with INVL
- ✅ edge cases: when withdrawn is larger than protocol governance withdraw limit for vault token reverts with LIMO
- ✅ edge cases: When address of lpCallback is not null emits withdrawCallback
- ✅ edge cases: When address of lpCallback is not null and lpCallback throws empty error emits WithdrawCallbackLog
- ✅ edge cases: When address of lpCallback is not null and lpCallback throws non empty error emits WithdrawCallbackLog
- ✅ access control: allowed: any address
Events
ManagementFeesCharged
ProtocolFeesCharged
PerformanceFeesCharged
Deposit
Withdraw
DepositCallbackLog
WithdrawCallbackLog
ERC20RootVaultGovernance
Inherits from VaultGovernance, ERC165, ContractMeta ⛽ 4.53M Governance that manages all Lp Issuers params and can deploy a new LpIssuer Vault.Functions
constructor
Specs
- ✅ deploys a new contract
- ✅ initializes internalParams
- ✅ when protocolGovernance address is 0 reverts
- ✅ when vaultRegistry address is 0 reverts
delayedProtocolParams
- ✅ returns current DelayedProtocolParams
- ✅ allowed: any address
- ✅ staging DelayedProtocolParams doesn’t change delayedProtocolParams
- ✅ when no params were committed returns non-zero params initialized in constructor
stagedDelayedProtocolParams
- ✅ returns DelayedProtocolParams staged for commit
- ✅ allowed: any address
- ✅ always equals to params that were just staged
- ✅ when no params are staged for commit returns zero struct
- ✅ when params were just committed returns zero struct
delayedProtocolPerVaultParams
Specs
- ✅ returns current DelayedProtocolPerVaultParams
- ✅ allowed: any address
- ✅ staging DelayedProtocolPerVaultParams doesn’t change delayedProtocolPerVaultParams
- ✅ when no params were committed returns zero params
stagedDelayedProtocolPerVaultParams
Specs
- ✅ returns DelayedProtocolPerVaultParams staged for commit
- ✅ allowed: any address
- ✅ always equals to params that were just staged
- ✅ when no params are staged for commit returns zero struct
- ✅ when params were just committed returns zero struct
stagedDelayedStrategyParams
Specs
- ✅ returns DelayedStrategyParams staged for commit
- ✅ allowed: any address
- ✅ always equals to params that were just staged
- ✅ when no params are staged for commit returns zero struct
- ✅ when params were just committed returns zero struct
operatorParams
- ✅ returns operatorParams
- ✅ allowed: any address
- ✅ when operatorParams have not been set returns zero params
delayedStrategyParams
Specs
- ✅ returns current DelayedStrategyParams
- ✅ allowed: any address
- ✅ staging DelayedStrategyParams doesn’t change delayedStrategyParams
- ✅ when no params were committed returns zero params
strategyParams
supportsInterface
- ✅ returns true if this contract supports 0x6a2c3330 interface
- ✅ access control: allowed: any address
stageDelayedStrategyParams
⛽ 160K (67K - 244K)
Specs
- ✅ stages DelayedStrategyParams for commit
- ✅ sets zero delay for commit when #commitDelayedStrategyParams was called 0 times (init)
- ✅ sets governance delay for commit after #commitDelayedStrategyParams was called at least once
- ✅ emits StageDelayedStrategyParams event
- ✅ allowed: ProtocolGovernance admin
- ✅ allowed: Vault NFT Approved (aka strategy)
- ✅ allowed: Vault NFT Owner (aka liquidity provider)
- ✅ denied: deployer
- ✅ denied: random address
- ✅ cannot be called by random address
- ✅ when managementFee is exceeds MAX_MANAGEMENT_FEE reverts with LIMO
- ✅ when performnaceFee is exceeds MAX_PERFORMANCE_FEE reverts with LIMO
- ✅ when called twice succeeds with the last value
- ✅ when called with zero params succeeds with zero params
commitDelayedStrategyParams
⛽ 118K (75K - 195K)
Specs
- ✅ commits staged DelayedStrategyParams
- ✅ resets delay for commit
- ✅ emits CommitDelayedStrategyParams event
- ✅ allowed: ProtocolGovernance admin
- ✅ allowed: Vault NFT Owner (aka liquidity provider)
- ✅ allowed: Vault NFT Approved (aka strategy)
- ✅ denied: deployer
- ✅ denied: random address
- ✅ cannot be called by random address
- ✅ reverts if called before the delay has elapsed (after commit was called initally)
- ✅ succeeds if called after the delay has elapsed
- ✅ when called twice reverts
- ✅ when nothing is staged reverts
- ✅ when delay has not elapsed (after initial commit call) reverts
stageDelayedProtocolPerVaultParams
⛽ 108K (54K - 108K)
Specs
- ✅ stages DelayedProtocolPerVaultParams for commit
- ✅ sets delay for commit
- ✅ emits StageDelayedProtocolPerVaultParams event
- ✅ allowed: ProtocolGovernance admin
- ✅ denied: Vault NFT Owner (aka liquidity provider)
- ✅ denied: Vault NFT Approved (aka strategy)
- ✅ denied: deployer
- ✅ denied: random address
- ✅ cannot be called by random address
- ✅ when called twice succeeds with the last value
- ✅ when called with zero params succeeds with zero params
- ✅ when protocol fee is greater than MAX_PROTOCOL_FEE reverts
commitDelayedProtocolPerVaultParams
⛽ 80K (44K - 80K)
Specs
- ✅ commits staged DelayedProtocolPerVaultParams
- ✅ resets delay for commit
- ✅ emits CommitDelayedProtocolPerVaultParams event
- ✅ allowed: ProtocolGovernance admin
- ✅ denied: Vault NFT Owner (aka liquidity provider)
- ✅ denied: Vault NFT Approved (aka strategy)
- ✅ denied: deployer
- ✅ denied: random address
- ✅ cannot be called by random address
- ✅ reverts if called before the delay has elapsed only if params have already been commited
- ✅ succeeds if called after the delay has elapsed
- ✅ when called twice reverts
- ✅ when nothing is staged reverts
- ✅ when delay has not elapsed and params have not been commited reverts
- ✅ when params have already been set and delay has not elapsed reverts
setStrategyParams
⛽ 113K (37K - 115K)setOperatorParams
⛽ 51K (35K - 77K)
Specs
- ✅ sets new operatorParams
- ✅ access constrol allowed: ProtocolGovernance admin or Operator
- ✅ access constrol denied: any other address
- ✅ setting new oprator params overwrites old params immediately
stageDelayedProtocolParams
⛽ 88K (52K - 129K)
Specs
- ✅ stages DelayedProtocolParams for commit
- ✅ sets delay for commit
- ✅ emits StageDelayedProtocolParams event
- ✅ allowed: ProtocolGovernance admin
- ✅ denied: Vault NFT Owner (aka liquidity provider)
- ✅ denied: Vault NFT Approved (aka strategy)
- ✅ denied: deployer
- ✅ denied: random address
- ✅ cannot be called by random address
- ✅ when called twice succeeds with the last value
- ✅ when called with zero params reverts with zero params
commitDelayedProtocolParams
⛽ 50K (49K - 54K)- ✅ commits staged DelayedProtocolParams
- ✅ resets delay for commit
- ✅ emits CommitDelayedProtocolParams event
- ✅ allowed: ProtocolGovernance admin
- ✅ denied: Vault NFT Owner (aka liquidity provider)
- ✅ denied: Vault NFT Approved (aka strategy)
- ✅ denied: deployer
- ✅ denied: random address
- ✅ cannot be called by random address
- ✅ reverts if called before the delay has elapsed
- ✅ succeeds if called after the delay has elapsed
- ✅ when called twice reverts
- ✅ when nothing is staged reverts
- ✅ when delay has not elapsed reverts
createVault
⛽ 915K (794K - 1.32M)
Specs
- ✅ deploys a new vault
- ✅ registers vault with vault registry and issues nft
- ✅ the nft is owned by the owner from #createVault arguments
- ✅ vault is initialized with nft
- ✅ when permissionless allowed: any address
- ✅ when not permissionless allowed: protocol governance admin
- ✅ when not permissionless denied: any address
Structs
Events
StageDelayedProtocolPerVaultParams
CommitDelayedProtocolPerVaultParams
StageDelayedStrategyParams
CommitDelayedStrategyParams
SetStrategyParams
SetOperatorParams
StageDelayedProtocolParams
CommitDelayedProtocolParams
ERC20Vault
Inherits from Vault, ERC165, ReentrancyGuard ⛽ 4.41M Vault that stores ERC20 tokens.tvl
Specs
- ✅ returns total value locked
- ✅ edge cases: when there are no initial funds returns zeroes
initialize
Specs
- ✅ emits Initialized event
- ✅ initializes contract successfully
- ✅ edge cases: when vault’s nft is not 0 reverts with INIT
- ✅ edge cases: not initialized when vault’s nft is 0 returns false
- ✅ edge cases: when tokens are not sorted reverts with INVA
- ✅ edge cases: when tokens are not unique reverts with INVA
- ✅ edge cases: when setting zero nft reverts with VZ
- ✅ edge cases: when setting empty tokens array reverts with INV
- ✅ edge cases: when token has no permission to become a vault token reverts with FRB
supportsInterface
interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified\[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.
Specs
- ✅ returns true if this contract supports 0x7a63aa3a interface
- ✅ access control: allowed: any address
- ✅ edge cases: when contract does not support the given interface returns false
ERC20VaultGovernance
Inherits from VaultGovernance, ERC165, ContractMeta ⛽ 1.59M Governance that manages all ERC20 Vaults params and can deploy a new ERC20 Vault.Functions
constructor
Specs
- ✅ deploys a new contract
- ✅ initializes internalParams
- ✅ when protocolGovernance address is 0 reverts
- ✅ when vaultRegistry address is 0 reverts
createVault
⛽ 475K (463K - 648K)
Specs
- ✅ deploys a new vault
- ✅ registers vault with vault registry and issues nft
- ✅ the nft is owned by the owner from #createVault arguments
- ✅ vault is initialized with nft
- ✅ when permissionless allowed: any address
- ✅ when not permissionless allowed: protocol governance admin
- ✅ when not permissionless denied: any address
Structs
GearboxRootVault
Inherits from AggregateVault, Vault, ERC165, ReentrancyGuard, ERC20Token Contract that mints and burns LP tokens in exchange for ERC20 liquidity.Functions
depositorsAllowlist
supportsInterface
interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified\[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.
addDepositorsToAllowlist
removeDepositorsFromAllowlist
initialize
deposit
Return Values:
registerWithdrawal
Return Values:
cancelWithdrawal
Return Values:
invokeExecution
withdraw
Return Values:
shutdown
reopen
Events
ManagementFeesCharged
WithdrawalRegistered
WithdrawalCancelled
ExecutionInvoked
ProtocolFeesCharged
PerformanceFeesCharged
Deposit
Withdraw
DepositCallbackLog
WithdrawCallbackLog
GearboxVault
Inherits from Vault, ERC165, ReentrancyGuardFunctions
tvl
supportsInterface
interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified\[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.
getCreditAccount
getAllAssetsOnCreditAccountValue
getClaimableRewardsValue
getMerkleProof
initialize
openCreditAccount
adjustPosition
setMerkleParameters
updateTargetMarginalFactor
multicall
swap
openCreditAccountInManager
Events
TargetMarginalFactorUpdated
GearboxVaultGovernance
Inherits from VaultGovernance, ERC165, ContractMetaFunctions
constructor
delayedProtocolParams
supportsInterface
interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified\[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.
stagedDelayedProtocolParams
stagedDelayedProtocolPerVaultParams
strategyParams
delayedProtocolPerVaultParams
stageDelayedProtocolParams
commitDelayedProtocolParams
stageDelayedProtocolPerVaultParams
commitDelayedProtocolPerVaultParams
setStrategyParams
createVault
Structs
Events
StageDelayedProtocolPerVaultParams
CommitDelayedProtocolPerVaultParams
StageDelayedProtocolParams
SetStrategyParams
CommitDelayedProtocolParams
IntegrationVault
Inherits from Vault, ERC165, ReentrancyGuard Abstract contract that has logic common for every Vault. 📕 Notes:ERC-721
Each Vault should be registered in VaultRegistry and get corresponding VaultRegistry NFT.Access control
push and pull methods are only allowed for owner / approved person of the NFT. However, pull for approved person also checks that pull destination is another vault of the Vault System.
The semantics is: NFT owner owns all Vault liquidity, Approved person is liquidity manager. ApprovedForAll person cannot do anything except ERC-721 token transfers.
Both NFT owner and approved person can call externalCall method which claims liquidity mining rewards (if any)
reclaimTokens for claiming rewards given by an underlying protocol to erc20Vault in order to sell them there
Functions
supportsInterface
interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified\[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.
push
Return Values:
transferAndPush
push method above but transfers tokens to vault balance prior to calling push. After the push it returns all the leftover tokens back (push method doesn’t guarantee that tokenAmounts will be invested in full).
Parameters:
Return Values:
pull
to address.
📕 Can only be called but Vault Owner or Strategy. Vault owner is the owner of NFT for this vault in VaultManager. Strategy is approved address for the vault NFT. When called by vault owner this method just pulls the tokens from the protocol to the to address When called by strategy on vault other than zero vault it pulls the tokens to zero vault (required to == zero vault) When called by strategy on zero vault it pulls the tokens to zero vault, pushes tokens on the to vault, and reclaims everything that’s left. Thus any vault other than zero vault cannot have any tokens on it
Tokens must be a subset of Vault Tokens. However, the convention is that if tokenAmount == 0 it is the same as token is missing.
Pull is fulfilled on the best effort basis, i.e. if the tokenAmounts overflows available funds it withdraws all the funds.
Parameters:
Return Values:
reclaimTokens
Return Values:
isValidSignature
Return Values:
externalCall
Return Values:
Events
Push
Pull
ReclaimTokens
MellowVault
Inherits from Vault, ERC165, ReentrancyGuard ⛽ 4.91M Vault that stores ERC20 tokens.tvl
initialize
MellowVaultGovernance
Inherits from VaultGovernance, ERC165, ContractMeta ⛽ 1.6M Governance that manages all Mellow Vaults params and can deploy a new Mellow Vault.Functions
constructor
createVault
Structs
QuickSwapVault
Inherits from Vault, ERC165, ReentrancyGuard Vault that interfaces QuickSwap protocol in the integration layer.Functions
constructor
initialize
onERC721Received
IERC721 tokenId token is transferred to this contract via IERC721-safeTransferFrom by operator from from, this function is called. It must return its Solidity selector to confirm the token transfer. If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. The selector can be obtained in Solidity with IERC721.onERC721Received.selector.
openFarmingPosition
burnFarmingPosition
collectEarnings
⛽ 135K (121K - 195K)collectRewards
tvl
supportsInterface
interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified\[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.
strategyParams
Events
CollectedEarnings
CollectedRewards
QuickSwapVaultGovernance
Inherits from VaultGovernance, ERC165, ContractMeta Governance that manages all QuickSwap Vaults params and can deploy a new QuickSwap Vault.Functions
constructor
strategyParams
supportsInterface
interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified\[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.
setStrategyParams
createVault
Structs
Events
SetStrategyParams
UniV3Vault
Inherits from Vault, ERC165, ReentrancyGuard ⛽ 6.61M Vault that interfaces UniswapV3 protocol in the integration layer.Functions
tvl
Specs
- ✅ returns total value locked
- ✅ edge cases: when there are no initial funds returns zeroes
- ✅ edge cases: when push was made but there was no minted position returns zeroes
supportsInterface
interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified\[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.
Specs
- ✅ returns true if this contract supports 0x88878d28 interface
- ✅ access control: allowed: any address
- ✅ returns true if this contract supports 0x7a63aa3a interface
- ✅ access control: allowed: any address
- ✅ edge cases: when contract does not support the given interface returns false
positionManager
- ✅ returns INonfungiblePositionManager
- ✅ access control: allowed: any address
liquidityToTokenAmounts
Return Values:
Specs
- ✅ returns tokenAmounts corresponding to liquidity
tokenAmountsToLiquidity
Return Values:
Specs
- ✅ returns zero in case of zero amounts
- ✅ returns more than zero in case of non-zero amounts
- ✅ returns proportionally correct
- ✅ returns correctly in case of tick being out of position by the left
- ✅ returns correctly in case of tick being out of position by the right
initialize
⛽ 186K
Specs
- ✅ emits Initialized event
- ✅ initializes contract successfully
- ✅ edge cases: when vault’s nft is not 0 reverts with INIT
- ✅ edge cases: when tokens are not sorted reverts with INVA
- ✅ edge cases: when tokens are not unique reverts with INVA
- ✅ edge cases: when tokens length is not equal to 2 reverts with INV
- ✅ edge cases: when setting zero nft reverts with VZ
- ✅ edge cases: when token has no permission to become a vault token reverts with FRB
onERC721Received
IERC721 tokenId token is transferred to this contract via IERC721-safeTransferFrom by operator from from, this function is called. It must return its Solidity selector to confirm the token transfer. If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. The selector can be obtained in Solidity with IERC721.onERC721Received.selector.
Specs
- ✅ updates vault’s uniV3Nft
- ✅ edge cases: when msg.sender is not a position manager reverts
- ✅ edge cases: when operator is not a strategy reverts
- ✅ edge cases: when UniV3 token is not valid reverts
- ✅ edge cases: prevent from adding nft while liquidity is not empty reverts
- ✅ access control: position manager: allowed
- ✅ access control: any other address: not allowed
collectEarnings
- ✅ emits CollectedEarnings event
- ✅ collecting fees
- ✅ edge cases: when there is no minted position reverts
- ✅ access control: allowed: all addresses
Structs
Events
CollectedEarnings
UniV3VaultGovernance
Inherits from VaultGovernance, ERC165, ContractMeta ⛽ 3.02M Governance that manages all UniV3 Vaults params and can deploy a new UniV3 Vault.Functions
constructor
Specs
- ✅ deploys a new contract
- ✅ initializes internalParams
- ✅ when positionManager address is 0 reverts
- ✅ when oracle address is 0 reverts
- ✅ when protocolGovernance address is 0 reverts
- ✅ when vaultRegistry address is 0 reverts
delayedProtocolParams
- ✅ returns current DelayedProtocolParams
- ✅ allowed: any address
- ✅ staging DelayedProtocolParams doesn’t change delayedProtocolParams
- ✅ when no params were committed returns non-zero params initialized in constructor
stagedDelayedProtocolParams
- ✅ returns DelayedProtocolParams staged for commit
- ✅ allowed: any address
- ✅ always equals to params that were just staged
- ✅ when no params are staged for commit returns zero struct
- ✅ when params were just committed returns zero struct
stagedDelayedStrategyParams
delayedStrategyParams
supportsInterface
interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified\[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.
Specs
- ✅ returns true if this contract supports 0xa2e9c513 interface
- ✅ access control: allowed: any address
stageDelayedProtocolParams
⛽ 88K (52K - 129K)
Specs
- ✅ stages DelayedProtocolParams for commit
- ✅ sets delay for commit
- ✅ emits StageDelayedProtocolParams event
- ✅ allowed: ProtocolGovernance admin
- ✅ denied: Vault NFT Owner (aka liquidity provider)
- ✅ denied: Vault NFT Approved (aka strategy)
- ✅ denied: deployer
- ✅ denied: random address
- ✅ cannot be called by random address
- ✅ when called twice succeeds with the last value
- ✅ when called with zero params reverts with zero params
commitDelayedProtocolParams
⛽ 50K (50K - 54K)- ✅ commits staged DelayedProtocolParams
- ✅ resets delay for commit
- ✅ emits CommitDelayedProtocolParams event
- ✅ allowed: ProtocolGovernance admin
- ✅ denied: Vault NFT Owner (aka liquidity provider)
- ✅ denied: Vault NFT Approved (aka strategy)
- ✅ denied: deployer
- ✅ denied: random address
- ✅ cannot be called by random address
- ✅ reverts if called before the delay has elapsed
- ✅ succeeds if called after the delay has elapsed
- ✅ when called twice reverts
- ✅ when nothing is staged reverts
- ✅ when delay has not elapsed reverts
stageDelayedStrategyParams
⛽ 121KcommitDelayedStrategyParams
⛽ 94KcreateVault
⛽ 563K (550K - 577K)
Specs
- ✅ deploys a new vault
- ✅ registers vault with vault registry and issues nft
- ✅ the nft is owned by the owner from #createVault arguments
- ✅ vault is initialized with nft
- ✅ when permissionless allowed: any address
- ✅ when not permissionless allowed: protocol governance admin
- ✅ when not permissionless denied: any address
- ✅ when fee is not supported by uni v3 reverts
Structs
Events
StageDelayedProtocolParams
CommitDelayedProtocolParams
StageDelayedStrategyParams
CommitDelayedStrategyParams
Vault
Inherits from ERC165 Abstract contract that has logic common for every Vault. 📕 Notes:ERC-721
Each Vault should be registered in VaultRegistry and get corresponding VaultRegistry NFT.Access control
push and pull methods are only allowed for owner / approved person of the NFT. However, pull for approved person also checks that pull destination is another vault of the Vault System.
The semantics is: NFT owner owns all Vault liquidity, Approved person is liquidity manager. ApprovedForAll person cannot do anything except ERC-721 token transfers.
Both NFT owner and approved person can call externalCall method which claims liquidity mining rewards (if any)
reclaimTokens for mistakenly transfered tokens (not included into vaultTokens) additionally can be withdrawn by the protocol admin
Functions
initialized
isVaultToken
Return Values:
vaultGovernance
vaultTokens
nft
tvl
pullExistentials
supportsInterface
interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified\[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.
Events
Initialized
VaultGovernance
Inherits from ERC165 Internal contract for managing different params. 📕 The contract should be overriden by the concrete VaultGovernance, define different params structs and use abi.decode / abi.encode to serialize to bytes in this contract. It also should emit events on params change.Functions
delayedStrategyParamsTimestamp
delayedProtocolPerVaultParamsTimestamp
delayedProtocolParamsTimestamp
internalParamsTimestamp
internalParams
stagedInternalParams
supportsInterface
stageInternalParams
commitInternalParams
Structs
Events
StagedInternalParams
CommitedInternalParams
DeployedVault
YearnVault
Inherits from Vault, ERC165, ReentrancyGuard ⛽ 4.81M Vault that interfaces Yearn protocol in the integration layer. 📕 Notes: TVL The TVL of the vault is updated after each deposit withdraw. yTokens yTokens are fixed at the token creation and addresses are taken from YearnVault governance and if missing there- in YearnVaultRegistry. So essentially each yToken is fixed for life of the YearnVault. If the yToken is missing for some vaultToken, the YearnVault cannot be created.
yTokens
- ✅ returns list of yTokens
tvl
Specs
- ✅ returns total value locked
- ✅ edge cases: when there are no initial funds returns zeroes
supportsInterface
interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified\[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.
Specs
- ✅ returns true if this contract supports 0x073ab565 interface
- ✅ access control: allowed: any address
- ✅ returns true if this contract supports 0x7a63aa3a interface
- ✅ access control: allowed: any address
- ✅ edge cases: when contract does not support the given interface returns false
initialize
Specs
- ✅ emits Initialized event
- ✅ initializes contract successfully
- ✅ edge cases: when vault’s nft is not 0 reverts with INIT
- ✅ edge cases: when tokens are not sorted reverts with INVA
- ✅ edge cases: when tokens are not unique reverts with INVA
- ✅ edge cases: when setting zero nft reverts with VZ
- ✅ edge cases: when token has no permission to become a vault token reverts with FRB
YearnVaultGovernance
Inherits from VaultGovernance, ERC165, ContractMeta ⛽ 2.4M Governance that manages all Aave Vaults params and can deploy a new Aave Vault.Functions
constructor
Specs
- ✅ deploys a new contract
- ✅ initializes internalParams
- ✅ when YearnVaultRegistry address is 0 reverts
- ✅ when protocolGovernance address is 0 reverts
- ✅ when vaultRegistry address is 0 reverts
yTokenForToken
Return Values:
Specs
- ✅ returns yToken (yVault) in yToken overrides (set by #setYTokenForToken) or corresponding to ERC20 token in YearnVaultRegistry
- ✅ allowed: any address
- ✅ when yToken doesn’t exist in overrides or YearnVaultRegistry returns 0
- ✅ when yToken was not overridden by #setYTokenForToken returns token from YearnVaultRegistry
- ✅ when yToken was overridden by #setYTokenForToken returns overridden token
stagedDelayedProtocolParams
- ✅ returns DelayedProtocolParams staged for commit
- ✅ allowed: any address
- ✅ always equals to params that were just staged
- ✅ when no params are staged for commit returns zero struct
- ✅ when params were just committed returns zero struct
delayedProtocolParams
- ✅ returns current DelayedProtocolParams
- ✅ allowed: any address
- ✅ staging DelayedProtocolParams doesn’t change delayedProtocolParams
- ✅ when no params were committed returns non-zero params initialized in constructor
supportsInterface
interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified\[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.
Specs
- ✅ returns true if this contract supports 0x15482137 interface
- ✅ access control: allowed: any address
stageDelayedProtocolParams
⛽ 75K (49K - 106K)
Specs
- ✅ stages DelayedProtocolParams for commit
- ✅ sets delay for commit
- ✅ emits StageDelayedProtocolParams event
- ✅ allowed: ProtocolGovernance admin
- ✅ denied: Vault NFT Owner (aka liquidity provider)
- ✅ denied: Vault NFT Approved (aka strategy)
- ✅ denied: deployer
- ✅ denied: random address
- ✅ cannot be called by random address
- ✅ when called twice succeeds with the last value
- ✅ when called with zero params reverts with zero params
commitDelayedProtocolParams
⛽ 43K (43K - 45K)- ✅ commits staged DelayedProtocolParams
- ✅ resets delay for commit
- ✅ emits CommitDelayedProtocolParams event
- ✅ allowed: ProtocolGovernance admin
- ✅ denied: Vault NFT Owner (aka liquidity provider)
- ✅ denied: Vault NFT Approved (aka strategy)
- ✅ denied: deployer
- ✅ denied: random address
- ✅ cannot be called by random address
- ✅ reverts if called before the delay has elapsed
- ✅ succeeds if called after the delay has elapsed
- ✅ when called twice reverts
- ✅ when nothing is staged reverts
- ✅ when delay has not elapsed reverts
setYTokenForToken
⛽ 51K (35K - 56K)
Specs
- ✅ sets a yToken override for a ERC20 token
- ✅ emits SetYToken event
- ✅ allowed: ProtocolGovernance admin
- ✅ denied: Vault NFT Owner (aka liquidity provider)
- ✅ denied: Vault NFT Approved (aka strategy)
- ✅ denied: deployer
- ✅ denied: random address
- ✅ when yToken is 0 succeeds
- ✅ when called twice succeeds
createVault
⛽ 569K (559K - 810K)
Specs
- ✅ deploys a new vault
- ✅ registers vault with vault registry and issues nft
- ✅ the nft is owned by the owner from #createVault arguments
- ✅ vault is initialized with nft
- ✅ when permissionless allowed: any address
- ✅ when not permissionless allowed: protocol governance admin
- ✅ when not permissionless denied: any address