# • Logic Flow

Perpetual Contract Pricing (Decentralized Exchange):&#x20;

contract\_price = Oracle.fetchPrice(underlying\_asset\_price, funding\_rate, index\_price, funding\_rate\_interval)&#x20;

contract\_price represents the current price of the perpetual contract.&#x20;

Oracle is the decentralized oracle service used to fetch price data.&#x20;

underlying\_asset\_price is the current price of the underlying asset.&#x20;

funding\_rate is the rate used to calculate funding payments in the perpetual contract. index\_price is the reference price used to settle the perpetual contract.&#x20;

funding\_rate\_interval is the time interval for funding rate calculations.&#x20;

In decentralized exchange perpetual contracts, an Oracle service is utilized to fetch price data for the underlying asset. The contract\_price is calculated based on the underlying\_asset\_price, funding\_rate, index\_price, and funding\_rate\_interval. The funding rate is used to determine funding payments between long and short positions in the perpetual contract. The index\_price serves as a reference for settling the contract at expiry or in case of liquidation.
