Skip to main content

IVaultUtils Interface

The IVaultUtils interface defines the functions available in the VaultUtils contract, which provides utility functions for the Vault including fee calculations, position validation, and funding rate updates.

Position Validation

Validates whether a position can be liquidated and returns liquidation information.

Fee Calculations

Calculates the fee for increasing or decreasing a position.
Calculates the funding fee for a position based on its size and entry funding rate.
Calculates dynamic fee basis points based on token pool utilization.

Configuration

Updates the cumulative funding rate for a token pair.
Sets the address of the Vault contract.

Usage Notes

  • The VaultUtils contract is a companion to the main Vault, handling complex calculations and validations.
  • It helps keep the Vault code cleaner and more modular.
  • The contract is upgradeable separately from the main Vault, allowing improvements to fee calculations without changing the core Vault.
  • All interactions with VaultUtils typically flow through the Vault contract rather than being called directly by users.

Security Considerations

  • VaultUtils has access to the Vault’s state, so its security is critical.
  • The fee calculations directly affect protocol economics and user experience.
  • Liquidation validation is a critical security component that protects the protocol from undercollateralized positions.