workaboutcontactblogs
Solidity · Ethereum · Django · Web3

DeFiPlatform

ClientClock B Business Technology
RoleDjango / Ethereum Backend Developer
Year2025
DeFi Platform

A decentralized finance platform built at Clock B Business Technology, comprising two products: a non-custodial Ethereum wallet with hardware wallet support, and a DeFi staking and lending/borrowing platform. All smart contracts written in Solidity, deployed on Ethereum mainnet and Sepolia testnet, with a Django backend handling off-chain indexing, user accounts, and transaction history.

DeFi is technically complex and user-hostile. Most users who want to participate in yield farming or collateralized borrowing are put off by raw wallet tooling, confusing gas estimation, and opaque risk parameters. The platform needed to abstract this complexity without compromising on trustlessness or security at the contract layer.

  • Wrote and audited Solidity smart contracts for ERC-20 staking pools with variable APY tiers.
  • Built a lending protocol with over-collateralization ratios, health factor monitoring, and automated liquidation triggers.
  • Developed a Django backend for off-chain indexing of on-chain events via Web3.py event listeners.
  • Integrated MetaMask and Ledger hardware wallet support with a unified Web3 provider abstraction.
  • Designed a risk dashboard displaying collateral ratio, liquidation price, and portfolio health in plain language.

Building Trustless Finance

DeFi works because code enforces the rules, not institutions. Building on that promise required dual discipline: writing Solidity that is mathematically correct and economically sound, while building a Django layer that makes on-chain state legible to users who shouldn't need to understand the EVM to manage their money.

Ethereum blockchain network visualization

The platform operates on Ethereum mainnet with Sepolia testnet used for continuous development and auditing.

Solidity smart contract code
DeFi portfolio dashboard

Solidity contract source and the DeFi portfolio dashboard on-chain logic made human-readable.

Staking Contract Design

The ERC-20 staking pools use a reward-per-token-stored model an O(1) update mechanism that calculates yield correctly regardless of pool size or number of stakers. Variable APY tiers are set by a multi-sig governance contract, ensuring no single private key can arbitrarily change reward rates. Lock periods are enforced at the contract level, not the application layer.

Lending Protocol

The lending protocol requires over-collateralization (150% minimum) to borrow. A health factor computed in real-time tracks the ratio of collateral value to borrowed value using on-chain price oracles. When health factor drops below 1.0, the position becomes eligible for liquidation triggered automatically by the liquidation contract, not a centralized server.

Staking contract architecture diagram
Lending protocol flow
Liquidation engine visualization
Risk monitoring dashboard

Lending protocol architecture, liquidation engine flow, and the real-time risk monitoring dashboard.

Event Indexing with Django + Web3.py

On-chain events deposits, withdrawals, liquidations, governance votes are indexed off-chain into PostgreSQL by a Web3.py listener running as a Django management command. The listener processes blocks with exponential backoff on RPC failures and maintains a cursor to resume from the last indexed block after restarts. Fast query performance for the frontend without relying on third-party indexers.

Ethereum wallet interface
MetaMask and Ledger integration

The non-custodial Ethereum wallet interface and MetaMask/Ledger connection flow.

Security audit and testing process

Security-First Development

Every contract function was reviewed against the OWASP Smart Contract Top 10 reentrancy, integer overflow, front-running, and access control vulnerabilities. Slither static analysis and Hardhat simulation testing covered edge cases. The lending protocol's liquidation math was independently verified with Python simulations of extreme market scenarios before any mainnet deployment.

Deployed on Ethereum Sepolia testnet with 500+ test transactions. Smart contracts passed internal security review with Slither static analysis. The staking platform handled simulated high-concurrency deposit/withdrawal scenarios with no exploits found.

SolidityEthereumDjangoWeb3.pyPythonDeFi