Skip to main content

SlpManager

The SlpManager contract manages the Staked Liquidity Provider (SLP) token system for the Satoshi Perps protocol. It handles the minting and burning of SLP tokens in exchange for providing liquidity to the protocol.
For a visual representation of the liquidity provision process, see the Protocol Flow Charts page.

Contract Overview

The SlpManager handles:
  • Minting SLP tokens when users add liquidity
  • Burning SLP tokens when users remove liquidity
  • Tracking and distributing fees to liquidity providers
  • Managing the SLP token price based on underlying assets
SLP tokens represent a user’s share of the protocol’s liquidity pool and entitle holders to a portion of protocol fees.

Key Functions

Liquidity Management

Adds liquidity to the protocol and mints SLP tokens. Returns the amount of SLP tokens minted.
Burns SLP tokens and returns the underlying assets.

AUM Calculation

Calculates the total Assets Under Management (AUM) of the protocol.
Calculates the AUM in terms of USDG.

Price Calculation

Calculates the price of SLP tokens based on the AUM and total supply.

Fee Management

Sets the cooldown duration for SLP token redemptions.
Sets adjustments to the AUM calculation for accurate pricing.

SLP Token Mechanics

The SLP token system works as follows:
  1. Users deposit tokens into the protocol through the SlpManager
  2. The SlpManager mints SLP tokens representing the user’s share of the pool
  3. The value of SLP tokens increases as the protocol earns fees
  4. Users can redeem SLP tokens for the underlying assets plus earned fees
SLP tokens are subject to a cooldown period before they can be redeemed. This helps prevent flash loan attacks and provides stability to the protocol.

AUM and Price Calculation

The Assets Under Management (AUM) calculation is a critical component of SLP pricing:
The price of SLP tokens increases as:
  • The protocol earns fees, which are added to the pool
  • Profits from liquidations accrue to the pool
  • The value of assets in the pool increases

Integration with Vault

The SlpManager is tightly integrated with the Vault contract:
  1. The Vault uses the liquidity provided through the SlpManager
  2. Fees earned by the Vault are distributed to SLP token holders
  3. The SlpManager helps maintain the stability of the protocol by providing liquidation reserves

Handler System and Private Mode

The SlpManager implements a handler system and private mode for controlled access:
  • Handlers: Addresses authorized to perform certain functions
  • Private Mode: When enabled, only authorized addresses can add/remove liquidity
These features are controlled via:

ShortsTracker Integration

The SlpManager integrates with the ShortsTracker contract to account for global short positions when calculating AUM:
This integration ensures accurate tracking of protocol assets and liabilities.

Security Considerations

The SlpManager implements several security features:
  • Cooldown Period: Prevents flash loan exploits
  • Minimum Output Amounts: Protects users from slippage
  • AUM Adjustments: Allows fine-tuning of SLP pricing
  • Access Controls: Restricts sensitive functions to authorized addresses
  • Private Mode: Ability to restrict liquidity operations to trusted addresses
  • Handler System: Fine-grained permissions for different functions

Example Usage

1

Adding Liquidity

A user wants to provide liquidity to the protocol.
2

Checking SLP Value

The user checks the value of their SLP tokens after some time.
3

Removing Liquidity

Later, the user decides to withdraw their liquidity.

Fee Distribution

SLP token holders earn fees in several ways:
  • Swap fees from token exchanges in the Vault
  • Borrowing fees from leveraged traders
  • Liquidation fees when underwater positions are liquidated
These fees are automatically added to the pool value, increasing the redemption value of SLP tokens over time.