Skip to main content

IVault Interface

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

Returns whether the Vault has been initialized.
Returns whether leverage trading is enabled.
Returns the address of the Router contract.
Returns the address of the USDG token.
Returns the address of the governance controller.
Returns the number of whitelisted tokens.
Returns the maximum allowed leverage.

Protocol Configuration

Returns the minimum time positions must be held for profits to be recognized.
Returns whether the protocol uses dynamic fee adjustments.
Returns the interval for funding rate updates.
Returns the sum of all token weights.
Returns the target USDG amount for a token based on its weight.

Mode Settings

Returns whether the Vault is in manager mode (restricted operations).
Returns whether the Vault is in private liquidation mode.
Returns the maximum gas price for certain operations.

Access and Roles

Returns whether a router is approved for an account.
Returns whether an account is authorized as a liquidator.
Returns whether an account is authorized as a manager.

Token Configurations

Returns the minimum profit basis points for a token.
Returns the actual token balance in the contract.
Returns the last time funding was updated for a token.

Token State

Returns the decimals for a token.
Returns the weight for a token.
Returns the USD value guaranteed to be available for a token.
Returns the amount of tokens in the pool.
Returns the buffer amount for a token.
Returns the reserved amount for a token.
Returns the USDG amount for a token.
Returns the maximum USDG amount for a token.

Token Lists

Returns the number of whitelisted tokens.
Returns the whitelisted token at the specified index.
Returns whether a token is whitelisted.
Returns whether a token is a stablecoin.
Returns whether a token can be shorted.

Fees and Rates

Returns the fee reserves for a token.
Returns the funding rate factor for non-stable tokens.
Returns the funding rate factor for stable tokens.
Returns the cumulative funding rate for a token.
Returns the next funding rate for a token.
Returns the liquidation fee in USD.
Returns the tax basis points.
Returns the stable tax basis points.
Returns the mint burn fee basis points.
Returns the swap fee basis points.
Returns the stable swap fee basis points.
Returns the margin fee basis points.

Shorts State

Returns the global short size for a token.
Returns the global short average price for a token.
Returns the maximum global short size for a token.

Open Interest Tracking

Returns the maximum allowed open interest for long positions of a token.
Returns the maximum allowed open interest for short positions of a token.
Returns the current total open interest for long positions of a token.
Returns the current total open interest for short positions of a token.

Configuration Functions

Core Configuration

Sets the VaultUtils contract address.
Sets an error message for an error code.
Sets the maximum leverage.
Sets whether the Vault is in manager mode.
Sets or removes a manager.
Sets whether leverage trading is enabled.
Sets the maximum gas price.
Sets whether the Vault is in private liquidation mode.
Sets or removes a liquidator.

Token Configuration

Configures a token with all its parameters.
Sets the USDG amount for a token.
Sets the buffer amount for a token.
Sets the maximum global short size for a token.

Fee and Rate Configuration

Sets the funding rate parameters.
Sets all fee parameters.
Sets the price feed address.

Action Functions

Token Operations

Deposits a token directly to the pool without minting USDG.
Buys USDG tokens with the provided token.
Sells USDG tokens for the specified token.
Swaps tokens.
Withdraws collected fees to the specified receiver.
Upgrades the Vault by transferring tokens to a new Vault.

Position Management

Increases the size of a position.
Decreases the size of a position.
Liquidates a position.

Utility Functions

Price and Value Calculation

Converts token amount to minimum USD value.
Returns the amount of tokens to be redeemed for USDG.
Returns the maximum price for a token.
Returns the minimum price for a token.

Position Calculations

Returns all details about a position.
Returns the delta (profit/loss) for a position.
Validates whether a position can be liquidated.
Calculates the fee basis points based on token imbalance.