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
initializeGroupLiquidationParamsInitializes liquidation parameters for all existing groups.
Parameters:
_groupLiquidationParams: Array of liquidation parameters for each group.
addPairs
addPairsAdds new trading pairs.
Parameters:
_pairs: Array of pairs to add.
updatePairs
updatePairsUpdates details of specified trading pairs.
Parameters:
_pairIndices: Indices of pairs to update._pairs: Updated details for the pairs.
removePairs
removePairsRemoves specified trading pairs.
Parameters:
_pairIndices: Indices of pairs to remove.
addGroups
addGroupsAdds new trading pair groups.
Parameters:
_groups: Array of groups to add.
updateGroups
updateGroupsUpdates details of specified groups.
Parameters:
_ids: Indices of groups to update._groups: Updated details for the groups.
addFees
addFeesAdds new fee groups.
Parameters:
_fees: Array of fees to add.
updateFees
updateFeesUpdates details of specified fee groups.
Parameters:
_ids: Indices of fee groups to update._fees: Updated details for the fee groups.
setPairCustomMaxLeverages
setPairCustomMaxLeveragesSets custom maximum leverages for specific pairs.
Parameters:
_indices: Indices of pairs._values: New custom maximum leverage values.
setGroupLiquidationParams
setGroupLiquidationParamsUpdates liquidation parameters for a specific group.
Parameters:
_groupIndex: Index of the group._params: New liquidation parameters.
pairFeed
pairFeedRetrieves the feed identifier for getting the price of a pair.
Parameters:
_pairIndex: Index of the pair.
Returns:
bytes32feed identifier.
isPairListed
isPairListedChecks if a pair is listed based on its trading symbols.
Parameters:
_from: Base asset (e.g., BTC)._to: Quote asset (e.g., USD).
Returns:
boolindicating whether the pair is listed.
isPairIndexListed
isPairIndexListedChecks if a pair index is listed.
Parameters:
_pairIndex: Index of the pair.
Returns:
bool.
pairs
pairsRetrieves details of a specific pair.
Parameters:
_index: Index of the pair.
Returns: Pair details.
pairsCount
pairsCountRetrieves the number of listed trading pairs.
Returns:
uint256count of pairs.
pairSpreadP
pairSpreadPRetrieves the spread percentage of a pair (1e10 precision).
Parameters:
_pairIndex: Index of the pair.
Returns: Spread percentage.
pairMinLeverage
pairMinLeverageRetrieves the minimum leverage for a pair.
Parameters:
_pairIndex: Index of the pair.
Returns: Minimum leverage value.
pairOpenFeeP
pairOpenFeePRetrieves the open fee percentage for a pair (1e10 precision).
Parameters:
_pairIndex: Index of the pair.
Returns: Open fee percentage.
pairCloseFeeP
pairCloseFeePRetrieves the close fee percentage for a pair (1e10 precision).
Parameters:
_pairIndex: Index of the pair.
Returns: Close fee percentage.
pairTriggerOrderFeeP
pairTriggerOrderFeePRetrieves the trigger order fee percentage for a pair (1e10 precision).
Parameters:
_pairIndex: Index of the pair.
Returns: Trigger order fee percentage.
pairMinPositionSizeUsd
pairMinPositionSizeUsdRetrieves the minimum position size in USD for a pair (1e18 precision).
Parameters:
_pairIndex: Index of the pair.
Returns: Minimum position size in USD.
pairMinFeeUsd
pairMinFeeUsdRetrieves the minimum trading fee in USD for a pair (1e18 precision).
Parameters:
_pairIndex: Index of the pair.
Returns: Minimum trading fee in USD.
groups
groupsRetrieves details of a specific group.
Parameters:
_index: Index of the group.
Returns: Group details.
groupsCount
groupsCountRetrieves the number of listed groups.
Returns:
uint256count of groups.
fees
feesRetrieves details of a specific fee group.
Parameters:
_index: Index of the fee group.
Returns: Fee group details.
feesCount
feesCountRetrieves the number of listed fee groups.
Returns:
uint256count of fee groups.
pairsBackend
pairsBackendRetrieves details of a pair, its group, and its fee group.
Parameters:
_index: Index of the pair.
Returns: Pair, group, and fee group details.
pairMaxLeverage
pairMaxLeverageRetrieves the active maximum leverage for a pair.
Parameters:
_pairIndex: Index of the pair.
Returns: Maximum leverage value.
pairCustomMaxLeverage
pairCustomMaxLeverageRetrieves the custom maximum leverage for a pair (0 if not set).
Parameters:
_pairIndex: Index of the pair.
Returns: Custom maximum leverage value.
getAllPairsRestrictedMaxLeverage
getAllPairsRestrictedMaxLeverageRetrieves custom maximum leverage values for all pairs.
Returns: Array of custom maximum leverage values.
getGroupLiquidationParams
getGroupLiquidationParamsRetrieves liquidation parameters for a group.
Parameters:
_groupIndex: Index of the group.
Returns: Liquidation parameters.
getPairLiquidationParams
getPairLiquidationParamsRetrieves liquidation parameters for a pair's group.
Parameters:
_pairIndex: Index of the pair.
Returns: Liquidation parameters.
Last updated
Was this helpful?