Gains Network
  • 📚Home
  • Gains Network
    • 🔎Overview
    • 🍏GNS Token
    • 📔Contract Addresses
      • Apechain Mainnet
      • Arbitrum Mainnet
      • Base Mainnet
      • Polygon Mainnet
  • gTrade (Leveraged Trading)
    • 🔎Overview
    • 🎛️Setting up to trade
      • 🟣Polygon Network Setup
      • 🔵Arbitrum Network Setup
    • 🏦Opening / Closing trades
    • 💲Trade Collaterals
      • Spotlight: WETH
    • 📖Asset classes
      • 🪙Cryptocurrencies
      • 💵Forex
      • 🛢️Commodities
    • 🎫Fees & Spread
    • 📰Pair List
    • 🧒How to use Practice Mode
    • ⚡One-Click Trading (1CT)
    • 🌌gTrade Solana
    • 📺Video tutorials
  • Loyalty Programs
    • Prime Trader
    • gTrade Credits
  • Community
    • gTrade Guardians
    • Governance forum
  • Reward Pools
    • 💚GNS Staking
    • 👛gToken Vaults
      • 👷Staker Functions
      • ❔Staker FAQ
      • ⏳Upgrades, updates, and timelocks
    • 🔼Active Pools & Incentives
  • Help
    • ❓FAQ
    • ⏳Chain congestion
  • Bridges
    • 🪐Arbitrum <-> Polygon Bridge
    • 🪐ERC20 Bridge (Polygon)
    • 🪐NFT Bridge (Polygon)
  • Developer
    • Integrators
      • Trading Contracts
      • Backend
      • Price Feed
      • Guides
        • v9 migration
        • Calculating borrowing fees
        • Calculating liquidation price
    • Technical Reference
      • Contracts
        • Changelogs
          • v9.2.1 Update
          • v9.1 Update
          • v9.1.1 Update
          • v9 Update
        • Core
          • Abstract
            • GNSAddressStore
            • GNSDiamondCut
            • GNSDiamondLoupe
            • GNSDiamondStorage
          • Facets
            • GNSBorrowingFees
            • GNSOtc
            • GNSPriceAggregator
            • GNSTradingInteractions
            • GNSTriggerRewards
            • GNSFeeTiers
            • GNSPairsStorage
            • GNSPriceImpact
            • GNSReferrals
            • GNSTradingCallbacks
            • GNSTradingStorage
          • GNSMultiCollatDiamond
          • GNSStaking
          • GToken
          • GTokenOpenPnlFeed
        • Interfaces
          • Libraries
            • IBorrowingFeesUtils
            • IOtcUtils
            • IPriceAggregatorUtils
            • ITriggerRewardsUtils
            • IFeeTiersUtils
            • IPairsStorageUtils
            • IPriceImpactUtils
            • IReferralsUtils
            • ITradingCallbacksUtils
            • ITradingCommonUtils
            • ITradingInteractionsUtils
            • ITradingStorageUtils
            • IUpdateLeverageUtils
            • IUpdatePositionSizeUtils
          • Types
            • IAddressStore
            • IBorrowingFees
            • IDiamondStorage
            • IOtc
            • IPriceAggregator
            • ITradingStorage
            • ITradingInteractions
            • ITriggerRewards
            • ITypes
            • IUpdateLeverage
            • IPairsStorage
            • IFeeTiers
            • IPriceImpact
            • IReferrals
            • ITradingCallbacks
            • IUpdatePositionSize
          • IChainlinkFeed
          • IArbSys
          • IChainlinkOracle
          • IERC20
          • IERC721
          • IERC721Design
          • IGeneralErrors
          • IGNSAddressStore
          • IGNSDiamond
          • IGNSDiamondCut
          • IGNSMultiCollatDiamond
          • IGNSDiamondLoupe
          • IGNSStaking
          • IGToken
          • IGTokenLockedDepositNft
          • IGTokenOpenPnlFeed
          • IGTokenLockedDepositNftDesign
          • ILiquidityPool
          • IRateProvider
          • IOwnable
        • Libraries
          • updateLeverage
            • UpdateLeverageLifecycles
          • updatePositionSize
            • IncreasePositionSizeUtils
            • DecreasePositionSizeUtils
            • UpdatePositionSizeLifecycles
          • AddressStoreUtils
          • ChainlinkClientUtils
          • ChainUtils
          • ConstantsUtils
          • CollateralUtils
          • DiamondUtils
          • LiquidityPoolUtils
          • OtcUtils
          • PackingUtils
          • StorageUtils
          • TriggerRewardsUtils
          • ArrayGetters
          • BorrowingFeesUtils
          • FeeTiersUtils
          • PriceAggregatorUtils
          • PriceImpactUtils
          • ReferralsUtils
          • TradingCallbacksUtils
          • PairsStorageUtils
          • TradingCommonUtils
          • TradingStorageUtils
          • TradingInteractionsUtils
        • Misc
          • EpochBasedTokenClaim
          • GNSCompensationHandler
          • GTokenRateProvider
          • GTokenLockedDepositNftDesign
          • ManagerTimelock
          • OwnerTimelock
          • VotingDelegator
        • Tokens
          • GainsNetworkToken
          • GTokenLockedDepositNft
      • Backend
        • Backend Types
      • SDK
        • Client Types
  • Archived
    • 🖼️gFARM2 NFTs
