PROPELOO

DEFI / PROTOCOL ENGINEERING

Build financial infrastructure that runs without a bank.

PROPELOO engineers DeFi protocols — from AMM and lending contract design to oracle integration, governance systems and the liquidity infrastructure that makes a protocol viable. DeFi is not a feature. It is a set of economic incentives encoded as immutable contracts on a public blockchain. Getting the mechanism design right before the code is more important than the code.

In DeFi, a bad architecture decision is a public exploit waiting to happen.

The largest financial losses in DeFi history were not hacks. They were implementations of architectures that were correctly code-reviewed but incorrectly designed. Flash loan attacks exploit economic assumptions, not code bugs. Oracle manipulation exploits price feed design. Governance attacks exploit token distribution models. The contracts were correct. The systems were wrong. PROPELOO approaches DeFi protocol development starting with mechanism design, invariant definition and adversarial modelling before writing a single line of Solidity.

The full stack of a DeFi protocol.

A DeFi protocol is not a smart contract. It is an economy — with incentive structures, adversarial actors and economic invariants that must hold under conditions the designer did not anticipate.

System Layers

  • Economic Design Layer: Mechanism design, incentive modelling, invariant definition, adversarial scenario analysis
  • Core Protocol Layer: AMM/lending/derivatives contracts, fee logic, state management, protocol invariants
  • Oracle Layer: Price feed integration, TWAP design, manipulation resistance, circuit breakers
  • Governance Layer: Governance token, voting contracts, proposal execution, timelocks, multi-sig councils
  • Liquidity & Integration: Liquidity mining contracts, LP incentives, protocol integrations, composability interfaces

Core Technical Capabilities

  • AMM Protocol Design

    Constant product, concentrated liquidity (Uniswap v3-style) or stableswap AMM design — including fee tiers, tick management, impermanent loss analysis and liquidity provision mechanics.

  • Lending/Borrowing Contracts

    Collateralised lending protocol design — collateral models, liquidation mechanics, interest rate curves, bad debt handling and protocol solvency invariants.

  • Yield Strategy Contracts

    Automated yield strategy vaults, harvesting logic, strategy switching, performance fee accounting and vault share mechanics.

  • Oracle Integration

    Chainlink integration, TWAP oracle design, multi-source aggregation and manipulation-resistant price feed architecture for protocols that depend on accurate asset pricing.

  • Governance System

    On-chain governance contracts with proposal creation, voting periods, quorum requirements, timelock execution and emergency pause mechanisms.

  • Liquidity Mining

    Token incentive distribution contracts with epoch-based rewards, vesting schedules, staking mechanics and anti-mercenary-capital design.

How we think about DeFi protocol design.

A smart contract is a set of rules enforced by a blockchain. A DeFi protocol is an economy. The two are not the same problem.

  • Mechanism design before contract design

    The economic incentives encoded in a DeFi protocol determine whether it attracts liquidity, resists manipulation and survives adversarial conditions. We define the economic model and its invariants before writing Solidity.

    Axiom:

  • Every assumption is an attack surface

    Flash loan attacks exploit the assumption that capital cannot be borrowed and repaid atomically. Oracle attacks exploit the assumption that price feeds are manipulation-resistant. Governance attacks exploit the assumption that token distribution prevents collusion. We model these explicitly.

    Axiom:

  • Liquidity is not a launch problem

    A protocol with correct contracts and no liquidity is useless. Liquidity mining design, initial seeding strategy and LP incentive mechanics must be part of the protocol architecture — not an afterthought.

    Axiom:

  • Composability creates unexpected risk

    DeFi protocols compose with each other. A lending protocol that accepts LP tokens as collateral inherits the risk of the AMM. Every integration is a dependency that can be exploited. We map composability risk as part of the security model.

    Axiom:

The decisions that define a DeFi protocol.

