case video fallback
Case Study

RociFi: Under-
Collateralized Credit
Protocol on Polygon

How Mad Devs assisted RociFi in developing and launching DeFi's under-collateralized
credit protocol on the Polygon network to reshape the loan experience.

RociFi is a DeFi zero and under-collateralized lending protocol on Polygon. At its core, the protocol leverages on-chain data, machine learning, and loan risk management to effectively and profitably facilitate under-collateralized loans via the blockchain.

About bg
minted-icon

Minted

22,524 NFCS

total-value-icon

total value locked

$100,331

issued-icon

issued

3,446 LOANS

RociFi's borrowers get access to fixed-rate, fixed-term 30-day USDC loans.

A crypto project backed by a group of industry leaders.

Here is a glossary of terminology that we advise you to review before proceeding.

Opportunities with RociFi

RociFi is the first DeFi protocol that allows borrowers to take loans with collateral values less than 100% of loan principles. Moreover, RociFi is

  1. Provides appropriate anonymity.
  2. Does not require any clients' personal information.
  3. Has a unique credit scoring mechanism.
  4. Allows lenders to invest in loan pools and receive high and stable annual returns.

The main feature of this protocol, which distinguishes it from competitors, is the credit scoring mechanism. Credit scores are risk-based, so the lower the score, the better.

Based on DeFi's history and behavior, the credit scores protocol determines whether a borrower is likely to default on their debts. Therefore, lower credit scores mean lower default risk.

For example, a user with a solid reputation will probably receive a high score if they have participated responsibly in DeFi, such as lending/borrowing/liquidity provisioning/DEXes.

However, statistically speaking, the very best credit scores (1–3) are the most difficult to obtain. Accordingly, RociFi scored 10,000+ Aave borrowers and scores 1–3 made up only 7% of all unique borrowers.

Why RociFi Turned to Mad Devs

During the development process, RociFi realized that the development team needed 1 — 2 extra developers. RociFi turned to Mad Devs on the recommendation of their acquaintances — the Lido crypto project. In 2022 Mad Devs assisted Lido.fi in improving their products and securing staking for digital assets. Lido.fi assured RociFi that Mad Devs could help and assist them with everything related to crypto development.

This project was interesting to Mad Devs, not only because we could provide proper expertise in blockchain. But also to build processes that initially improve development and increase the final product quality.

Pavel Zverev, Tech Lead and Advisor

We began testing the entire system for stability and flexibility issues. We found that the architecture was overly complex, creating problems with operations' accuracy and deployment speed. Consequently, the project infrastructure and protocol also needed changes to provide more efficiency. We set goals to improve the solution's stability and reliability.

Goal 1

Goal 1:

Testing the architecture and infrastructure. Optimization of the architecture and infrastructure to ensure their stable and secure operation.

Goal 2

Goal 2:

Preparing the virtual chain infrastructure and preparing the protocol for deployment. Testing the correctness of the smart contracts and automating administrative functions.

Challenges and Solutions

To make the RociFi protocol reliable and efficient, our teams overcame some technical and working process challenges. To reach goals, they argued about the importance of tests, documentation, automation, changing working processes, and finding creative solutions.

Phase 1: Preparation

Challenge

Initially, RociFi wanted to implement an extensive list of features into the platform, many of which were overly complex in the project architecture. In turn, this required complicating the infrastructure, which might slow down the speed and accuracy of the overall solution.

We needed to examine and optimize the architecture to ensure smooth implementation and efficient operation of all features required for the platform.

challenge-phase-one
Solutions
  • Review the project, adopt new instruments, and refocus on the importance of tests and automation.
  • Develop infrastructure around the blockchain.
  • Build bots and set up processes that help to carry out administrative functions.
  • Develop an automated off-chain solution to check debt due dates for expiration and help with further routines of handling liquidations.
  • Implement different automation & CI elements to the pipelines (such as deployment scripts, protocol checklists, etc.)

Results

  • Built a knowledge base reflecting the entire architecture, infrastructure, and features of the project using Jira / Confluence, HackMD, and Miro.
  • Developed smart contracts and defined their addresses to external sources and upgradable components for them using Solidity, Chainlink, and OpenZeppelin.
  • Developed environments and service bots for smart contracts, and their easiest compilation, administration, and CI/CD automation using JavaScript / TypeScript and HardHat.
Project visibility
Phase 1

An example of an automated service for search and liquidation of overdue debts.

Phase 2: Testing

Challenge

Tests were not configured and automated properly, so they did not fully cover the testing of smart contracts.

challenge-phase-two
Solutions
  • Help with test automation.
  • Cover code base with unit & integration tests.
  • Fix bugs & implement needed enhancements found by the tests.
  • Check protocol for vulnerabilities and security problems.

