JavFeeTiers
General Description
The JavFeeTiers contract used for managing and calculating fee tiers and volume multipliers for a trading system. It supports defining and updating fee-related parameters for different trading groups and individual traders.
Core Functionalities
initializeFeeTiers
initializeFeeTiersInitializes fee tiers and group volume multipliers.
Parameters:
_groupIndices: Array of group indices (pairs storage fee index) to initialize._groupVolumeMultipliers: Corresponding group volume multipliers (scaled by 1e3)._feeTiersIndices: Array of fee tier indices to initialize._feeTiers: Array of fee tier configurations, includingfeeMultiplierandpointsThreshold.
setGroupVolumeMultipliers
setGroupVolumeMultipliersUpdates volume multipliers for specified groups.
Parameters:
_groupIndices: Array of group indices to update._groupVolumeMultipliers: Array of new volume multipliers (scaled by 1e3).
setFeeTiers
setFeeTiersUpdates fee tiers with new configurations.
Parameters:
_feeTiersIndices: Array of fee tier indices to update._feeTiers: Array of updated fee tier configurations, includingfeeMultiplierandpointsThreshold.
updateTraderPoints
updateTraderPointsUpdates a trader’s daily points based on a new trade, recalculates trailing points, and caches the trader's daily fee tier.
Parameters:
_trader: Address of the trader._volumeUsd: Trading volume in USD (scaled by 1e18)._pairIndex: Pair index associated with the trade.
calculateFeeAmount
calculateFeeAmountCalculates the fee amount for a trader after applying their active fee tier multiplier.
Parameters:
_trader: Address of the trader._normalFeeAmountCollateral: Base fee amount (in collateral precision).
Returns: Adjusted fee amount after applying the active multiplier.
getFeeTiersCount
getFeeTiersCountRetrieves the total number of active fee tiers.
Returns: The count of active fee tiers.
getFeeTier
getFeeTierFetches the details of a specific fee tier.
Parameters:
_feeTierIndex: Index of the fee tier.
Returns: Fee tier details including
feeMultiplierandpointsThreshold.
getGroupVolumeMultiplier
getGroupVolumeMultiplierRetrieves the volume multiplier for a specific group.
Parameters:
_groupIndex: Index of the group (pairs storage fee index).
Returns: Volume multiplier for the specified group.
getFeeTiersTraderInfo
getFeeTiersTraderInfoGets a trader’s general fee-related information, including the last day updated and trailing points.
Parameters:
_trader: Address of the trader.
Returns: Trader info as
lastDayUpdatedandtrailingPoints.
getFeeTiersTraderDailyInfo
getFeeTiersTraderDailyInfoFetches a trader’s fee tier information for a specific day, including the cached fee multiplier and points.
Parameters:
_trader: Address of the trader._day: Specific day for which to fetch the information.
Returns: Daily fee tier information as
feeMultiplierCacheandpoints.
Last updated
Was this helpful?