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
initializeGroupLiquidationParams
Initializes liquidation parameters for all existing groups.
Parameters:
_groupLiquidationParams
: Array of liquidation parameters for each group.
addPairs
addPairs
Adds new trading pairs.
Parameters:
_pairs
: Array of pairs to add.
updatePairs
updatePairs
Updates details of specified trading pairs.
Parameters:
_pairIndices
: Indices of pairs to update._pairs
: Updated details for the pairs.
removePairs
removePairs
Removes specified trading pairs.
Parameters:
_pairIndices
: Indices of pairs to remove.
addGroups
addGroups
Adds new trading pair groups.
Parameters:
_groups
: Array of groups to add.
updateGroups
updateGroups
Updates details of specified groups.
Parameters:
_ids
: Indices of groups to update._groups
: Updated details for the groups.
addFees
addFees
Adds new fee groups.
Parameters:
_fees
: Array of fees to add.
updateFees
updateFees
Updates details of specified fee groups.
Parameters:
_ids
: Indices of fee groups to update._fees
: Updated details for the fee groups.
setPairCustomMaxLeverages
setPairCustomMaxLeverages
Sets custom maximum leverages for specific pairs.
Parameters:
_indices
: Indices of pairs._values
: New custom maximum leverage values.
setGroupLiquidationParams
setGroupLiquidationParams
Updates liquidation parameters for a specific group.
Parameters:
_groupIndex
: Index of the group._params
: New liquidation parameters.
pairFeed
pairFeed
Retrieves the feed identifier for getting the price of a pair.
Parameters:
_pairIndex
: Index of the pair.
Returns:
bytes32
feed identifier.
isPairListed
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
isPairIndexListed
Checks if a pair index is listed.
Parameters:
_pairIndex
: Index of the pair.
Returns:
bool
.
pairs
pairs
Retrieves details of a specific pair.
Parameters:
_index
: Index of the pair.
Returns: Pair details.
pairsCount
pairsCount
Retrieves the number of listed trading pairs.
Returns:
uint256
count of pairs.
pairSpreadP
pairSpreadP
Retrieves the spread percentage of a pair (1e10 precision).
Parameters:
_pairIndex
: Index of the pair.
Returns: Spread percentage.
pairMinLeverage
pairMinLeverage
Retrieves the minimum leverage for a pair.
Parameters:
_pairIndex
: Index of the pair.
Returns: Minimum leverage value.
pairOpenFeeP
pairOpenFeeP
Retrieves the open fee percentage for a pair (1e10 precision).
Parameters:
_pairIndex
: Index of the pair.
Returns: Open fee percentage.
pairCloseFeeP
pairCloseFeeP
Retrieves the close fee percentage for a pair (1e10 precision).
Parameters:
_pairIndex
: Index of the pair.
Returns: Close fee percentage.
pairTriggerOrderFeeP
pairTriggerOrderFeeP
Retrieves the trigger order fee percentage for a pair (1e10 precision).
Parameters:
_pairIndex
: Index of the pair.
Returns: Trigger order fee percentage.
pairMinPositionSizeUsd
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
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
groups
Retrieves details of a specific group.
Parameters:
_index
: Index of the group.
Returns: Group details.
groupsCount
groupsCount
Retrieves the number of listed groups.
Returns:
uint256
count of groups.
fees
fees
Retrieves details of a specific fee group.
Parameters:
_index
: Index of the fee group.
Returns: Fee group details.
feesCount
feesCount
Retrieves the number of listed fee groups.
Returns:
uint256
count of fee groups.
pairsBackend
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
pairMaxLeverage
Retrieves the active maximum leverage for a pair.
Parameters:
_pairIndex
: Index of the pair.
Returns: Maximum leverage value.
pairCustomMaxLeverage
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
getAllPairsRestrictedMaxLeverage
Retrieves custom maximum leverage values for all pairs.
Returns: Array of custom maximum leverage values.
getGroupLiquidationParams
getGroupLiquidationParams
Retrieves liquidation parameters for a group.
Parameters:
_groupIndex
: Index of the group.
Returns: Liquidation parameters.
getPairLiquidationParams
getPairLiquidationParams
Retrieves liquidation parameters for a pair's group.
Parameters:
_pairIndex
: Index of the pair.
Returns: Liquidation parameters.
Last updated