Contracts

This is the list of contracts on the Avalance Fuji Testnet and the Sepolia Blockchain

Avalance Fuji Testnet

  1. Perps.sol

    Main perpetual futures contract handling:

    • Position management (open/close with leverage)

    • USDC collateral deposits/withdrawals

    • Automated liquidations with VRF randomization

    • Risk management and user limits

    Key Functions:

    function depositUSDC(uint256 usdcAmount)
    function openPosition(string symbol, uint256 collateralUSDC, uint256 leverage, bool isLong)
    function closePosition(string symbol)
    function liquidatePositions() returns (uint256 liquidated)
    CONTRACT_ADDRESS_AVAX=0x9d2b2005ec13fb8a7191b0df208dfbd541827c19
  2. PerpsCalculations.sol

    Risk calculation engine:

    • P&L calculations for long/short positions

    • Liquidation price computation

    • Margin ratio monitoring

    • Position health checks

    PERPS_CALCULATIONS_CONTRACT_ADDRESS : 0xb6fc2a81fc5803a1e5a855e69cdad79eae9a91bc
  3. PerpsFeeManager.sol

    Fee structure management:

    • Opening fee: 1% of collateral

    • Closing fee: 1% of collateral

    • Holding fee: 1% daily on collateral

    • Profit tax: 30% on realized gains

     PERPS_FEE_MANAGER_CONTRACT_ADDRESS : 0x117d284f89fe797a65145e67cc31e21dbbf60cdc
  4. PoolManager.sol

  • Multi-token deposit handler:

    • Accepts AVAX, LINK, and USDC deposits

    • Converts tokens to USDC using Chainlink price feeds

    • Forwards converted USDC to Perps contract

    • Handles both direct deposits and cross-chain CCIP messages

    CONTRACT_ADDRESS_POOL_MANAGER=0xb5abc3e5d2d3b243974f0a323c4f6514f70598cf
  1. PRICE_ORACLE

  • Supplies real-time price feeds for all supported trading assets.

  • Chainlink price feed aggregator:

    • Supports BTC/USD, ETH/USD, AVAX/USD, LINK/USD

    • Normalizes all prices to 8 decimals

    • Real-time price data for position calculations

CONTRACT_ADDRESS_PRICE_FEED_AVAX=0x9f2b180d135c46012c97f5beb02307cc7dc32cbd

Sepolia Testnet

  • Uses Chainlink CCIP to bridge assets from Sepolia to Avalanche

  • Deposits USDC on behalf of users into the main Perps contract on Avalanche Fuji

CROSS_CHAIN_MANAGER_SEPOLIA=0x0bb4543671f72a41efcaa6f089f421446264cc49

Automation & Randomizer

  1. VRFRandomizer.sol

    • Chainlink VRF integration for fair liquidation ordering:

      • Generates verifiable randomness

      • Shuffles user arrays to prevent liquidation front-running

      • Auto-refreshes randomness every 6 hours

    Address: 0xbb0599742317d4a77841d3f0d6c9bf076d83bd5a
  2. TimeLiquidationAutomation.sol & LogLiquidationAutomation.sol

    • Chainlink AutomationTimeLiquidationAutomation.sol & LogLiquidationAutomation.sol

      • Time-based: Triggers liquidations every 4 hours

      • Log-based: Triggers on position events for immediate liquidation checks

    Addresses:

    • Time-based: 0x636f1b91cfd7b91a4f7fb01e52a5df5d818a6060

    • Log-based: 0xaa3ffc9a984d4fcac150a9d5f2b3ce004234b471

  3. VRFAutomation.sol

    Automation contract for VRF randomness refresh:

    • Automatically calls requestRandomWords() every 6 hours

    • Ensures liquidation fairness is maintained

    • Keeps VRF randomization up to date

Address: 0x0687d4d5ea6122d975ef845c0e55a514d65da64a

If you have multiple files, GitBook makes it easy to import full repositories too — allowing you to keep your GitBook content in sync.

Last updated