Monadswap Docs
  • Introduction 🚀
    • Welcome to Monadswap
    • Overview of Features
  • Getting Started 💳
    • First Time Users
    • Wallet Setup
    • Important Links
    • Video Guides
  • Trading and Liquidity 💸
    • How to Trade
    • Providing Liquidity
    • Staking
  • AI Features 🤖 (COMING SOON)
  • Governance 📊 (COMING SOON)
  • Security 🔒
    • Smart Contract Audits
    • Best Practices for Users
    • AI-Enhanced Security
    • User Education and Resources
  • Developer Guide ⚙️
    • API Access
    • Smart Contract Interaction
    • Building on Top of Monadswap
  • FAQ and Troubleshooting ❓
    • Frequently Asked Questions
    • Troubleshooting
  • Roadmap ➗ (COMING SOON)
  • Contact & Support 📞
    • Getting Help
    • Community Channels
    • Feedback and Suggestions
  • Legal and Compliance 📃
    • Privacy Policy
    • Terms of Service
Powered by GitBook
On this page
  1. Developer Guide ⚙️

Smart Contract Interaction

Monadswap’s smart contracts are deployed on the Monad blockchain, and they form the backbone of the platform’s operations. Developers can interact directly with these contracts to build custom decentralized applications (dApps) or integrate Monadswap’s features into existing dApps.

Key Smart Contracts:

  1. Swap Contract: Handles token swaps and manages the liquidity pools.

  2. Liquidity Pool Contract: Manages the contributions of liquidity providers and the distribution of fees.

  3. Staking Contract: Manages the staking of tokens and the distribution of rewards.

How to Interact with Smart Contracts:

  1. Contract Addresses:

    • The contract addresses for Monadswap’s core smart contracts are published on the official website and in the developer documentation. Use these addresses to interact with the contracts via your application or directly through web3 interfaces like MetaMask or Remix.

  2. Interfacing with Contracts:

    • Developers can use popular Ethereum-compatible libraries like Web3.js or Ethers.js to interface with Monadswap’s smart contracts. These libraries allow you to call contract methods, send transactions, and listen for events.

  3. ABI Files:

    • Application Binary Interface (ABI) files for Monadswap contracts are provided in the documentation. These files define the structure of the contract and are necessary for interacting with the contracts programmatically.

Example Interaction:

  • Adding Liquidity:

    const liquidityContract = new web3.eth.Contract(abi, contractAddress);
    const addLiquidity = async () => {
        await liquidityContract.methods.addLiquidity(tokenA, tokenB, amountA, amountB).send({ from: userAddress });
    };
PreviousAPI AccessNextBuilding on Top of Monadswap

Last updated 9 months ago