VELA Knowledge Base
  • Exchange
    • Platform Overview
    • Account Setup
      • Deposit & Withdraw
      • 1-Click Trading
    • Staking
      • $VLP
      • $VELA and $esVELA
      • Rewards
      • Hyper VLP
        • Hyper VLP Legacy
        • Hyper VLP 2.0
    • Trading
      • Positions
        • Profit, Loss, and ROI
        • Increase Collateral/ Leverage
        • Add to Position
        • Triggered Orders
        • Edit Triggered Orders
        • Close Position
      • Chart Trading
      • Mobile
    • Platform Mechanics
      • Fees
      • Price Feeds
      • Risk Mitigation
    • Tokenomics
    • Restricted Countries
  • Community
    • Grand Prix Trading Competition
      • Credits
      • Missions & Streaks
      • Nitro Boost
    • Social Features
      • Referrals
      • Share Trade
      • Leaderboards
      • AstraBit Guide
      • Previous Events
        • Pirate's Loot Trading Competition
    • NFTs
  • Support
    • Resources (Links)
    • Brand Kit
    • Gnosis Safe Management
  • Developers
    • APIs
      • The Graph API
      • Trade Bots API
      • Market Maker API
    • Asset Pairs and VelaId
    • Contracts
      • Arbitrum Mainnet
      • Arbitrum Testnet
      • Base Mainnet
      • Base Testnet
    • Contract Functions
      • Vault
      • Position Vault
      • Liquidate Vault
      • Order Vault
      • Price Manager
      • Settings Manager
      • Multicall
    • Audit
Powered by GitBook
On this page
  • Initialize
  • Register Liquidate Position
  • Liquidate Position
  • Validate Liquidation With Posid
  • Validate Liquidation With Posid And Price
  • Validate Liquidation
  1. Developers
  2. Contract Functions

Liquidate Vault

This contract is responsible for managing the liquidation of positions in a trading context. It includes several functions and events for registering and executing liquidations, as well as validating

Initialize

This function is used to initialize the contract and set up the necessary interfaces.

liquidateVault.initialize();

Register Liquidate Position

This function allows an address to register a position for liquidation.

liquidateVault.registerLiquidatePosition(
    uint256 _posId
);

Liquidate Position

This function allows an address to liquidate a position if it meets certain conditions.

liquidateVault.liquidatePosition(
    uint256 _posId
);

Validate Liquidation With Posid

This function is used to check if a position is eligible for liquidation.

Example Input:

liquidateVault.validateLiquidationWithPosid(
    uint256 _posId
);

Example Output:

// Returns a boolean indicating whether the position is liquidatable, and three integers representing pnl, fundingFee, and borrowFee respectively.

Validate Liquidation With Posid And Price

This function is used to check if a position is eligible for liquidation, given a specific price.

Example Input:

liquidateVault.validateLiquidationWithPosidAndPrice(
    uint256 _posId,
    uint256 _price
);

Example Output:

// Returns a boolean indicating whether the position is liquidatable, and three integers representing pnl, fundingFee, and borrowFee respectively.

Validate Liquidation

This function calculates the profit and loss (PnL), funding fee, and borrow fee for a position and checks if the position is eligible for liquidation.

Example Input:

liquidateVault.validateLiquidation(
    uint256 _tokenId,
    bool _isLong,
    uint256 _size,
    uint256 _averagePrice,
    uint256 _lastPrice,
    uint256 _lastIncreasedTime,
    uint256 _accruedBorrowFee,
    int256 _fundingIndex,
    uint256 _collateral
);

Example Output:

// Returns a boolean indicating whether the position is liquidatable, and three integers representing pnl, fundingFee, and borrowFee respectively.
PreviousPosition VaultNextOrder Vault

Last updated 1 year ago