<aside> 💡 This Page is Public

</aside>

Introductions

Specs

Workflows

Fill Order

sequenceDiagram
    participant ClearingHouse
    participant PythOracleMaker
    participant PythOracle
		# pythUpdateData: <https://github.com/pyth-network/pyth-crosschain/blob/1dbc592836b8eb4ecc5c29ca5b829c80e4eb0b8b/target_chains/ethereum/examples/oracle_swap/contract/src/OracleSwap.sol#L51>
    ClearingHouse -> PythOracleMaker: fillOrder(1 ETH, pythUpdateData)
		PythOracleMaker -> PythOracle: updatePriceFeeds(pythUpdateData)
		PythOracleMaker -> PythOracle: getPrice()
		PythOracle --> PythOracleMaker: publishTime, price=1000
    Note left of PythOracleMaker: if price valid
		PythOracleMaker --> ClearingHouse: oppositeAmount=1000 USDC
    Note left of PythOracleMaker: if price invalid
		PythOracleMaker --> ClearingHouse: revert

Deposit

Withdraw

LP gets Maker account value pro rata

Events

Order Filled

/// @notice Emitted when an order is being filled by a Pyth Oracle Maker. 
///         It reveals all information associated to the trade price.
event PythOracleOrderFilled(
    uint256 orcalePrice,    // In quote asset as wei
                            // Assume price >= 0
    uint256 tradePrice,     // In quote asset as wei
                            // Assume price >= 0
    uint256 size,           // In base asset as wei
    uint256 fee,            // In quote asset as wei
    uint256 spread          // In percentage (1e6 = 100%)
);

Pricing

Quote Token