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

function addTradersUnclaimedPoints(address[] _traders, enum IFeeTiers.CreditType[] _creditTypes, uint224[] _points) internal

Check IFeeTiersUtils interface for documentation

updateTraderPoints

function updateTraderPoints(address _trader, uint256 _volumeUsd, uint256 _groupIndex) internal

Check IFeeTiersUtils interface for documentation

calculateFeeAmount

function calculateFeeAmount(address _trader, uint256 _normalFeeAmountCollateral) internal view returns (uint256)

Check IFeeTiersUtils interface for documentation

getFeeTiersCount

function getFeeTiersCount() internal view returns (uint256)

Check IFeeTiersUtils interface for documentation

getFeeTier

function getFeeTier(uint256 _feeTierIndex) internal view returns (struct IFeeTiers.FeeTier)

Check IFeeTiersUtils interface for documentation

getGroupVolumeMultiplier

function getGroupVolumeMultiplier(uint256 _groupIndex) internal view returns (uint256)

Check IFeeTiersUtils interface for documentation

getFeeTiersTraderInfo

function getFeeTiersTraderInfo(address _trader) internal view returns (struct IFeeTiers.TraderInfo)

Check IFeeTiersUtils interface for documentation

getTraderFeeTiersEnrollment

function getTraderFeeTiersEnrollment(address _trader) internal view returns (struct IFeeTiers.TraderEnrollment)

Check IFeeTiersUtils interface for documentation

getTraderUnclaimedPoints

function getTraderUnclaimedPoints(address _trader) internal view returns (uint224)

Check IFeeTiersUtils interface for documentation

getFeeTiersTraderDailyInfo

function getFeeTiersTraderDailyInfo(address _trader, uint32 _day) internal view returns (struct IFeeTiers.TraderDailyInfo)

Check IFeeTiersUtils interface for documentation

_getSlot

function _getSlot() internal pure returns (uint256)

Returns storage slot to use when fetching storage relevant to library

_getStorage

function _getStorage() internal pure returns (struct IFeeTiers.FeeTiersStorage s)

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

_checkFeeTierUpdateValid

function _checkFeeTierUpdateValid(uint256 _index, struct IFeeTiers.FeeTier _feeTier, struct IFeeTiers.FeeTier[8] _feeTiers) internal view

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

Parameters

_getCurrentDay

function _getCurrentDay() internal view returns (uint32)

Get current day (index of mapping traderDailyInfo)

_claimUnclaimedPoints

function _claimUnclaimedPoints(address _trader) internal

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

Last updated