FeeTiersUtils

_GNSFeeTiers facet internal library

This is a library to apply fee tiers to trading fees based on a trailing point system._

initializeFeeTiers

function initializeFeeTiers(uint256[] _groupIndices, uint256[] _groupVolumeMultipliers, uint256[] _feeTiersIndices, struct IFeeTiers.FeeTier[] _feeTiers) internal

Check IFeeTiersUtils interface for documentation

setGroupVolumeMultipliers

function setGroupVolumeMultipliers(uint256[] _groupIndices, uint256[] _groupVolumeMultipliers) internal

Check IFeeTiersUtils interface for documentation

setFeeTiers

function setFeeTiers(uint256[] _feeTiersIndices, struct IFeeTiers.FeeTier[] _feeTiers) internal

Check IFeeTiersUtils interface for documentation

setTradersFeeTiersEnrollment

function setTradersFeeTiersEnrollment(address[] _traders, struct IFeeTiers.TraderEnrollment[] _values) internal

Check IFeeTiersUtils interface for documentation

addTradersUnclaimedPoints

Check IFeeTiersUtils interface for documentation

updateTraderPoints

Check IFeeTiersUtils interface for documentation

calculateFeeAmount

Check IFeeTiersUtils interface for documentation

getFeeTiersCount

Check IFeeTiersUtils interface for documentation

getFeeTier

Check IFeeTiersUtils interface for documentation

getGroupVolumeMultiplier

Check IFeeTiersUtils interface for documentation

getFeeTiersTraderInfo

Check IFeeTiersUtils interface for documentation

getTraderFeeTiersEnrollment

Check IFeeTiersUtils interface for documentation

getTraderUnclaimedPoints

Check IFeeTiersUtils interface for documentation

getFeeTiersTraderDailyInfo

Check IFeeTiersUtils interface for documentation

_getSlot

Returns storage slot to use when fetching storage relevant to library

_getStorage

Returns storage pointer for storage struct in diamond contract, at defined slot

_checkFeeTierUpdateValid

Checks validity of a single fee tier update (feeMultiplier: descending, pointsThreshold: ascending, no gap)

Parameters

Name
Type
Description

_index

uint256

index of the fee tier that was updated

_feeTier

fee tier new value

_feeTiers

all fee tiers

_getCurrentDay

Get current day (index of mapping traderDailyInfo)

_claimUnclaimedPoints

Claims unclaimed points for a trader and adds them to the daily points for the current day. In the event that it's the first points update for the trader, backdates points to yesterday so the tier discount becomes immediate.

Parameters

Name
Type
Description

_trader

address

trader address

Last updated

Was this helpful?