GNSPairsStorage

Facet #1: Pairs storage

Methods

addFees

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

Parameters

NameTypeDescription

_fees

addGroups

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

Parameters

NameTypeDescription

_groups

addPairs

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

Parameters

NameTypeDescription

_pairs

fees

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

Returns a fee group details

Parameters

NameTypeDescription

_index

uint256

index of fee group

Returns

NameTypeDescription

_0

feesCount

function feesCount() external view returns (uint256)

Returns number of listed fee groups

Returns

NameTypeDescription

_0

uint256

getAllPairsRestrictedMaxLeverage

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

Returns all listed pairs custom max leverages

Returns

NameTypeDescription

_0

uint256[]

groups

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

Returns a group details

Parameters

NameTypeDescription

_index

uint256

index of group

Returns

NameTypeDescription

_0

groupsCount

function groupsCount() external view returns (uint256)

Returns number of listed groups

Returns

NameTypeDescription

_0

uint256

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

Returns

NameTypeDescription

_0

bool

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)

Returns

NameTypeDescription

_0

bool

pairCloseFeeP

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

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

Parameters

NameTypeDescription

_pairIndex

uint256

index of pair

Returns

NameTypeDescription

_0

uint256

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

Returns

NameTypeDescription

_0

uint256

pairJob

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

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

Parameters

NameTypeDescription

_pairIndex

uint256

index of pair

Returns

NameTypeDescription

_0

string

pair from (eg. BTC)

_1

string

pair to (eg. USD)

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

Returns

NameTypeDescription

_0

uint256

pairMinLeverage

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

Returns a pair's min leverage

Parameters

NameTypeDescription

_pairIndex

uint256

index of pair

Returns

NameTypeDescription

_0

uint256

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

Returns

NameTypeDescription

_0

uint256

pairOpenFeeP

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

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

Parameters

NameTypeDescription

_pairIndex

uint256

index of pair

Returns

NameTypeDescription

_0

uint256

pairOracleFeeP

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

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

Parameters

NameTypeDescription

_pairIndex

uint256

index of pair

Returns

NameTypeDescription

_0

uint256

pairSpreadP

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

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

Parameters

NameTypeDescription

_pairIndex

uint256

index of pair

Returns

NameTypeDescription

_0

uint256

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

Returns

NameTypeDescription

_0

uint256

pairs

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

Returns a pair's details

Parameters

NameTypeDescription

_index

uint256

index of pair

Returns

NameTypeDescription

_0

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

Returns

pairsCount

function pairsCount() external view returns (uint256)

Returns number of listed pairs

Returns

NameTypeDescription

_0

uint256

setPairCustomMaxLeverages

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

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

Parameters

NameTypeDescription

_indices

uint256[]

indices of pairs

_values

uint256[]

new custom max leverages

updateFees

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

Parameters

NameTypeDescription

_ids

uint256[]

_fees

updateGroups

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

Parameters

NameTypeDescription

_ids

uint256[]

_groups

updatePairs

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

Parameters

NameTypeDescription

_pairIndices

uint256[]

_pairs

Events

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

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

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)

PairCustomMaxLeverageUpdated

event PairCustomMaxLeverageUpdated(uint256 indexed index, uint256 maxLeverage)

Emitted when a pair's custom max leverage is updated

Parameters

NameTypeDescription

index indexed

uint256

index of pair

maxLeverage

uint256

new max leverage

PairUpdated

event PairUpdated(uint256 index)

Emitted when a pair is updated

Parameters

NameTypeDescription

index

uint256

index of pair

Errors

AboveMax

error AboveMax()

AlreadyExists

error AlreadyExists()

BelowMin

error BelowMin()

BlockOrder

error BlockOrder()

DoesntExist

error DoesntExist()

FeeNotListed

error FeeNotListed()

GroupNotListed

error GroupNotListed()

InitError

error InitError()

InvalidAddresses

error InvalidAddresses()

InvalidCollateralIndex

error InvalidCollateralIndex()

InvalidInputLength

error InvalidInputLength()

NotAllowed

error NotAllowed()

NotAuthorized

error NotAuthorized()

Overflow

error Overflow()

PairAlreadyListed

error PairAlreadyListed()

PairNotListed

error PairNotListed()

Paused

error Paused()

WrongAccess

error WrongAccess()

WrongFees

error WrongFees()

WrongIndex

error WrongIndex()

WrongLength

error WrongLength()

WrongLeverages

error WrongLeverages()

WrongOrder

error WrongOrder()

WrongParams

error WrongParams()

WrongTradeType

error WrongTradeType()

ZeroAddress

error ZeroAddress()

ZeroValue

error ZeroValue()

Last updated