Fodl Protocol

Decentralised Leverage Without Liquidation

Overview

Fodl is a fully on-chain protocol that enables users to create non-custodial leveraged positions using DeFi lending markets (like Aave and Compound) without traditional margin calls or oracles. The protocol automates yield-maximised folding strategies and routes capital via flash loans and swap primitives.

Our Role

We were responsible for designing, architecting, and implementing the entire Fodl Protocol. This included the smart contract architecture, front-end dApp, cross-chain infrastructure, token mechanics, automation bots, audit process, landing page, and production deployment. From V1 through to V2, we led the full-stack delivery of Fodl across multiple chains and development phases.

V1 - Ethereum & dYdX SoloMargin-Based Folding Engine

The initial version of Fodl used dYdX’s SoloMargin protocol to facilitate flash loans, which were used to open leveraged long or short positions on lending markets like Aave and Compound. This allowed users to access margin by folding their collateral and borrow positions repeatedly, capturing lending yields (e.g., COMP incentives) while amplifying returns without relying on price oracles. Every position generated protocol fees that were redirected to the Fodl Treasury, where they were used to buy back and burn FODL tokens, introducing a deflationary tokenomic mechanism.

At the center of each user’s interaction was a dedicated FoldingAccount.sol smart contract. These per-user contracts acted as programmable, non-custodial proxies for executing leverage strategies. Rather than hard-coding logic into the account, Fodl routed function calls via dynamic dispatch using the msg.sig of each transaction. This enabled the account to delegate execution to external modules and DeFi connectors, making it extensible and upgradable without requiring contract changes per user.

Each FoldingAccount maintained state for a user’s position, tracking borrow/supply balances, managing folding loops, and enabling safeguards like reentrancy protection and slippage limits. Importantly, every account was owned solely by the user, ensuring full custody and trust minimisation. In V2, the ownership and identity of positions were further abstracted through an ERC-721 NFT, allowing for enhanced composability and external integration (e.g., OpenSea views, DAO voting rights).

V2 – UX Overhaul & Cross-Chain Expansion

Fodl V2 marked a significant evolution of the protocol. The reliance on dYdX was removed and replaced with Uniswap flash swaps, offering a more flexible and permissionless way to acquire temporary liquidity. We expanded the protocol to support both Polygon and Binance Smart Chain, deploying core contracts and interfaces across networks while preserving functional parity. The backend architecture was modularised for scalability and maintainability, introducing a refined connector system, governance features, on-chain lens aggregation, and NFT-based position ownership to enhance composability and user clarity. We also built a completely new frontend with improved UX, chain-awareness, and a streamlined interaction model.

Frontend Application

Our team developed the official Fodl frontend as a responsive, multi-chain aware dApp using Angular and TailwindCSS. The application supported wallet connection, position management, execution tracking, and portfolio summarisation, dynamically adjusting to Ethereum, Polygon, or BSC as required. The app was containerised using Docker, served via Nginx, and integrated into a CI/CD pipeline for automated testing and production-grade deployment.

Landing Page
Landing Page

Open Position Modal
Open Position Modal

Position Details
Position Details

Charts
Charts

Technical Architecture Highlights

The Fodl protocol was built around a modular smart contract system leveraging proxy-delegate patterns, inspired by the Diamond Standard. The FoldingAccount.sol smart contract, described above, served as the primary execution proxy for each user. Smart connectors were routed via msg.sig, allowing for dynamic dispatching of position strategies. The architecture included:

  • connectors/ - integrating with Compound, Aave, Uniswap, etc.
  • modules/ - implementing folding, rebalancing, and exit logic
  • lens/ - aggregating on-chain data for frontend and analytics
  • FodlNFT.sol - managing ERC721 metadata and user rights
  • The protocol was deployed with a full observability stack (Prometheus, Grafana), automated with Helm charts on Kubernetes, and integrated via Jenkins pipelines.

    Fodl Tooling Ecosystem

    To support live operations and automation, we built a series of backend tools and bots.

    The Profit & Loss Bot indexed all active FoldingAccounts on-chain, computed real-time unrealised PnL per user, and pushed data to internal dashboards for monitoring and analytics. This enabled position risk metrics and historical return tracking.

    The Stop Loss Bot was a trustless off-chain automation engine designed to evaluate live PnL thresholds and trigger position exits. It was built in Node.js/TypeScript and deeply integrated with Flashbots to protect user transactions from MEV exploitation. This architecture ensured atomic, non-reorderable execution, preserving exit prices without slippage or frontrunning.

    We also developed the Trading Rewards Engine, which processed folding activity snapshots weekly and distributed on-chain rewards via the FodlRewards contract. This created a transparent, merit-based contribution loop that incentivised protocol usage.

    Fodl Landing Page

    To support public discovery and ecosystem trust, we built a visually dynamic landing page using SvelteKit and TailwindCSS. The site featured strong CTAs to the dApp, GitHub repositories, and GitBook documentation. We also integrated visual verification badges from Quantstamp, Certik, Gate.io, and InsurAce, ensuring users and partners could easily verify the protocol’s security posture and listing credentials.

    Security & Audits — Proven, Trusted, Battle-Tested

    Fodl was operated on mainnet across Ethereum, BSC, and Polygon with zero security incidents during its lifetime. The system underwent multiple external audits and passed all of them with minimal issues found.

  • Quantstamp Full Audit Report (PDF)
  • Certik Skynet Security Dashboard
  • All smart contracts, from folding logic and connector integrations to token mechanisms and NFT positions were rigorously reviewed. The architecture was designed around well-defined trust boundaries: proxy delegation was bounded by circuit breakers, flash loans were isolated to ensure no recursive leverage, and governance controls were kept logically and operationally separate. MEV protection via Flashbots was natively baked into the stop-loss subsystem, protecting users from sandwiching and frontrunning. The project adhered to Ethereum’s best security practices throughout.

    Deployment Status

    Fodl was successfully deployed and operated across Ethereum, Polygon, and BSC, running both backend bots and user-facing UI in production. It was DAO-ready, with LP incentives and protocol upgrade paths, and structured for long-term extension via new connectors, tokens, and strategies. The protocol demonstrated that trustless, oracle-free leverage at scale is not only possible but usable and safe for real users.

    Tech Stack

    Solidity
    Hardhat
    Ethers.js
    OpenZeppelin
    Chainlink
    Proxy Patter...
    Delegatecall
    Diamond Patt...
    Circuit Brea...
    Angular
    TailwindCSS
    Web3Modal
    RxJS
    TypeScript
    Ethers.js
    Node.js
    TypeScript
    Flashbots Bu...
    Axios
    PostgreSQL
    Prometheus
    Grafana
    Kafka
    InfluxDB
    Docker
    Nginx
    Kubernetes
    Helm
    Jenkins
    AWS
    GitHub Actio...
    Quantstamp
    Certik
    Flashbots
    OpenZeppelin...
    ERC721 (NFT ...
    ENS
    SvelteKit (M...