Everything On-Chain: How the Quantum DeX Loan Protocol Powers Decentralized Liquidity

By Quantum DeX Engineering | A Modular Smart Contract System for DeFi Liquidity Loans

Introduction

The Quantum DeX Loan Protocol is a fully decentralized, smart contract powered liquidity system. Projects can bootstrap their token’s liquidity by borrowing WL1X backed capital, providing their own tokens, and instantly launching on Quantum DeX all without centralized approvals, backend servers, or hidden intermediaries.

Every step, from collateral deposit to repayment tracking, is executed entirely on chain. This post explores how the system works under the hood and what makes it uniquely robust, trustless, and capital efficient for project teams.

Modular Architecture Overview

The protocol is composed of six on-chain smart contracts, each modularized by function:

Smart Contract

Responsibility

Collateral Acceptance Address

Handles native/erc20 collateral deposits and generates unique deposit IDs

Collateral User Register

Records user loan configurations and ties them to specific deposit IDs

Mediator Contract

Coordinates token deposits and Quantum DeX liquidity provisioning

GuardianNFT Contract

Custodies LP NFTs, tracks ownership, and collects fees

Repayment Contract

Manages USD denominated installment based loan repayment in WL1X

Loan Repayment

Lightweight contract for simplified repayment tracking

Full Lifecycle: End-to-End On-Chain Execution

Phase 1: Collateral Deposit and Loan Configuration

Step 1.1: Collateral Deposit

CollateralAcceptanceAddress.depositERC20(tokenAddress, amount);
// OR
CollateralAcceptanceAddress.depositNative();

  • Accepts ETH or any ERC20 token.
  • Generates a unique deposit ID (keccak256(user, counter, timestamp)).
  • Emits DepositReceived event and stores deposit data in deposits mapping.

Step 1.2: Loan Registration

CollateralUserRegister.registerCollateralData(
user,
loanAmount,
collateralAmount,
loanTerms,
tokenPoolAddressQdex,
tokenContractAddressQdex,
tokenContractAddressCollateral,
depositId
);

  • Ties deposit to loan configuration.
  • Stores all parameters on-chain.
  • Emits CollateralDataRegistered event.

Phase 2: Token Deposit and Liquidity Provision

Step 2.1: Project Token Deposit

MediatorContract.depositProjectToken(
user,
token,
amount,
depositId,
poolAddress
);

  • Accepts project token deposits.
  • Validates user registration through CollateralUserRegister.
  • Tracks deposits by user and pool for later liquidity creation.

Step 2.2: Uniswap V3 Liquidity Creation

MediatorContract.addLiquidityForUser(
user,
key,
projectToken,
amount0,
amount1,
fee,
tickLower,
tickUpper
);

  • Calls Quantum DeX’s mint() function.
  • Ensures token ordering and pair validity.
  • Mints the LP NFT and sends it directly to GuardianNFTContract.

Phase 3: NFT Custody and Ownership

Step 3.1: Receive LP NFT

GuardianNFTContract.onERC721Received(operator, from, tokenId, data);

  • Receives NFT directly from Uniswap.
  • Validates contract and operator sender.
  • Emits PositionReceived event.

Step 3.2: Assign Ownership

GuardianNFTContract.setPositionOwner(tokenId, user);

  • Records logical owner without transferring the NFT. The ownership remains with the Guardian contract.

Phase 4: Installment-Based Loan Repayment

Step 4.1: Create Repayment Schedule

RepaymentContract.createRepaymentScheduleForProject(
borrower,
totalAmount,
interval,
monthlySchedule,
registerContractId
);

  • Defines total amount in USD (8-decimal precision).
  • Stores schedule for each installment month.
  • Generates unique loanId using keccak256.

Step 4.2: Make Installment Payments

RepaymentContract.payInstallment(loanId, monthIndex, amount);

  • Verifies borrower identity.
  • Converts USD amount to WL1X using on-chain price feed.
  • Applies partial payments automatically.
  • Overpayments forwarded to next month.
  • Payment completion is logged and updated on-chain.

Design Principles: Trustless, Modular, and Accountable

No Central Control

  • No backend logic, approval layers, or manual interventions.

No Custodial Ownership

  • LP NFTs are held by GuardianNFTContract, never exposed to user wallets.
  • Projects cannot remove liquidity or run away with LPs until the loan is repaid back providing security and safe trading opportunities to the users.

Real-Time State Tracking

  • Every deposit, repayment, and pool creation is timestamped and logged.
  • Project status is traceable by querying smart contract state (e.g., isDepositIdRegistered, hasPaidInstallment).

Transparent Conversion and Risk Mitigation

  • WL1X price is updated manually by the protocol.
  • Protocol prevents minting LP tokens if collateral or token conditions are not met.
  • Risk logic can be expanded to include AI scoring or penalty triggers.

Integration Points

  • ERC20/ERC721 standards: For collateral, LP tokens, and token deposits.
  • Manual Price Oracle: WL1X/USD price feed updated by governance wallet.

Why It Matters

  • Projects can launch instantly with protocol-supplied WL1X liquidity.
  • No need for upfront capital or centralized liquidity support.
  • Repayment schedules are fixed, predictable, and on-chain.
  • NFT-based liquidity ensures pools are safe, trackable, and tamper-proof.

This protocol enables permissionless liquidity loans that are composable, verifiable, and resistant to rug-pulls.

Conclusion

Quantum DeX’s Loan Protocol is a blueprint for how liquidity and credit can be offered in DeFi without any centralized actors. Every component, from the deposit process to the repayment lifecycle, operates through deterministic smart contracts deployed on-chain.

If you’re a builder looking to launch your token with zero-interest, collateralized liquidity, explore our loan system:

https://l1xapp.com/quantumDex

You've successfully subscribed to Layer One X | Newsroom
Great! Next, complete checkout to get full access to all premium content.
Error! Could not sign up. invalid link.
Welcome back! You've successfully signed in.
Error! Could not sign in. Please try again.
Success! Your account is fully activated, you now have access to all content.
Error! Stripe checkout failed.
Success! Your billing info is updated.
Error! Billing info update failed.