Powered by GitBook
On this page
  • initializeGroupLiquidationParams
  • initializeNewFees
  • addPairs
  • updatePairs
  • addGroups
  • updateGroups
  • addFees
  • updateFees
  • setPairCustomMaxLeverages
  • setGroupLiquidationParams
  • setGlobalTradeFeeParams
  • pairJob
  • isPairListed
  • isPairIndexListed
  • pairs
  • pairsCount
  • pairSpreadP
  • pairMinLeverage
  • pairTotalPositionSizeFeeP
  • pairTotalLiqCollateralFeeP
  • pairOraclePositionSizeFeeP
  • pairMinPositionSizeUsd
  • getGlobalTradeFeeParams
  • pairMinFeeUsd
  • pairFeeIndex
  • groups
  • groupsCount
  • fees
  • feesCount
  • pairMaxLeverage
  • pairCustomMaxLeverage
  • getAllPairsRestrictedMaxLeverage
  • getGroupLiquidationParams
  • getPairLiquidationParams
  • _getSlot
  • _getStorage
  • groupListed
  • Parameters
  • feeListed
  • Parameters
  • groupOk
  • Parameters
  • feeOk
  • Parameters
  • _addPair
  • Parameters
  • _updatePair
  • Parameters
  • _addGroup
  • Parameters
  • _updateGroup
  • Parameters
  • _addFee
  • Parameters
  • _updateFee
  • Parameters

Was this helpful?

  1. Developer
  2. Technical Reference
  3. Contracts
  4. Libraries

PairsStorageUtils

GNSPairsStorage facet internal library

initializeGroupLiquidationParams

function initializeGroupLiquidationParams(struct IPairsStorage.GroupLiquidationParams[] _groupLiquidationParams) internal

Check IPairsStorageUtils interface for documentation

initializeNewFees

function initializeNewFees(struct IPairsStorage.GlobalTradeFeeParams _tradeFeeParams) internal

Check IPairsStorageUtils interface for documentation

addPairs

function addPairs(struct IPairsStorage.Pair[] _pairs) internal

Check IPairsStorageUtils interface for documentation

updatePairs

function updatePairs(uint256[] _pairIndices, struct IPairsStorage.Pair[] _pairs) internal

Check IPairsStorageUtils interface for documentation

addGroups

function addGroups(struct IPairsStorage.Group[] _groups) internal

Check IPairsStorageUtils interface for documentation

updateGroups

function updateGroups(uint256[] _ids, struct IPairsStorage.Group[] _groups) internal

Check IPairsStorageUtils interface for documentation

addFees

function addFees(struct IPairsStorage.FeeGroup[] _fees) internal

Check IPairsStorageUtils interface for documentation

updateFees

function updateFees(uint256[] _ids, struct IPairsStorage.FeeGroup[] _fees) internal

Check IPairsStorageUtils interface for documentation

setPairCustomMaxLeverages

function setPairCustomMaxLeverages(uint256[] _indices, uint256[] _values) internal

Check IPairsStorageUtils interface for documentation

setGroupLiquidationParams

function setGroupLiquidationParams(uint256 _groupIndex, struct IPairsStorage.GroupLiquidationParams _params) internal

Check IPairsStorageUtils interface for documentation

setGlobalTradeFeeParams

function setGlobalTradeFeeParams(struct IPairsStorage.GlobalTradeFeeParams _feeParams) internal

Check IPairsStorageUtils interface for documentation

pairJob

function pairJob(uint256 _pairIndex) internal view returns (string, string)

Check IPairsStorageUtils interface for documentation

isPairListed

function isPairListed(string _from, string _to) internal view returns (bool)

Check IPairsStorageUtils interface for documentation

isPairIndexListed

function isPairIndexListed(uint256 _pairIndex) internal view returns (bool)

Check IPairsStorageUtils interface for documentation

pairs

function pairs(uint256 _index) internal view returns (struct IPairsStorage.Pair)

Check IPairsStorageUtils interface for documentation

pairsCount

function pairsCount() internal view returns (uint256)

Check IPairsStorageUtils interface for documentation

pairSpreadP

function pairSpreadP(uint256 _pairIndex) internal view returns (uint256)

Check IPairsStorageUtils interface for documentation

pairMinLeverage

function pairMinLeverage(uint256 _pairIndex) internal view returns (uint256)

Check IPairsStorageUtils interface for documentation

pairTotalPositionSizeFeeP