Each of these choices determines the economic model, the security surface and the protocol's viability. Most cannot be changed post-deployment.

  • AMM model selection

    Impact: AMM model determines capital efficiency, LP economics and slippage profile. Wrong choice for the asset type means the protocol is uncompetitive on every trade.

    • Constant product (x*y=k) — simple, deep liquidity across all prices, capital inefficient
    • Concentrated liquidity — capital efficient, complex LP management, impermanent loss concentrated
    • Stableswap (Curve-style) — optimised for pegged assets, low slippage, poor for volatile pairs
    • Custom curve — specific use case, high audit complexity
  • Collateral model design (lending protocols)

    Impact: Cross-collateral models amplify liquidation cascades during correlated market downturns. This is not a hypothetical risk — it caused multiple nine-figure protocol failures.

    • Over-collateralised — safe, lower capital efficiency, excludes undercollateralised borrowers
    • Isolated collateral — each market separate, limits contagion, fragments liquidity
    • Cross-collateral — capital efficient, systemic risk if correlated assets decline together
  • Oracle design

    Impact: Oracle choice is the most consequential security decision in most DeFi protocols. Chainlink is the standard for a reason.

    • Chainlink price feeds — decentralised, audited, depends on oracle network coverage
    • TWAP on-chain — manipulation resistant, price lags spot by design
    • Multi-source aggregation — redundancy, complexity
    • Custom oracle with multi-sig — full control, operational risk
  • Governance token distribution

    Impact: A governance token distribution that concentrates voting power creates a governance attack vector. This is exploitable, and has been.

    • Community-first — broad distribution, governance attack resistant, slower launch
    • Team + investors + community — standard VC model, Sybil attack risk on governance
    • Work token — earn governance through protocol usage, slower distribution
  • Fee model

    Impact: Fee model determines LP profitability and protocol revenue. Under-pricing impermanent loss risk is a common LP fund loss.

    • Fixed fee — simple, predictable, not responsive to utilisation
    • Dynamic fee based on volatility — higher fees during high volatility protect LPs
    • Protocol fee split — portion to treasury/governance, aligns protocol and LP incentives
  • Upgrade governance

    Impact: Immutable DeFi contracts cannot be patched if a vulnerability is discovered. Upgradeable contracts must have governance mechanisms that are themselves resistant to attack.

    • Immutable contracts — maximum trustlessness, no bug fixes after deployment
    • Multisig-controlled upgrade — fast response, centralisation risk
    • Governance-controlled upgrade with timelock — decentralised, 48–72h response window
    • Emergency council + governance — fast emergency response, governance for non-emergencies

What DeFi protocol engineering becomes.

  • DEX / AMM Protocol

    Full AMM implementation — constant product or concentrated liquidity — with fee distribution, LP position management and integration with existing DeFi liquidity.

  • Lending Platform

    Over-collateralised lending protocol with interest rate curves, liquidation engine, collateral isolation and protocol-level risk parameters.

  • Yield Aggregator

    Multi-strategy yield vault with automated harvesting, strategy rebalancing, performance fee accounting and share-based accounting for depositors.

  • Derivatives Protocol

    Perpetual futures or options protocol with mark price oracle, funding rate mechanism, margin engine and automated liquidation bots.

  • Launchpad with Vesting

    Token launch infrastructure with IDO mechanics, tiered allocation, vesting contract and cliff/linear unlock schedules enforced on-chain.

  • Staking & Rewards System

    Protocol staking contracts with epoch-based reward distribution, lock-up mechanics, slashing conditions and delegation for liquid staking designs.

The DeFi protocol stack.

Protocol engineering requires a testing and security toolset as rigorous as the contracts themselves.

  • Smart Contracts

    Stack: Solidity, Rust (Solana), OpenZeppelin, Foundry, Hardhat, Slither / Echidna

  • Protocol Libraries

    Stack: Uniswap v2/v3 Contracts, Compound Finance, Aave Protocol, Chainlink Contracts, OpenZeppelin Governor

  • Testing & Security

    Stack: Foundry (fuzz testing), Echidna (property testing), Manticore, Slither, Mythril, Certora Prover

  • Oracle Integration

    Stack: Chainlink Data Feeds, Chainlink CCIP, API3, Pyth Network, TWAP Oracles

  • Indexing & Data

    Stack: The Graph, Dune Analytics, Custom Subgraph, PostgreSQL, Redis

  • Infrastructure

    Stack: AWS, Alchemy / Infura, Tenderly, Defender (OpenZeppelin), Datadog

