Skip to main content

IBasePositionManager Interface

The IBasePositionManager interface defines the functions available in the BasePositionManager contract, which provides core position management functionality for the Satoshi Perps protocol.

Position Management

function increasePosition(
    address[] memory _path,
    address _indexToken,
    uint256 _amountIn,
    uint256 _minOut,
    uint256 _sizeDelta,
    bool _isLong,
    uint256 _price
) external;
Increases a position with the specified parameters.
function decreasePosition(
    address _collateralToken,
    address _indexToken,
    uint256 _collateralDelta,
    uint256 _sizeDelta,
    bool _isLong,
    address _receiver,
    uint256 _price
) external;
Decreases a position with the specified parameters.

Global Size Limits

function setMaxGlobalSizes(
    address[] memory _tokens,
    uint256[] memory _longSizes,
    uint256[] memory _shortSizes
) external;
Sets the maximum global long and short sizes for a list of tokens.
function maxGlobalLongSizes(address _token) external view returns (uint256);
Returns the maximum global long size for a token.
function maxGlobalShortSizes(address _token) external view returns (uint256);
Returns the maximum global short size for a token.

Fee Configuration

function setDepositFee(uint256 _depositFee) external;
Sets the deposit fee basis points.
function depositFee() external view returns (uint256);
Returns the current deposit fee basis points.

Token Management

function transferIn(address _token) external returns (uint256);
Transfers tokens from the sender to the contract.
function transferOut(
    address _token,
    uint256 _amount,
    address _receiver
) external;
Transfers tokens from the contract to a receiver.
function swap(
    address[] memory _path,
    uint256 _amountIn,
    uint256 _minOut,
    address _receiver
) external returns (uint256);
Executes a token swap through the Router.

Fee Collection

function feeReserves(address _token) external view returns (uint256);
Returns the amount of fees collected for a token.
function collectFees(
    address _token,
    address _receiver
) external returns (uint256);
Collects accumulated fees for a token and sends them to the specified receiver.

Contract References

function vault() external view returns (address);
Returns the address of the Vault contract.
function router() external view returns (address);
Returns the address of the Router contract.
function shortsTracker() external view returns (address);
Returns the address of the ShortsTracker contract.
function weth() external view returns (address);
Returns the address of the WETH token.

ETH Handling

function receiveETH() external payable;
Receives ETH sent to the contract.

Usage Notes

  • The BasePositionManager is an abstract contract designed to be inherited by concrete implementations like PositionManager.
  • It provides core functionality for position management but lacks user-facing methods.
  • The contract implements safety checks such as global position size limits.
  • Fee collection is handled automatically when positions are adjusted.

Security Considerations

  • Functions are protected by various access controls in implementing contracts
  • Global size limits help prevent excessive risk concentration in specific tokens
  • Deposit fees may be charged to prevent abuse of zero-fee swaps
I