IPairsStorageUtils

Interface for GNSPairsStorage facet (inherits types and also contains functions, events, and custom errors)

initializeGroupLiquidationParams

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

Initializes liquidation params for all existing groups

Parameters

NameTypeDescription

_groupLiquidationParams

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

addPairs

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

Adds new trading pairs

Parameters

NameTypeDescription

_pairs

pairs to add

updatePairs

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

Updates trading pairs

Parameters

NameTypeDescription

_pairIndices

uint256[]

indices of pairs

_pairs

new pairs values

addGroups

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

Adds new pair groups

Parameters

NameTypeDescription

_groups

groups to add

updateGroups

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

Updates pair groups

Parameters

NameTypeDescription

_ids

uint256[]

indices of groups

_groups

new groups values

addFees

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

Adds new pair fees groups

Parameters

NameTypeDescription

_fees

fees to add

updateFees

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

Updates pair fees groups

Parameters

NameTypeDescription

_ids

uint256[]

indices of fees

_fees

new fees values

setPairCustomMaxLeverages

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

Updates pair custom max leverages (if unset group default is used)

Parameters

NameTypeDescription

_indices

uint256[]

indices of pairs

_values

uint256[]

new custom max leverages

setGroupLiquidationParams

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

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

Parameters

NameTypeDescription

_groupIndex

uint256

index of group

_params

new liquidation params

pairJob

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

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

Parameters

NameTypeDescription

_pairIndex

uint256

index of pair

Return Values

NameTypeDescription

from

string

pair from (eg. BTC)

to

string

pair to (eg. USD)

isPairListed

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

Returns whether a pair is listed

Parameters

NameTypeDescription

_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

NameTypeDescription

_pairIndex

uint256

index of pair to check

pairs

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

Returns a pair's details

Parameters

NameTypeDescription

_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

NameTypeDescription

_pairIndex

uint256

index of pair

pairMinLeverage

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

Returns a pair's min leverage

Parameters

NameTypeDescription

_pairIndex

uint256

index of pair

pairOpenFeeP

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

Returns a pair's open fee % (1e10 precision)

Parameters

NameTypeDescription

_pairIndex

uint256

index of pair

pairCloseFeeP

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

Returns a pair's close fee % (1e10 precision)

Parameters

NameTypeDescription

_pairIndex

uint256

index of pair

pairOracleFeeP

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

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

Parameters

NameTypeDescription

_pairIndex

uint256

index of pair

pairTriggerOrderFeeP

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

Returns a pair's trigger order fee % (1e10 precision)

Parameters

NameTypeDescription

_pairIndex

uint256

index of pair

pairMinPositionSizeUsd

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

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

Parameters

NameTypeDescription

_pairIndex

uint256

index of pair

pairMinFeeUsd

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

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

Parameters

NameTypeDescription

_pairIndex

uint256

index of pair

groups

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

Returns a group details

Parameters

NameTypeDescription

_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.Fee)

Returns a fee group details

Parameters

NameTypeDescription

_index

uint256

index of fee group

feesCount

function feesCount() external view returns (uint256)

Returns number of listed fee groups

pairsBackend

function pairsBackend(uint256 _index) external view returns (struct IPairsStorage.Pair, struct IPairsStorage.Group, struct IPairsStorage.Fee)

Returns a pair's details, group and fee group

Parameters

NameTypeDescription

_index

uint256

index of pair

pairMaxLeverage

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

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

Parameters

NameTypeDescription

_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)

Parameters

NameTypeDescription

_pairIndex

uint256

index of pair

getAllPairsRestrictedMaxLeverage

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

Returns all listed pairs custom max leverages

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

PairAdded

event PairAdded(uint256 index, string from, string to)

Emitted when a new pair is listed

Parameters

NameTypeDescription

index

uint256

index of pair

from

string

pair from (eg. BTC)

to

string

pair to (eg. USD)

PairUpdated

event PairUpdated(uint256 index)

Emitted when a pair is updated

Parameters

NameTypeDescription

index

uint256

index of pair

PairCustomMaxLeverageUpdated

event PairCustomMaxLeverageUpdated(uint256 index, uint256 maxLeverage)

Emitted when a pair's custom max leverage is updated

Parameters

NameTypeDescription

index

uint256

index of pair

maxLeverage

uint256

new max leverage

GroupAdded

event GroupAdded(uint256 index, string name)

Emitted when a new group is added

Parameters

NameTypeDescription

index

uint256

index of group

name

string

name of group

GroupUpdated

event GroupUpdated(uint256 index)

Emitted when a group is updated

Parameters

NameTypeDescription

index

uint256

index of group

FeeAdded

event FeeAdded(uint256 index, string name)

Emitted when a new fee group is added

Parameters

NameTypeDescription

index

uint256

index of fee group

name

string

name of fee group

FeeUpdated

event FeeUpdated(uint256 index)

Emitted when a fee group is updated

Parameters

NameTypeDescription

index

uint256

index of fee group

GroupLiquidationParamsUpdated

event GroupLiquidationParamsUpdated(uint256 index, struct IPairsStorage.GroupLiquidationParams params)

Emitted when a group liquidation params are updated

Parameters

NameTypeDescription

index

uint256

index of group

params

struct IPairsStorage.GroupLiquidationParams

new group liquidation params

PairNotListed

error PairNotListed()

GroupNotListed

error GroupNotListed()

FeeNotListed

error FeeNotListed()

WrongLeverages

error WrongLeverages()

WrongFees

error WrongFees()

PairAlreadyListed

error PairAlreadyListed()

MaxLiqSpreadPTooHigh

error MaxLiqSpreadPTooHigh()

WrongLiqParamsThresholds

error WrongLiqParamsThresholds()

WrongLiqParamsLeverages

error WrongLiqParamsLeverages()

StartLiqThresholdTooHigh

error StartLiqThresholdTooHigh()

EndLiqThresholdTooLow

error EndLiqThresholdTooLow()

StartLeverageTooLow

error StartLeverageTooLow()

EndLeverageTooHigh

error EndLeverageTooHigh()

Last updated