<aside> 💡 This Page is Public
</aside>
oppositeAmount
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
Only can deposit the collateral supported by Vault.
Call Vault.Deposit and update share
sequenceDiagram
participant LP
participant PythOracleMaker
participant Vault
PythOracleMaker -> LP: safeTransferFrom(LP, PythOracleMaker)
PythOracleMaker -> Vault: deposit()
PythOracleMaker --> LP: mint()
LP gets Maker account value pro rata
accountValue = margin + positionSize * price + openNotional
price = abs(fillOrder(positionSize) / positionSize)
withdraw(share)
sharePrice = accountValue / totalSupply()
share * sharePrice
)/// @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%)
);