The IVault interface defines the functions available in the Vault contract, which serves as the core of the Satoshi Perps protocol. The Vault manages all positions, collateral, swaps, and protocol fees.
State Access Functions
Basic Configuration
function isInitialized() external view returns (bool);
Returns whether the Vault has been initialized.
function isLeverageEnabled() external view returns (bool);
Returns whether leverage trading is enabled.
function router() external view returns (address);
Returns the address of the Router contract.
function usdg() external view returns (address);
Returns the address of the USDG token.
function gov() external view returns (address);
Returns the address of the governance controller.
function whitelistedTokenCount() external view returns (uint256);
Returns the number of whitelisted tokens.
function maxLeverage() external view returns (uint256);
Returns the maximum allowed leverage.
Protocol Configuration
function minProfitTime() external view returns (uint256);
Returns the minimum time positions must be held for profits to be recognized.
function hasDynamicFees() external view returns (bool);
Returns whether the protocol uses dynamic fee adjustments.
function fundingInterval() external view returns (uint256);
Returns the interval for funding rate updates.
function totalTokenWeights() external view returns (uint256);
Returns the sum of all token weights.
function getTargetUsdgAmount(address _token) external view returns (uint256);
Returns the target USDG amount for a token based on its weight.
Mode Settings
function inManagerMode() external view returns (bool);
Returns whether the Vault is in manager mode (restricted operations).
function inPrivateLiquidationMode() external view returns (bool);
Returns whether the Vault is in private liquidation mode.
function maxGasPrice() external view returns (uint256);
Returns the maximum gas price for certain operations.
Access and Roles
function approvedRouters(address _account, address _router) external view returns (bool);
Returns whether a router is approved for an account.
function isLiquidator(address _account) external view returns (bool);
Returns whether an account is authorized as a liquidator.
function isManager(address _account) external view returns (bool);
Returns whether an account is authorized as a manager.
Token Configurations
function minProfitBasisPoints(address _token) external view returns (uint256);
Returns the minimum profit basis points for a token.
function tokenBalances(address _token) external view returns (uint256);
Returns the actual token balance in the contract.
function lastFundingTimes(address _token) external view returns (uint256);
Returns the last time funding was updated for a token.
Token State
function tokenDecimals(address _token) external view returns (uint256);
Returns the decimals for a token.
function tokenWeights(address _token) external view returns (uint256);
Returns the weight for a token.
function guaranteedUsd(address _token) external view returns (uint256);
Returns the USD value guaranteed to be available for a token.
function poolAmounts(address _token) external view returns (uint256);
Returns the amount of tokens in the pool.
function bufferAmounts(address _token) external view returns (uint256);
Returns the buffer amount for a token.
function reservedAmounts(address _token) external view returns (uint256);
Returns the reserved amount for a token.
function usdgAmounts(address _token) external view returns (uint256);
Returns the USDG amount for a token.
function maxUsdgAmounts(address _token) external view returns (uint256);
Returns the maximum USDG amount for a token.
Token Lists
function allWhitelistedTokensLength() external view returns (uint256);
Returns the number of whitelisted tokens.
function allWhitelistedTokens(uint256) external view returns (address);
Returns the whitelisted token at the specified index.
function whitelistedTokens(address _token) external view returns (bool);
Returns whether a token is whitelisted.
function stableTokens(address _token) external view returns (bool);
Returns whether a token is a stablecoin.
function shortableTokens(address _token) external view returns (bool);
Returns whether a token can be shorted.
Fees and Rates
function feeReserves(address _token) external view returns (uint256);
Returns the fee reserves for a token.
function fundingRateFactor() external view returns (uint256);
Returns the funding rate factor for non-stable tokens.
function stableFundingRateFactor() external view returns (uint256);
Returns the funding rate factor for stable tokens.
function cumulativeFundingRates(address _token) external view returns (uint256);
Returns the cumulative funding rate for a token.
function getNextFundingRate(address _token) external view returns (uint256);
Returns the next funding rate for a token.
function liquidationFeeUsd() external view returns (uint256);
Returns the liquidation fee in USD.
function taxBasisPoints() external view returns (uint256);
Returns the tax basis points.
function stableTaxBasisPoints() external view returns (uint256);
Returns the stable tax basis points.
function mintBurnFeeBasisPoints() external view returns (uint256);
Returns the mint burn fee basis points.
function swapFeeBasisPoints() external view returns (uint256);
Returns the swap fee basis points.
function stableSwapFeeBasisPoints() external view returns (uint256);
Returns the stable swap fee basis points.
function marginFeeBasisPoints() external view returns (uint256);
Returns the margin fee basis points.
Shorts State
function globalShortSizes(address _token) external view returns (uint256);
Returns the global short size for a token.
function globalShortAveragePrices(address _token) external view returns (uint256);
Returns the global short average price for a token.
function maxGlobalShortSizes(address _token) external view returns (uint256);
Returns the maximum global short size for a token.
Open Interest Tracking
function maxLongOpenInterest(address _token) external view returns (uint256);
Returns the maximum allowed open interest for long positions of a token.
function maxShortOpenInterest(address _token) external view returns (uint256);
Returns the maximum allowed open interest for short positions of a token.
function longOpenInterest(address _token) external view returns (uint256);
Returns the current total open interest for long positions of a token.
function shortOpenInterest(address _token) external view returns (uint256);
Returns the current total open interest for short positions of a token.
Configuration Functions
Core Configuration
function setVaultUtils(IVaultUtils _vaultUtils) external;
Sets the VaultUtils contract address.
function setError(uint256 _errorCode, string calldata _error) external;
Sets an error message for an error code.
function setMaxLeverage(uint256 _maxLeverage) external;
Sets the maximum leverage.
function setInManagerMode(bool _inManagerMode) external;
Sets whether the Vault is in manager mode.
function setManager(address _manager, bool _isManager) external;
Sets or removes a manager.
function setIsLeverageEnabled(bool _isLeverageEnabled) external;
Sets whether leverage trading is enabled.
function setMaxGasPrice(uint256 _maxGasPrice) external;
Sets the maximum gas price.
function setInPrivateLiquidationMode(bool _inPrivateLiquidationMode) external;
Sets whether the Vault is in private liquidation mode.
function setLiquidator(address _liquidator, bool _isActive) external;