LogoLogo
Nekodex AppDiscord
Nekodex (Playground)
Nekodex (Playground)
  • Nekodex $(=ↀωↀ=)
    • Terms of Service
  • Introducing Perp v3
  • All About Perp
    • Project overview
      • Product info
      • About us
      • Governance
    • Roadmap
    • Official links
    • FAQs
    • PERP Token
    • Contact us
    • More
      • Security & Audits
      • Partnerships
      • Careers
      • Marketing
      • Legacy Docs
  • Docs for Users
    • Earn yield
    • Trade perpetual futures
      • Fees & system limits
      • Perp Smart Account
      • Perp contract specs
    • Provide liquidity (LP)
    • How Perp v3 works
      • Pyth Oracles
    • Security
  • Docs for Devs
    • Technical Overview
    • Contracts
      • Address Manager
      • Borrowing Fee
      • Circuit Breaker
      • ⭐Clearinghouse
      • Config
      • Funding Fee
      • ⭐Maker
        • Oracle Maker
        • Spot Hedge Maker
      • Maker Reporter
      • ⭐Order Gateway
      • Quoter
      • ⭐Vault
    • Dev FAQ
    • API
      • Subgraph
    • Error codes
Powered by GitBook
On this page
  • Contract
  • fundingConfig

Was this helpful?

  1. Docs for Devs
  2. Contracts

Config

The config contract sets key exchange parameters.

Contract

/// @notice For maker types that requires mitigation of oracle front-running, order must comes from a gateway that will execute the order in a 2-step process with a delay that's longer than `orderDelaySeconds`
function getOrderDelaySeconds() external view returns (uint256) {
    return _getConfigStorage().orderDelaySeconds;
}

/// @notice Query max order validity duration
function getMaxOrderValidDuration() external view returns (uint256) {
    return _getConfigStorage().maxOrderValidDuration;
}

/// @notice Query max relayer fee. Denominated in collateral token.
function getMaxRelayFee() external view returns (uint256) {
    return _getConfigStorage().maxRelayFee;
}

/// @notice Query the margin ratio needed to open a position.
function getInitialMarginRatio(uint256 marketId) external view returns (uint256) {
    uint256 mRatio = _getConfigStorage().initialMarginRatioMap[marketId];
    if (mRatio == 0) {
        return 1 ether; // 100%
    }
    return mRatio;
}

/// @notice Query the margin ratio required to prevent liquidation.
function getMaintenanceMarginRatio(uint256 marketId) external view returns (uint256) {
    uint256 mRatio = _getConfigStorage().maintenanceMarginRatioMap[marketId];
    if (mRatio == 0) {
        return 1 ether; // 100%
    }
    return mRatio;
}

/// @notice Query what percentage of the liquidation penalty the liquidator can receive.
function getLiquidationFeeRatio(uint256 marketId) external view returns (uint256) {
    uint256 feeRatio = _getConfigStorage().liquidationFeeRatioMap[marketId];
    return feeRatio;
}

/// @notice Query what proportion of the liquidated position may charged as penalty.
function getLiquidationPenaltyRatio(uint256 marketId) external view returns (uint256) {
    uint256 penaltyRatio = _getConfigStorage().liquidationPenaltyRatioMap[marketId];
    return penaltyRatio;
}

/// @notice Query the borrowing fee rate when utilization ratio is 100% (for all borrowing fee receivers).
function getMaxBorrowingFeeRate(uint256 marketId) external view returns (uint256, uint256) {
    return IBorrowingFee(getAddressManager().getBorrowingFee()).getMaxBorrowingFeeRate(marketId);
}

/// @notice Query Pyth's price feed id for the given market.
function getPriceFeedId(uint256 marketId) external view returns (bytes32) {
    return _getConfigStorage().marketMap[marketId];
}

/// @notice Query whether a maker can use the vault callback function and receive borrowing fees.
function isWhitelistedMaker(uint256 marketId, address trader) external view returns (bool) {
    return _getConfigStorage().whitelistedMakerMap[marketId][trader];
}

/// @notice Query the global maximum amount of deposits allowed.
function getDepositCap() external view returns (uint256) {
    return _getConfigStorage().depositCap;
}

/// #notice Query the price band ratio.
function getPriceBandRatio(uint256 marketId) external view returns (uint256) {
    return _getConfigStorage().priceBandRatioMap[marketId];
}

fundingConfig

Query market funding config for funding factor and basePool address.

struct FundingConfig {
    uint256 fundingFactor;
    uint256 fundingExponentFactor;
    address basePool;
}

function getFundingConfig(
    uint256 marketId
)
returns (
    FundingConfig memory
)
PreviousClearinghouseNextFunding Fee

Last updated 1 year ago

Was this helpful?