Marat Nusurov

DeFi Prime Broker

Company: Arkis Role: Senior Solidity Developer (sole smart contract engineer) Stack: Solidity 0.8.22 · Diamond (ERC-2535) · Foundry · Hardhat · TypeScript · Tenderly Period: 06/2023 - 10/2025

Overview

Under-collateralized leveraged trading protocol on Ethereum designed for institutional use. Borrowers open multi-protocol margin positions across Uniswap, Aave, Morpho, CurveFi, ConvexFi, Pendle, and 1inch from a single risk-controlled account; lenders deploy capital into Agreement contracts and earn yield on leveraged trading flow. Joined as sole smart contract engineer, drove all subsequent development, prepared the codebase for four independent audits (Quantstamp, Trail of Bits, Cantina, Spearbit), authored the DefiLlama TVL adapter, and built three Dune dashboards for on-chain state monitoring and audit preparation.

Technical Scope

Margin Account System

JIT Compiler & Multi-Protocol Integration

Two-Sided Lending (Agreements & Vaults)

Compliance & Whitelisting

Liquidation Engine

Deployment Infrastructure

DefiLlama TVL Adapter

Dune Analytics Dashboards

Key Engineering Decisions

Decision Rationale
ERC-2535 Diamond proxy for Dispatcher and Compiler Bypasses contract bytecode size limits while keeping upgrade logic modular; per-facet selector routing isolates feature surface area.
ERC-7201 namespaced storage everywhere Prevents storage collisions across proxy layers and diamond facets; assembly-based direct slot access.
Two-layer compliance (compile-time + execution-time) Compile-time fail-fast eliminates wasted gas on predictably-invalid operations; execution-time check makes bypass structurally impossible.
Account object pooling in AccountFactory Closed accounts return to a per-owner pool instead of being destroyed - significant gas savings for repeat traders.
ERC-4626 for AgreementStaking and VaultStaking Standardized share accounting and external composability over custom share math.
Hybrid Hardhat + Foundry pipeline Hardhat Deploy handles upgrade and deployment workflows; Foundry runs the unit + E2E test suite. One deploy codebase covers production, fresh mainnet, fork-of-prod, and self-test scenarios.

Audit Record

Auditor Date Scope Link Archived
Quantstamp Dec 2023 General security review Report Local Copy
Trail of Bits Dec 2024 ERC-2535 Diamond pattern, leverage protocol logic Report Local Copy
Cantina May 2025 Smart contract security review Report Local Copy
Cantina + Spearbit Sep 2025 Joint competitive review, threat modeling, edge cases Report Local Copy

Technical Insights