JavPairsStorage

General Description

The JavPairsStorage contract used for manage and configure trading pairs, groups, and fee structures for a trading platform. It includes functionality to initialize, add, update, or remove trading pairs and groups. Additionally, it allows querying details about trading pairs, groups, and fees, including their associated parameters like leverage, fees, and liquidation rules. The contract also includes functionality to customize parameters for specific pairs and retrieve configuration details for backend use.

Core Functionalities

initializeGroupLiquidationParams

  • Initializes liquidation parameters for all existing groups.

  • Parameters:

    • _groupLiquidationParams: Array of liquidation parameters for each group.

addPairs

  • Adds new trading pairs.

  • Parameters:

    • _pairs: Array of pairs to add.

updatePairs

  • Updates details of specified trading pairs.

  • Parameters:

    • _pairIndices: Indices of pairs to update.

    • _pairs: Updated details for the pairs.

removePairs

  • Removes specified trading pairs.

  • Parameters:

    • _pairIndices: Indices of pairs to remove.

addGroups

  • Adds new trading pair groups.

  • Parameters:

    • _groups: Array of groups to add.

updateGroups

  • Updates details of specified groups.

  • Parameters:

    • _ids: Indices of groups to update.

    • _groups: Updated details for the groups.

addFees

  • Adds new fee groups.

  • Parameters:

    • _fees: Array of fees to add.

updateFees

  • Updates details of specified fee groups.

  • Parameters:

    • _ids: Indices of fee groups to update.

    • _fees: Updated details for the fee groups.

setPairCustomMaxLeverages

  • Sets custom maximum leverages for specific pairs.

  • Parameters:

    • _indices: Indices of pairs.

    • _values: New custom maximum leverage values.

setGroupLiquidationParams

  • Updates liquidation parameters for a specific group.

  • Parameters:

    • _groupIndex: Index of the group.

    • _params: New liquidation parameters.

pairFeed

  • Retrieves the feed identifier for getting the price of a pair.

  • Parameters:

    • _pairIndex: Index of the pair.

  • Returns: bytes32 feed identifier.

isPairListed

  • Checks if a pair is listed based on its trading symbols.

  • Parameters:

    • _from: Base asset (e.g., BTC).

    • _to: Quote asset (e.g., USD).

  • Returns: bool indicating whether the pair is listed.

isPairIndexListed

  • Checks if a pair index is listed.

  • Parameters:

    • _pairIndex: Index of the pair.

  • Returns: bool.

pairs

  • Retrieves details of a specific pair.

  • Parameters:

    • _index: Index of the pair.

  • Returns: Pair details.

pairsCount

  • Retrieves the number of listed trading pairs.

  • Returns: uint256 count of pairs.

pairSpreadP

  • Retrieves the spread percentage of a pair (1e10 precision).

  • Parameters:

    • _pairIndex: Index of the pair.

  • Returns: Spread percentage.

pairMinLeverage

  • Retrieves the minimum leverage for a pair.

  • Parameters:

    • _pairIndex: Index of the pair.

  • Returns: Minimum leverage value.

pairOpenFeeP

  • Retrieves the open fee percentage for a pair (1e10 precision).

  • Parameters:

    • _pairIndex: Index of the pair.

  • Returns: Open fee percentage.

pairCloseFeeP

  • Retrieves the close fee percentage for a pair (1e10 precision).

  • Parameters:

    • _pairIndex: Index of the pair.

  • Returns: Close fee percentage.

pairTriggerOrderFeeP

  • Retrieves the trigger order fee percentage for a pair (1e10 precision).

  • Parameters:

    • _pairIndex: Index of the pair.

  • Returns: Trigger order fee percentage.

pairMinPositionSizeUsd

  • Retrieves the minimum position size in USD for a pair (1e18 precision).

  • Parameters:

    • _pairIndex: Index of the pair.

  • Returns: Minimum position size in USD.

pairMinFeeUsd

  • Retrieves the minimum trading fee in USD for a pair (1e18 precision).

  • Parameters:

    • _pairIndex: Index of the pair.

  • Returns: Minimum trading fee in USD.

groups

  • Retrieves details of a specific group.

  • Parameters:

    • _index: Index of the group.

  • Returns: Group details.

groupsCount

  • Retrieves the number of listed groups.

  • Returns: uint256 count of groups.

fees

  • Retrieves details of a specific fee group.

  • Parameters:

    • _index: Index of the fee group.

  • Returns: Fee group details.

feesCount

  • Retrieves the number of listed fee groups.

  • Returns: uint256 count of fee groups.

pairsBackend

  • Retrieves details of a pair, its group, and its fee group.

  • Parameters:

    • _index: Index of the pair.

  • Returns: Pair, group, and fee group details.

pairMaxLeverage

  • Retrieves the active maximum leverage for a pair.

  • Parameters:

    • _pairIndex: Index of the pair.

  • Returns: Maximum leverage value.

pairCustomMaxLeverage

  • Retrieves the custom maximum leverage for a pair (0 if not set).

  • Parameters:

    • _pairIndex: Index of the pair.

  • Returns: Custom maximum leverage value.

getAllPairsRestrictedMaxLeverage

  • Retrieves custom maximum leverage values for all pairs.

  • Returns: Array of custom maximum leverage values.

getGroupLiquidationParams

  • Retrieves liquidation parameters for a group.

  • Parameters:

    • _groupIndex: Index of the group.

  • Returns: Liquidation parameters.

getPairLiquidationParams

  • Retrieves liquidation parameters for a pair's group.

  • Parameters:

    • _pairIndex: Index of the pair.

  • Returns: Liquidation parameters.

Last updated