Skip to main content
TLDR:
  • Demonstrates fetching real-time token prices from Merchant Moe’s Liquidity Book pools on Mantle Mainnet.
  • Shows how to work with Liquidity Book pool contracts and their unique bin-based pricing mechanism.
  • Includes practical examples of price calculation using bin IDs and continuous price monitoring.

Overview

Mantle is an OP Stack Layer 2 chain. Merchant Moe is a leading DEX on Mantle that uses a unique Liquidity Book model instead of traditional constant product AMMs. Liquidity Book pools use discrete price bins to provide liquidity. Check Merchant Moe docs for more information. This tutorial guides you through creating a real-time token price monitor that fetches prices from Merchant Moe’s unique Liquidity Book pools. You’ll learn how to connect to the Mantle network, interact with Liquidity Book contracts, understand the bin-based pricing mechanism, and create a continuous price monitoring system.

Prerequisites

Token price fetching from Liquidity Book pools

Now let’s create a token price monitoring script that fetches real-time prices from Merchant Moe. The script connects to the Mantle network over a Chainstack node RPC endpoint, then queries a specific Liquidity Book pool to get the current active bin ID and calculate token prices. The example focuses on the cmETH/USDe trading pair, demonstrating how to work with Liquidity Book’s unique bin-based pricing mechanism. Here are the links & addresses: This tutorial script covers:
  • How to use web3.py with Mantle
  • How to interact with Liquidity Book pool contracts
  • How to calculate prices from bin IDs and bin steps
  • How to continuously monitor token prices
  • How to handle token decimals and reserve calculations
Here’s the full script and the comments:

Conclusion

This tutorial provided a comprehensive guide to fetching real-time token prices from Merchant Moe’s Liquidity Book pools on Mantle using Python. The price fetching approach demonstrated here can be easily extended to monitor other trading pairs, implement price alerts, or integrate into larger DeFi applications requiring accurate price data.

See also

Mantle documentation

Merchant Moe documentation

web3.py documentation

About the author

Ake

Ake Director of Developer Experience @ Chainstack
Talk to me all things Web3
20 years in technology | 8+ years in Web3 full time years experience
Last modified on April 13, 2026