Case Studies
LendChain Deploys Liquid Staking Protocol Seamlessly with CODI
Written By: Emily Thompson
Last Updated on June 15, 2025
1. Background LendChain offers a liquid staking protocol on Solana, allowing users to stake tokens while maintaining liquidity via derivative tokens. The protocol’s core involves complex state management, reward calculations, and cross-program invocations—requiring thorough security and testing before mainnet launch.
2. Challenges
Complex Logic Scaffolding: Manual creation of staking accounts, reward pools, and CLI scripts took 30+ minutes.
Security Audits: Ensuring correctness of reward math and staking edge-cases required 3–4 days of manual, external review.
Test Coverage: Writing end-to-end tests for deposit, withdraw, and reward distribution consumed ~120 minutes.
Seamless Deployment: Coordinating build scripts, key management, and environment settings for mainnet deployment was error-prone.
3. CODI Solution
LendChain integrated CODI to fully automate their development lifecycle:
Auto-Scaffolding: Using
scaffold-agent
, CODI created staking modules, account initializers, and configuration via a custom template for liquid staking.AI-Driven Audit:
audit-agent
conducted semantic and static analysis on reward logic, flagging potential underflow/overflow and access-control issues in under two minutes.Auto-Test Generation:
test-agent
parsed code annotations and IDL to generate comprehensive Mocha tests covering deposit, withdrawal, fee distribution, and edge-cases.CI/CD Integration: CODI commands were embedded in GitLab CI, ensuring every merge triggered scaffold → audit → test → deploy to mainnet automatically.
4. Implementation Details
Configuration in
codi.toml
:GitLab CI Snippet:
MCP & A2A: CODI persisted context across stages, capturing artifacts like IDLs, audit reports, and test logs, and used A2A to invoke patch-agent on audit findings.
5. Results & Metrics

The table and chart above compare manual versus CODI-enabled workflows:
Manual Workflow: ~360 minutes total
CODI Workflow: ~5 minutes total
Key Outcome: CODI delivered a 98.6% reduction in development time, from six hours to under five minutes.
6. Benefits
Rapid Iteration: Instant scaffolding and validation enabled quick feature pivots during development.
Improved Security: Inline audits caught critical math and access-control bugs early, reducing potential vulnerabilities by 75%.
High Test Coverage: Auto-generated tests achieved >95% coverage without manual effort.
Zero Manual Audits: Eliminated external audit bottlenecks, saving time and cost.
7. Lessons Learned
Tailor Templates: Custom scaffold templates for domain-specific logic (e.g., liquid staking) maximize CODI’s utility.
Optimize Thresholds: Adjust
severity_threshold
to balance risk tolerance and speed.Leverage A2A: Use Agent-to-Agent hooks to automate patching and subtask delegation.
Conclusion
LendChain’s integration of CODI demonstrates how complex DeFi protocols can be built and launched swiftly without compromising security. By automating scaffold, audit, test, and deploy stages through CODI’s multi-context orchestration, they achieved a fully audited mainnet deployment in minutes. CODI proves again to be the only dev you’ll ever need for on-chain development.
Related to Case Studies