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
  • constructor
  • initializeGroupLiquidationParams
  • Parameters
  • initializeNewFees
  • Parameters
  • addPairs
  • Parameters
  • updatePairs
  • Parameters
  • addGroups
  • Parameters
  • updateGroups
  • Parameters
  • addFees
  • Parameters
  • updateFees
  • Parameters
  • setGroupLiquidationParams
  • Parameters
  • setGlobalTradeFeeParams
  • Parameters
  • setPairCustomMaxLeverages
  • Parameters
  • pairJob
  • Parameters
  • Return Values
  • isPairListed
  • Parameters
  • isPairIndexListed
  • Parameters
  • pairs
  • Parameters
  • pairsCount
  • pairSpreadP
  • Parameters
  • pairMinLeverage
  • Parameters
  • pairTotalPositionSizeFeeP
  • Parameters
  • pairTotalLiqCollateralFeeP
  • Parameters
  • pairOraclePositionSizeFeeP
  • Parameters
  • pairMinPositionSizeUsd
  • Parameters
  • getGlobalTradeFeeParams
  • pairMinFeeUsd
  • Parameters
  • groups
  • Parameters
  • groupsCount
  • fees
  • Parameters
  • feesCount
  • pairMaxLeverage
  • Parameters
  • pairCustomMaxLeverage
  • Parameters
  • getAllPairsRestrictedMaxLeverage
  • getGroupLiquidationParams
  • getPairLiquidationParams

Was this helpful?

  1. Developer
  2. Technical Reference
  3. Contracts
  4. Core
  5. Facets

GNSPairsStorage

Facet #1: Pairs storage

constructor

constructor() public

initializeGroupLiquidationParams

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

Initializes liquidation params for all existing groups

Parameters

Name
Type
Description

_groupLiquidationParams

liquidation params for each group (index corresponds to group index)

initializeNewFees

function initializeNewFees(struct IPairsStorage.GlobalTradeFeeParams _tradeFeeParams) external

Copies all existing fee groups to new mapping, multiplies existing groups min/max lev by 1e3, initializes new global trade fee params

Parameters

Name
Type
Description

_tradeFeeParams

global trade fee params

addPairs

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

Adds new trading pairs

Parameters

Name
Type
Description

_pairs

pairs to add

updatePairs

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

Updates trading pairs

Parameters

Name
Type
Description

_pairIndices

uint256[]

indices of pairs

_pairs

new pairs values

addGroups

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

Adds new pair groups

Parameters

Name
Type
Description

_groups

groups to add

updateGroups

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

Updates pair groups

Parameters

Name
Type
Description

_ids

uint256[]

indices of groups

_groups

new groups values

addFees

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

Adds new pair fees groups

Parameters

Name
Type
Description

_fees

fees to add

updateFees

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

Updates pair fees groups

Parameters

Name
Type
Description

_ids

uint256[]

indices of fees

_fees

new fees values

setGroupLiquidationParams

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

Updates group liquidation params (will only apply for trades opened after the change)

Parameters

Name
Type
Description

_groupIndex

uint256

index of group

_params

new liquidation params

setGlobalTradeFeeParams

function setGlobalTradeFeeParams(struct IPairsStorage.GlobalTradeFeeParams _feeParams) external

Updates global trade fee params

Parameters

Name
Type
Description

_feeParams

new fee params

setPairCustomMaxLeverages

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

Updates pair custom max leverages (if unset group default is used); useful to delist a pair if new value is below the pair's group minLeverage

Parameters

Name
Type
Description

_indices

uint256[]

indices of pairs

_values

uint256[]

new custom max leverages (1e3 precision)

pairJob

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

Returns data needed by price aggregator when doing a new price request

Parameters

Name
Type
Description

_pairIndex

uint256

index of pair

Return Values

Name
Type
Description

[0]

string

[1]

string

isPairListed

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

Returns whether a pair is listed

Parameters

Name
Type
Description

_from

string

pair from (eg. BTC)

_to

string

pair to (eg. USD)

isPairIndexListed

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

Returns whether a pair index is listed

Parameters

Name
Type
Description

_pairIndex

uint256

index of pair to check

pairs

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

Returns a pair's details

Parameters

Name
Type
Description

_index

uint256

index of pair

pairsCount

function pairsCount() external view returns (uint256)

Returns number of listed pairs

pairSpreadP

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

Returns a pair's spread % (1e10 precision)

Parameters

Name
Type
Description

_pairIndex

uint256

index of pair

pairMinLeverage

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

Returns a pair's min leverage (1e3 precision)

Parameters

Name
Type
Description

_pairIndex

uint256

index of pair

pairTotalPositionSizeFeeP

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

Returns a pair's total position size fee % (1e10 precision)

Parameters

Name
Type
Description

_pairIndex

uint256

index of pair

pairTotalLiqCollateralFeeP

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

Returns a pair's total liquidation collateral fee % (1e10 precision)

Parameters

Name
Type
Description

_pairIndex

uint256

index of pair

pairOraclePositionSizeFeeP

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

Returns a pair's oracle position size fee % (1e10 precision)

Parameters

Name
Type
Description

_pairIndex

uint256

index of pair

pairMinPositionSizeUsd

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

Returns a pair's min position size in USD (1e18 precision)

Parameters

Name
Type
Description

_pairIndex

uint256

index of pair

getGlobalTradeFeeParams

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

Returns global trade fee params

pairMinFeeUsd

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

Returns a pair's minimum trading fee in USD (1e18 precision)

Parameters

Name
Type
Description

_pairIndex

uint256

index of pair

groups

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

Returns a group details

Parameters

Name
Type
Description

_index

uint256

index of group

groupsCount

function groupsCount() external view returns (uint256)

Returns number of listed groups

fees

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

Returns a fee group details

Parameters

Name
Type
Description

_index

uint256

index of fee group

feesCount

function feesCount() external view returns (uint256)

Returns number of listed fee groups

pairMaxLeverage

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

Returns a pair's active max leverage; custom if set, otherwise group default (1e3 precision)

Parameters

Name
Type
Description

_pairIndex

uint256

index of pair

pairCustomMaxLeverage

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

Returns a pair's custom max leverage; 0 if not set (1e3 precision)

Parameters

Name
Type
Description

_pairIndex

uint256

index of pair

getAllPairsRestrictedMaxLeverage

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

Returns all listed pairs custom max leverages (1e3 precision)

getGroupLiquidationParams

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

Returns a group's liquidation params

getPairLiquidationParams

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

Returns a pair's group liquidation params

PreviousGNSFeeTiersNextGNSPriceImpact

Last updated 7 months ago

Was this helpful?

IPairsStorage.GroupLiquidationParams[]
IPairsStorage.GlobalTradeFeeParams
IPairsStorage.Pair[]
IPairsStorage.Pair[]
IPairsStorage.Group[]
IPairsStorage.Group[]
IPairsStorage.FeeGroup[]
IPairsStorage.FeeGroup[]
IPairsStorage.GroupLiquidationParams
IPairsStorage.GlobalTradeFeeParams