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
initializeFeeTiers
Initializes 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, includingfeeMultiplier
andpointsThreshold
.
setGroupVolumeMultipliers
setGroupVolumeMultipliers
Updates volume multipliers for specified groups.
Parameters:
_groupIndices
: Array of group indices to update._groupVolumeMultipliers
: Array of new volume multipliers (scaled by 1e3).
setFeeTiers
setFeeTiers
Updates fee tiers with new configurations.
Parameters:
_feeTiersIndices
: Array of fee tier indices to update._feeTiers
: Array of updated fee tier configurations, includingfeeMultiplier
andpointsThreshold
.
updateTraderPoints
updateTraderPoints
Updates 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
calculateFeeAmount
Calculates 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
getFeeTiersCount
Retrieves the total number of active fee tiers.
Returns: The count of active fee tiers.
getFeeTier
getFeeTier
Fetches the details of a specific fee tier.
Parameters:
_feeTierIndex
: Index of the fee tier.
Returns: Fee tier details including
feeMultiplier
andpointsThreshold
.
getGroupVolumeMultiplier
getGroupVolumeMultiplier
Retrieves 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
getFeeTiersTraderInfo
Gets 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
lastDayUpdated
andtrailingPoints
.
getFeeTiersTraderDailyInfo
getFeeTiersTraderDailyInfo
Fetches 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
feeMultiplierCache
andpoints
.
Last updated