function pairTotalPositionSizeFeeP(uint256 _pairIndex) internal view returns (uint256)

Check IPairsStorageUtils interface for documentation

pairTotalLiqCollateralFeeP

function pairTotalLiqCollateralFeeP(uint256 _pairIndex) internal view returns (uint256)

Check IPairsStorageUtils interface for documentation

pairOraclePositionSizeFeeP

function pairOraclePositionSizeFeeP(uint256 _pairIndex) internal view returns (uint256)

Check IPairsStorageUtils interface for documentation

pairMinPositionSizeUsd

function pairMinPositionSizeUsd(uint256 _pairIndex) internal view returns (uint256)

Check IPairsStorageUtils interface for documentation

getGlobalTradeFeeParams

function getGlobalTradeFeeParams() internal view returns (struct IPairsStorage.GlobalTradeFeeParams)

Check IPairsStorageUtils interface for documentation

pairMinFeeUsd

function pairMinFeeUsd(uint256 _pairIndex) internal view returns (uint256)

Check IPairsStorageUtils interface for documentation

pairFeeIndex

function pairFeeIndex(uint256 _pairIndex) internal view returns (uint256)

Check IPairsStorageUtils interface for documentation

groups

function groups(uint256 _index) internal view returns (struct IPairsStorage.Group)

Check IPairsStorageUtils interface for documentation

groupsCount

function groupsCount() internal view returns (uint256)

Check IPairsStorageUtils interface for documentation

fees

function fees(uint256 _index) internal view returns (struct IPairsStorage.FeeGroup)

Check IPairsStorageUtils interface for documentation

feesCount

function feesCount() internal view returns (uint256)

Check IPairsStorageUtils interface for documentation

pairMaxLeverage

function pairMaxLeverage(uint256 _pairIndex) internal view returns (uint256)

Check IPairsStorageUtils interface for documentation

pairCustomMaxLeverage

function pairCustomMaxLeverage(uint256 _pairIndex) internal view returns (uint256)

Check IPairsStorageUtils interface for documentation

getAllPairsRestrictedMaxLeverage

function getAllPairsRestrictedMaxLeverage() internal view returns (uint256[])

Check IPairsStorageUtils interface for documentation

getGroupLiquidationParams

function getGroupLiquidationParams(uint256 _groupIndex) internal view returns (struct IPairsStorage.GroupLiquidationParams)

Check IPairsStorageUtils interface for documentation

getPairLiquidationParams

function getPairLiquidationParams(uint256 _pairIndex) internal view returns (struct IPairsStorage.GroupLiquidationParams)

Check IPairsStorageUtils 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 IPairsStorage.PairsStorage s)

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

groupListed

modifier groupListed(uint256 _groupIndex)

Reverts if group is not listed

Parameters

Name
Type
Description

_groupIndex

uint256

group index to check

feeListed

modifier feeListed(uint256 _feeIndex)

Reverts if fee is not listed

Parameters

Name
Type
Description

_feeIndex

uint256

fee index to check

groupOk

modifier groupOk(struct IPairsStorage.Group _group)

Reverts if group is not valid

Parameters

Name
Type
Description

_group

struct IPairsStorage.Group

group to check

feeOk

modifier feeOk(struct IPairsStorage.FeeGroup _fee)

Reverts if fee is not valid

Parameters

Name
Type
Description

_fee

struct IPairsStorage.FeeGroup

fee to check

_addPair

function _addPair(struct IPairsStorage.Pair _pair) internal

Adds a new trading pair

Parameters

Name
Type
Description

_pair

pair to add

_updatePair

function _updatePair(uint256 _pairIndex, struct IPairsStorage.Pair _pair) internal

Updates an existing trading pair

Parameters

Name
Type
Description

_pairIndex

uint256

index of pair to update

_pair

new pair value

_addGroup

function _addGroup(struct IPairsStorage.Group _group) internal

Adds a new pair group

Parameters

Name
Type
Description

_group

group to add

_updateGroup

function _updateGroup(uint256 _id, struct IPairsStorage.Group _group) internal

Updates an existing pair group

Parameters

Name
Type
Description

_id

uint256

index of group to update

_group

new group value

_addFee

function _addFee(struct IPairsStorage.FeeGroup _fee) internal

Adds a new pair fee group

Parameters

Name
Type
Description

_fee

fee to add

_updateFee

function _updateFee(uint256 _id, struct IPairsStorage.FeeGroup _fee) internal

Updates an existing pair fee group

Parameters

Name
Type
Description

_id

uint256

index of fee to update

_fee

new fee value

PreviousTradingCallbacksUtilsNextTradingCommonUtils

Last updated 8 months ago

Was this helpful?

IPairsStorage.Pair
IPairsStorage.Pair
IPairsStorage.Group
IPairsStorage.Group
IPairsStorage.FeeGroup
IPairsStorage.FeeGroup