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
  • basePool
  • Contract

Was this helpful?

  1. Docs for Devs
  2. Contracts

Funding Fee

The fundingFee contract provides logic for calculating and settling funding fees, as well as querying the funding rate and pending (pre-settlement) funding fees.

basePool

Funding rates are calculated using basePool. If for a given market the basePool is not set (ie. set to 0x000...), funding fees will not be applied in this market.

The basePool address can be queried using Config.

Contract

/// #notice Check the settlement event to see amount of funding paid/received. This information may also be available from The Graph.
event FundingFeeSettled(uint256 marketId, address trader, int256 fundingFee);

function getCurrentFundingRate(uint256 marketId) public view returns (int256)

/// @notice Amount of pending fees from the trader's perspective.
/// @return When settled, margin will decrease if fee is positive, increase if fee is negative.
function getPendingFee(
    uint256 marketId,
    address trader
) 

returns (
    int256 pendingFee
)

/// @notice Query latest funding rate. Historical funding rates should be queried from The Graph or similiar provider.
function getCurrentFundingRate(
    uint256 marketId
)

returns (
    int256 fundingRate
)
PreviousConfigNextMaker

Last updated 1 year ago

Was this helpful?