Markets Contract Interface
Markets.sol
stores trading pair parameters and limits.
isPairIndexListed
function isPairIndexListed(
uint256 _pairIndex
) public view returns (bool)
Checks if a given pair index is listed.
Parameters
Name | Type | Description |
---|---|---|
_pairIndex | uint256 | The index of the pair to check. |
Returns
Type | Description |
---|---|
bool | True if the pair index is listed, false otherwise. |
pairFeed
function pairFeed(
uint256 _pairIndex
) external view returns (Feed memory)
Retrieves the price feed information for a given pair index.
Parameters
Name | Type | Description |
---|---|---|
_pairIndex | uint256 | The index of the pair to retrieve the feed for. |
Returns
Type | Description |
---|---|
Feed memory | The price feed information for the given pair. |
pairMinLeverage
function pairMinLeverage(
uint256 _pairIndex
) external view returns (uint256)
Retrieves the minimum leverage for a given pair index.
Parameters
Name | Type | Description |
---|---|---|
_pairIndex | uint256 | The index of the pair to retrieve the minimum leverage for. |
Returns
Type | Description |
---|---|
uint256 | The minimum leverage for the given pair. |
pairMaxLeverage
function pairMaxLeverage(
uint256 _pairIndex
) external view returns (uint256)
Retrieves the maximum leverage for a given pair index.
Parameters
Name | Type | Description |
---|---|---|
_pairIndex | uint256 | The index of the pair to retrieve the maximum leverage for. |
Returns
Type | Description |
---|---|
uint256 | The maximum leverage for the given pair. |
groupMaxCollateral
function groupMaxCollateral(
uint256 _pairIndex
) external view returns (uint256)
Retrieves the maximum collateral for a given pair index.
Parameters
Name | Type | Description |
---|---|---|
_pairIndex | uint256 | The index of the pair to retrieve the maximum collateral for. |
Returns
Type | Description |
---|---|
uint256 | The maximum collateral for the given pair. |
groupCollateral
function groupCollateral(
uint256 _pairIndex,
bool _long
) external view returns (uint256)
Retrieves the group collateral for a given pair index and long/short direction.
Parameters
Name | Type | Description |
---|---|---|
_pairIndex | uint256 | The index of the pair to retrieve the group collateral for. |
_long | bool | True for long direction, false for short direction. |
Returns
Type | Description |
---|---|
uint256 | The group collateral for the given pair and direction. |
guaranteedSlEnabled
function guaranteedSlEnabled(
uint256 _pairIndex
) external view returns (bool)
Checks if guaranteed stop loss is enabled for a given pair index.
Parameters
Name | Type | Description |
---|---|---|
_pairIndex | uint256 | The index of the pair to check if guaranteed stop loss is enabled for. |
Returns
Type | Description |
---|---|
bool | True if guaranteed stop loss is enabled for the pair, false otherwise. |
pairOpenFeeP
function pairOpenFeeP(
uint256 _pairIndex
) external view returns (uint256)
Retrieves the open fee percentage for a given pair index.
Parameters
Name | Type | Description |
---|---|---|
_pairIndex | uint256 | The index of the pair to retrieve the open fee percentage for. |
Returns
Type | Description |
---|---|
uint256 | The open fee percentage for the given pair. |
pairCloseFeeP
function pairCloseFeeP(
uint256 _pairIndex
) external view returns (uint256)
Retrieves the close fee percentage for a given pair index.
Parameters
Name | Type | Description |
---|---|---|
_pairIndex | uint256 | The index of the pair to retrieve the close fee percentage for. |
Returns
Type | Description |
---|---|
uint256 | The close fee percentage for the given pair. |
pairLimitOrderFeeP
function pairLimitOrderFeeP(
uint256 _pairIndex
) external view returns (uint256)
Retrieves the limit order fee percentage for a given pair index.
Parameters
Name | Type | Description |
---|---|---|
_pairIndex | uint256 | The index of the pair to retrieve the limit order fee percentage for. |
Returns
Type | Description |
---|---|
uint256 | The limit order fee percentage for the given pair. |
pairMinLevPosHoney
function pairMinLevPosHoney(
uint256 _pairIndex
) external view returns (uint256)
Retrieves the minimum leveraged position size in HONEY for a given pair index.
Parameters
Name | Type | Description |
---|---|---|
_pairIndex | uint256 | The index of the pair to retrieve the minimum leveraged position size for. |
Returns
Type | Description |
---|---|
uint256 | The minimum leveraged position size in HONEY for the given pair. |
getPair
function getPair(uint256 _pairIndex) external view returns (
Pair memory,
Group memory,
Fee memory
)
Retrieves the pair, group, and fee information for a given pair index.
Parameters
Name | Type | Description |
---|---|---|
_pairIndex | uint256 | The index of the pair to retrieve the information for. |
Returns
Name | Type | Description |
---|---|---|
- | Pair memory | The pair information. |
- | Group memory | The group information associated with the pair. |
- | Fee memory | The fee information associated with the pair. |
getAllPairs
function getAllPairs() external view returns (
Pair[] memory,
Group[] memory,
Fee[] memory
)
Retrieves all pairs, groups, and fees information.
Structs
struct Feed {
// Pyth Price Feed ID for the base currency
bytes32 baseID;
// Pyth Price Feed ID for the quote currency
bytes32 quoteID;
// Whether the price requires a singular or triangular calculation
FeedCalculation feedCalculation;
// If true, will use the confidence range of a price result. This implies the settlement of orders and
// positions will occur at the boundaries of the price range rather than the usually used mean.
// More info: https://docs.pyth.network/price-feeds/best-practices#confidence-intervals
bool useConfSpread;
}
struct Pair {
string from; // name of the base currency
string to; // name of the quote currency
Feed feed;
uint256 groupIndex;
uint256 feeIndex;
}
struct Group {
string name;
uint256 minLeverage;
uint256 maxLeverage;
uint256 maxCollateralP; // % (of HONEY vault current balance)
}
struct Fee {
string name;
uint256 openFeeP; // PRECISION (% of leveraged pos)
uint256 closeFeeP; // PRECISION (% of leveraged pos)
uint256 limitOrderFeeP; // PRECISION (% of leveraged pos)
uint256 minLevPosHoney; // 1e18 (collateral x leverage, useful for min fee)
}