On-chain price feeds

Intro

In order to simulate the order book from centralized exchanges without sacrificing capital efficiency, Magic-Fi created a custom on-chain price fee which works along side with the oPMM algorithm. This price feed considers multiple parameters including mid-price p, spread s, and liquidity coefficient k.

The price feeds use Chainlink price feeds as a fail safe. Users can call price to get priceNow and feasible of token. If feasible is false, do not use priceNow value. All prices are USDT/USDC-based, and the decimal of priceNow is 8 (the same in decimals as price in Chainlink Oracle)

Magoracle v2.2.1

  • Arbitrum address: 0xCf4EA1688bc23DD93D933edA535F8B72FC8934Ec

  • Optimism address: 0xA43305Ce0164D87d7B2368f91a1dcC4eBdA75127

  • Polygon PoS address: 0x2A8Ede62D0717C8C92b88639ecf603FDF31A8428

  • Base address: 0x2A375567f5E13F6bd74fDa7627Df3b1Af6BfA5a6

  • Avalanche c-chain address: 0x2A375567f5E13F6bd74fDa7627Df3b1Af6BfA5a6

  • BSC address: 0x2A375567f5E13F6bd74fDa7627Df3b1Af6BfA5a6

  • Linea address: 0x2A375567f5E13F6bd74fDa7627Df3b1Af6BfA5a6

  • zkSync Era address: 0xAe45cBE2d1E90358CbD216bC16f2C9267a4EA80a

  • Mantle address: 0xAe45cBE2d1E90358CbD216bC16f2C9267a4EA80a

Note: While the price feed is on-chain and permissionless, and tradeable by any user on Magic-Fi, we DO NOT guarantee the availability or accuracy of it. The price feed may become unavailable when the centralized liquidity source is in maintenance or any time the operator deems necessary. In no case, Magic-Fi is liable for any loss that might be caused by using the price feed by any third party.

Code Example

MagicoracleV2 Interface

Copy

ABI

Abi json could be exported in chain explorer.

Python Example (python 3.8)

  • Query price

Copy

  • Response

Copy

Last updated