DeFi security starts with the economic model, not the code review.

The most expensive DeFi exploits were not code bugs. They were economic design flaws that no code review would have caught.

  • Flash Loan Attacks

    Flash loans allow attackers to borrow arbitrary capital within a single transaction. Any protocol that reads its own token price from its own pool is vulnerable to flash loan price manipulation. Oracle design and reentrancy guards must be modelled against this attack class before coding begins.

  • Oracle Manipulation

    A protocol that depends on a manipulable price feed can be drained by an attacker who temporarily moves that price. TWAP oracles, multi-source aggregation, deviation thresholds and circuit breakers are required for any protocol where price determines solvency.

  • Governance Attacks

    A governance system where token supply can be temporarily acquired allows an attacker to pass malicious proposals. Voting snapshot mechanisms, timelock delays and minimum proposal thresholds are required. Flash loan governance attacks are an active exploit class.

  • Reentrancy

    Cross-contract reentrancy — where the attacking contract is called back during a state transition — is the most common smart contract vulnerability class. Check-effects-interactions pattern, reentrancy guards and careful ordering of external calls are required on every state-changing function.

  • Liquidity Drain

    Protocols with insufficient slippage protection, incorrect fee accounting or exploitable withdrawal mechanics can be drained of LP funds. Invariant-based testing (Echidna, Foundry fuzzing) must verify that no sequence of operations violates the economic invariants of the protocol.

  • Economic Invariant Violations

    The most damaging DeFi exploits are invariant violations — states the protocol designer assumed were impossible. We define explicit invariants before writing contracts and test them exhaustively with fuzz testing and property-based testing tools.

From mechanism design to mainnet.

  1. 01. Mechanism Design

    Economic model definition, invariant specification, adversarial scenario modelling and protocol parameter design before any code is written.

  2. 02. Contract Architecture

    Contract system design, oracle integration specification, governance model, upgrade strategy and interface definition for composability.

  3. 03. Protocol Engineering

    Core contract development with continuous invariant testing. Foundry for fuzz testing, Echidna for property testing, Slither for static analysis on every commit.

  4. 04. Integration & Frontend

    Protocol frontend, subgraph indexing, analytics dashboard, LP management interface and governance portal.

  5. 05. Security & Audit Prep

    Internal security review, 95%+ test coverage, formal invariant documentation, Echidna campaign and preparation for third-party audit.

  6. 06. Audit & Testnet

    Third-party audit coordination with established firms, bug fix cycle, security re-verification and extended testnet with community testing.

  7. 07. Mainnet Launch

    Staged mainnet deployment with TVL caps, monitoring infrastructure, incident response plan and gradual liquidity onboarding.

Frequently Asked Questions

What is the difference between an AMM and an order book DEX?

An AMM (Automated Market Maker) uses a mathematical formula to price assets against a liquidity pool — trades always execute against the pool, LP capital provides continuous liquidity. An order book DEX matches buyer and seller orders at agreed prices — requires active market makers, offers better price discovery for large trades. AMMs are simpler to build and always have liquidity; order books are more capital-efficient for institutional trades but require market maker relationships to launch.

How do you prevent oracle manipulation?

Oracle manipulation prevention requires multiple layers: use time-weighted average prices (TWAP) rather than spot prices for any security-critical calculation, aggregate across multiple independent oracle sources, implement deviation thresholds that trigger circuit breakers when price moves abnormally fast, and never use an on-chain pool's spot price as its own oracle. Chainlink provides manipulation-resistant price feeds for major assets. For assets without Chainlink coverage, TWAP design requires careful analysis of the available liquidity depth.