Moreover, we wrote tools that helped us check smart contract configurations and that their operational parameters were within acceptable values.

Results

  • Unit & integration tests were automated and improved coverage of smart contracts to an acceptable level.
  • Fixed bugs and vulnerabilities due to unit & integration tests using Chai.
  • Checked protocol implementation for security issues using Slither and assisted with a bug bounty program.

Phase 3: Protocol Deployment

Challenge

Ensure the protocol's correct configuration and observability. Build the protocol infrastructure to automate its operations.

challenge-phase-three
Solutions
  • Plan the protocol architecture, its components, their decomposition, and define areas of responsibility.
  • Assist with protocol deployment to Ethereum testnet and Polygon mainnet.
  • Automate the work of administrative functions, such as the liquidation of funds upon the expiration of the limitation period for debts.

Results

  • Designed protocol architecture with Jira / Confluence, HackMD, and Miro.
  • Ensured protocol and its components were properly adapted for Polygon instead of Ethereum.
  • Used HardHat scripts and PolygonScan to deploy the final product and check its state.
  • Provided means to access node APIs using Infura and Alchemy.
  • Introduced integrations to observe contract events emitted by user interactions.

Project Development Management

Mad Devs and RociFi enjoyed working together, and the Mad Devs team was glad to contribute to RociFi's mission. We provided service according to one of the delivery models — augmented staff members. This model involves expanding the team by attracting our specialists and management on the RociFi part.

During this process, with project stakeholders, we assessed the product's technological stack and collected additional information about its scope of work to determine the required competencies for specialists.

Work on both phases occurred in several stages:

  • architecture-icon

    Architecture planning

  • protocol-icon

    Protocol development

  • test-imp-icon

    Test implementation

  • bug-fixes-icon

    Bug fixes

  • infra-icon

    Infrastructure preparation

  • sec-check-icon

    Internal smart contract security check

  • feedback-icon

    External security audits and addressing auditor's feedback

  • deployment-icon

    Deployment

  • bug-bounty-icon

    Bug bounty

  • observe-icon

    Observe protocol functioning and long-term maintenance

Results of Cooperation

During the collaboration, teams established working processes, covered the code with unit & integration tests, planned protocol architecture, and developed smart contracts and their environment. After collaborating with the RociFi team, both goals were accomplished, and the protocol was released on time.

While the teams have successfully launched a peer-to-peer lending protocol to offer zero or under-collateralized loans using credit scoring, the collaboration continues, and new goals await the teams.

Technology stack

  • Jira

    Jira

  • Confluence

    Confluence

  • HackMD

    HackMD

  • Miro

    Miro

  • HardHat

    HardHat

  • Solidity

    Solidity

  • OpenZeppelin

    OpenZeppelin

  • ChainLink
  • JavaScript

    JavaScript

  • TypeScript

    TypeScript

  • Infura

    Infura

  • Alchemy

    Alchemy

  • Polygon

    Polygon

  • EtherScan

    EtherScan

Meet the team

Mad Devs:

  • Tony Fedorenko

    Tony Fedorenko

    Delivery Manager

  • Pavel Zverev

    Pavel Zverev

    Tech Lead and Advisor

  • Anton Kozlov

    Anton Kozlov

    Blockchain Developer

  • Zukhra Alieva

    Zukhra Alieva

    Delivery Manager

  • Alexey Dementiev

    Alexey Dementiev

    Support Infrastructure Developer

Roci.fi:

  • Pavel Emdin (Filippov)

    Pavel Emdin (Filippov)

    CTO

  • Konstantin Zagaynov

    Konstantin Zagaynov

    CPO

  • Denis Gareev

    Denis Gareev

    Quality Assurance Engineer

  • Carson Case

    Carson Case

    Lead Blockchain Developer (v1)

  • Konstantin Samarin

    Konstantin Samarin

    Blockchain Developer

  • Alexander Belokon

    Alexander Belokon

    Frontend Developer

Glossary

  • Annual percentage yield (APY) is the real rate of return earned on an investment, taking into account the effect of compounding interest.

  • Automated market makers (AMM) are smart contracts in DeFi that let anyone create a market by depositing cryptocurrency into a liquidity pool.

  • Zero-collateral loans are similar to a revolving line of credit where the borrower only has to pay a liquidity fee on unused capital in their own liquidity pool.

  • Undercollateralized loans enable borrowers to access crypto or fiat assets by providing collateral smaller than the loan's value.

One impressive thing I would like to point out was their gentle approach to the changes they brought to our team. I know that I can always rely on them, which is fabulous.
Pavel Filippov

Pavel Filippov

CTO