What is a flash loan attack and how do you defend against it?

A flash loan allows an attacker to borrow an arbitrarily large amount of capital within a single transaction, as long as it is repaid before the transaction ends. Attackers use this borrowed capital to manipulate AMM prices, pass governance votes or exploit logic that assumes token holdings cannot change within a single transaction. Defences: use TWAP oracles rather than spot price, take governance voting snapshots at a past block, use reentrancy guards and never trust a price feed that can be manipulated with the capital available in a flash loan.

How should we design the governance system?

Governance design must balance decentralisation with responsiveness. Our standard recommendation: on-chain proposal voting with a 48–72h timelock before execution, quorum requirements that prevent minority capture, a guardian multi-sig for emergency pause only (not execution), and snapshot voting based on past block balances to prevent flash loan voting attacks. Token distribution must be broad enough to prevent a single actor from controlling proposals — concentration of >10% voting power in a single address creates governance attack risk.

What audit process do DeFi protocols need?

Internal review comes first: Slither static analysis on every commit, Foundry fuzz testing for all invariants, Echidna property-based testing for complex state machines, full test coverage and natspec documentation. Then third-party audit from a firm specialising in DeFi — Trail of Bits, OpenZeppelin, Spearbit or Code4rena depending on protocol complexity and budget. Audit is not a one-time gate: protocols with upgradeable contracts require re-audit after significant changes.

How do you model liquidity incentives?

Liquidity mining incentive models must answer: what token emission rate sustains LP profitability relative to impermanent loss? What happens when emissions reduce — do LPs leave? We model expected APY at different TVL levels, simulate LP exit scenarios as rewards decrease and design sink mechanics (governance staking, fee burns, protocol revenue sharing) to sustain token value without perpetual inflation. Protocols that launch without this model typically experience mercenary capital exits at emission reduction.

What is the risk of upgradeable contracts in DeFi?

Upgradeable DeFi contracts trade one risk for another. Immutable contracts cannot be patched if a vulnerability is found after deployment. Upgradeable contracts can be patched — but the upgrade key is itself an attack surface. A compromised upgrade key can drain all user funds by replacing the contract with a malicious implementation. Mitigations: timelock delays (48–72h minimum) on all upgrades, multi-sig governance with high threshold, emergency pause capability separate from upgrade capability, and governance-controlled upgrades for non-emergency changes.

How does collateral liquidation work?

When a borrowing position's collateral value falls below the required collateralisation ratio, it becomes eligible for liquidation. Liquidators repay a portion of the debt in exchange for the collateral at a discount (the liquidation bonus). The mechanics — partial vs full liquidation, liquidation bonus sizing, bad debt socialisation — significantly affect protocol solvency during market stress. Bonus too low: no liquidation incentive, bad debt accumulates. Bonus too high: aggressive liquidations push asset prices down further, causing cascades.

What chains are best for a new DeFi protocol?

For protocols that need deep liquidity and ecosystem integration: Ethereum mainnet or Arbitrum/Base/Optimism for EVM compatibility with lower fees. For protocols needing high throughput: Solana or Arbitrum. For protocols targeting specific ecosystems: deploy where your target liquidity already lives. Multi-chain deployment adds complexity — separate audit cycles, bridge risk if sharing liquidity, fragmented governance. We recommend launching on one chain with strong product-market fit before expanding.

What does a realistic DeFi protocol launch timeline look like?

Mechanism design and contract architecture: 2–4 weeks. Core protocol development: 6–10 weeks. Integration, frontend and subgraph: 4–6 weeks. Internal security review and test coverage: 2–3 weeks. Third-party audit: 4–6 weeks. Testnet and bug fix cycle: 2–4 weeks. Total: 20–33 weeks from design to mainnet for a production DeFi protocol with full audit. Protocols skipping audit or compressing testing to ship faster are the ones that get exploited.