Rumi Finance is a decentralized finance (DeFi) portfolio management platform that aims to provide a comprehensive and efficient solution for managing investments in DeFi products. By leveraging the power of blockchain, smart contracts, artificial intelligence (AI), and machine learning, Rumi simplifies the process of investing in decentralized financial products, enabling investors and fund managers to access and manage multiple DeFi protocols from a single platform. This paper will detail the architecture, design, and implementation of the Rumi Protocol and its various components, as well as discuss the advantages and potential challenges in its deployment.
Our technology is designed to manage, optimize, and create DeFi structured products. Many of the tools, connections, and data points that exist for managing financial products and portfolios in traditional finance are still underdeveloped in the blockchain ecosystem. Certain aspects that are considered routine in traditional finance are not as straightforward in the crypto sphere. Examples of these challenges include:
- Gathering historical on-chain data
- Calculating ROIs and PnLs using this data
- Conducting paper trading before executing a strategy
- Identifying opportunities across various protocols and chains, which often exist in silos and require technology adaptation for aggregation
- Developing client reporting tools
- Implementing investment and fund accounting systems
- Establishing compliance systems and protocols
- Adapting to the distinct trade execution processes on every protocol and chain
As the DeFi ecosystem continues to evolve and mature, these challenges will be addressed, and the necessary tools will be developed. This progression will enable more streamlined and efficient management of DeFi products and portfolios, bringing the sector closer to the capabilities seen in traditional finance.
In a broad sense, we identify both investors and fund managers as the primary stakeholders in our technology:
Our technology empowers investors to optimize their returns and streamline the management of their digital assets by automating intricate tasks such as position rebalancing and portfolio adjustments, among others.
Additionally, our technology simplifies the responsibilities of a DeFi Fund Manager by consolidating the tools needed to establish and manage an on-chain portfolio in one unified platform.
Rumi Finance's technology architecture has been meticulously crafted to offer a comprehensive DeFi platform catering to a diverse array of users, ranging from individual retail investors to sophisticated institutional clients. The platform's architecture encompasses various interconnected components, each playing a vital role in ensuring a smooth and efficient user experience. These components include: Web3 Frontend, Smart Contract Suite, Keeper Bots, Kubernetes Node.js - GraphQL API Backend, Cross-chain Compatibility
Security and Auditing.
By integrating these components into a cohesive system, Rumi Finance's technology architecture effectively addresses the complexities of the DeFi ecosystem, providing a versatile and secure solution for a wide range of users.
The Rumi Protocol emphasizes a modular design, prioritizing security, risk management, and scalability. This well-structured architecture facilitates effortless integration with numerous DeFi protocols while boasting cross-chain compatibility, effectively harnessing the most promising opportunities in the DeFi ecosystem.
The following diagram gives a high level overview of how our system architecture looks.
Web3 Frontend: The frontend of the Rumi Protocol utilizes cutting-edge web technologies, including React, and incorporates open-source libraries to deliver a highly responsive and intuitive user interface. This allows for seamless interaction with blockchain elements, providing users with an exceptional experience as they navigate and manage their DeFi portfolios.
Smart Contract Suite: Rumi's smart contracts employ a modular and extensible design, facilitating effortless integration of new protocols and strategies. The primary components encompass Investment Vault, Controller Contract, Yield Strategies, Lending Module, and Oracle Interfaces.
Keeper Bots: Keeper Bots undertake the critical responsibility of maintaining the platform's strategies, managing leverage, rebalancing positions, and executing other essential tasks. The infrastructure comprises a combination of on-chain and off-chain Keeper Bots.
Kubernetes Node.js - GraphQL API Backend: The API backend is entrusted with aggregating data from a multitude of sources and providing endpoints for frontend applications, risk management systems, and additional services. We have engineered a highly scalable backend that can dynamically adapt to our evolving needs and usage.
Risk Framework: Rumi's robust risk framework integrates ETL pipelines, risk management functions, an alerting framework, and real-time monitoring dashboards, guaranteeing the platform's security and stability.
AI and Machine Learning: The platform harnesses the power of AI and machine learning for predicting optimal liquidity ranges, trend forecasting, and anomaly detection, contributing to superior performance and comprehensive risk management.
Portfolio Optimizer: Our state-of-the-art optimizer continuously evaluates the allocation of each deployed strategy on a risk-adjusted basis. The optimizer's output provides allocation targets for our vaults, guiding the optimal performance of our strategies.
Backtesting Framework: Our sophisticated framework empowers us to safely validate and deploy strategies into production. By gathering, analyzing, and applying quantitative methodologies, we can rigorously test, validate, and optimize strategies before presenting them to investors through our smart contracts.
Off-Chain Yield Aggregation: We have developed an off-chain yield aggregator that enables the creation of a cross-chain aggregated product. This allows investors to diversify into different chains and protocols in a single investment, and for us to manage the cross-chain allocation efficiently, without relying on potentially unsafe on-chain bridging strategies.
Lending Module (Prime): Rumi Finance's lending module is thoughtfully designed to address the requirements of both lenders and borrowers (Strategy Investors). In Rumi Finance, we offer the opportunity to take undercollateralized leveraged positions, enabling investors who deposit into our strategies to maximize returns by borrowing funds from our Lending Module. For more information, explore our comprehensive Lending Module documentation.
The following diagram shows all the verticals that our system covers and all the components that need to be built in order to manage an on-chain portfolio.
In traditional finance, many of the components listed above are readily available off-the-shelf. However, in DeFi, these components are often developed separately, depending on factors like the blockchain, specific protocols, and technologies involved. As a result, there is no standardization across the DeFi ecosystem, making it necessary for those looking to manage a portfolio to build most of the required components from scratch. This presents unique challenges and opportunities for developers and users alike as they navigate the rapidly evolving world of decentralized finance.
FINANCIAL PRODUCT DEVELOPMENT CYCLE
The financial product development cycle at Rumi Finance is a meticulous and thorough process, setting us apart from competitors in the DeFi space. Our multi-step methodology ensures that each new financial product released meets the highest standards in terms of risk-adjusted performance. This rigorous approach allows us to confidently deliver reliable and efficient financial solutions tailored to the unique needs of the decentralized finance ecosystem.
The following diagram describes our methodology:
Step 1 – Product Definition & Deep Research:
Our quantitative team continuously explores market opportunities through our risk framework and discovery tools. Upon identifying an opportunity, we develop a strategy definition, conduct in-depth research, and document existing resources while listing new resources or tools required. The result is a comprehensive architecture and blueprint to build the strategy.
Step 2 – Data Collection:
Data serves as the foundation for backtesting our strategies. Each protocol and chain has unique data structures and methods for data sourcing.
Not all the data is easily accessible through APIs or On-Chain interfaces, this task normally involves very advanced data sourcing and data validation. As an example, we do exhaustive research on APYs calculations on every protocol as we have found misleading information and a lack of consensus on how to publish APYs and APRs, also Oracle Data is not well documented, we have found out that a protocol can have a smart contract with one oracle while having the same data feed in another smart contract coming from another oracle all while both contracts interacting with each other.
Step 3 – Off-Chain Modeling and Simulation:
With the definition, blueprint, and initial data sources in place, we simulate the strategy off-chain. This step includes modeling the strategy, performing complex mathematical calculations, and simulating the strategy's on-chain behavior off-chain, usually in Jupyter Notebooks. This process allows us to run scenario simulations, backtesting, stress testing, and lay the groundwork for optimizing the strategy.
Example: Leverage Yield Farming Delta Neutral Rebalancing Simulation Testing
Step 4 – Quantitative Optimization:
Using the results of the modeling and off-chain simulation, we identify the parameters that drive the strategy's performance and focus on optimizing them. We perform extensive analysis and scenario simulations to create optimized combinations of parameters, resulting in a set of rules or algorithms for strategy optimization.
Step 5 – On-Chain Shadow Forked Network Simulation:
Paper trading in DeFi is challenging due to the lack of exact contract copies and out-of-sync data on test nets. To overcome this, we've built a Shadow Forked Network to mimic a main net and synchronize the smart contracts and oracles our strategy will interact with. This setup allows us to test all contract interactions in conditions identical to the main net, ensuring optimal strategy performance.
In the example below we are running a $100k Pseudo-Delta Neutral Strategy on Alpha Homora or any other leverage yield farming provider, this allows us to measure the performance of the strategy as if it were live, determining any pitfalls, adjusting for performance, and measuring limits such as slippage, max deposits and other factors that might hinder the optimization of the strategy.
Architecture of the Forked Shadow Network
Example: Leverage Yield Farming Shadow Fork On-Chain Simulator on Kibana
Step 6 – On-Chain Dry Run:
After optimizing the strategy for on-chain execution, we create a keeper robot to execute the strategy on the main net using real funds. The dry run testing is logged into our data aggregator pipeline for performance measurement and comparison, allowing us to fine-tune the strategy execution. All the dry run testing is logged into our data aggregator pipeline in ElasticSearch-Kibana so that we can measure and compare the performance.
Step 7 – Readiness Assessment for Launch:
In this phase, we evaluate the previous steps' outcomes, measure dry run performance, document potential pitfalls, and establish rules for executing the strategy. We determine the optimization parameters' accuracy and assess if the strategy is ready for launch in a smart contract.
Step 8 – Smart Contract Development:
Now, the strategy is prepared for smart contract implementation. We define the vault-strategy mix, map interfaces to other protocols and addresses, and plan events for on-chain data consumption by our backend. The development undergoes rigorous testing in both forked and shadow forked networks.
Step 10 – Smart Contract Launch:
Finally, the smart contract is deployed on the main net, with governance addresses set and the strategy ready for user interaction through our Web3 interfaces.
SMART CONTRACT SUITE
Our smart contract suite enables the packaging of any composable DeFi product and placing it on-chain. The suite is built on the following architecture:
The smart contract architecture components:
Vault: A vault is the contract that tracks all the investors positions and represents the value contained in the aggregation of different yield generating opportunities. It is in charge of tracking the Price Per Share of the underlying execution of the strategies, it allows deposits and withdrawals from investors, it manages the funds allocation that each underlying strategy should have and allows the governance of the vault to reallocate funds with a single transaction. One of the key features of our vault is that it can have 1 to the N strategies.
Controller: This controller enables communication between the vaults and strategies, providing standardized access control and governance features. It allows the interchange and upgrade of strategies without creating new smart contracts.
Strategies: These contracts hold the core of the yield generation and are where financial products perform and become composable. Strategies aggregate all positions deposited in the vault, consolidate execution for all investors, and interact with other DeFi products to generate yield. They also interact with keepers, which are external off-chain or on-chain systems that keep the strategy current and active, providing activities such as harvesting and monitoring. One of the key characteristics of the strategy is that it will aggregate all the positions deposited in the vault and consolidate the execution for all the investors.
Keeper System: This system is composed of different task executors that maintain strategy activity, checking and executing activities such as harvesting and rebalancing, and monitoring position health. These keepers are deployed both on-chain and off-chain, ensuring efficient operation.
Our Vault, Controller and Strategy contracts are decoupled but interact with each other in the following manner:
- The vault allows deposits/withdrawals and tracks user's Price Per Share. It is also in charge of the 1 to the N allocation in each strategy.
- The controller couples the funds and other governance functions with the Strategy.
- The Strategy is where the earn (Yield Farming) actions take place and all the composability with other protocols happen.
- Our architecture allows 1 vault to manage different strategies at the same time and track the yield from the different sources.
- Normally the whitelisted investor will deposit them into the Vault, the Governance will then allocate this funds calling the earn function of the vault and the strategy will be up kept with the Keeper Bot who is constantly maintaining the strategy.
- Our investment committee will check through our risk framework if the strategies need rebalancing and call the reallocation function from the vault to reallocate the portfolio of strategies held.
Some additional features added into our contract are:
- Front-running protection
- Merkle proof guest listing
- Governance roles
- Upgradability and automated Deployments
- Tokenized yields
- High test and branch coverage
- Hardhat development environment
Protocols that we are able to integrate with, this list is not exhaustive as we're constantly testing and developing new strategies:
- Avalanche - Trader Joe
- Avalanche - Pangolin
- Fantom - SpookySwap
- Fantom - SpiritSwap
- Uniswap (both V2 and V3)
- Alpha Homora
SMART CONTRACT SECURITY
INSTITUTIONAL TRADE MANAGEMENT COMPONENTS
Trade management in our platform involves the following components:
Use of Multisigs: We have integrated Gnsois Safe Mutlisig into our platform, this allows us to manage the smart contract governance and the deposits into our vaults with Mutlisig Technology where transactions have to be initiated by one party and approved and executed by other team members avoiding a point of breach and allowing funds to be safely managed.
Reporting and Performance Management: We have built a reporting layer where NAVs, ROIs, PnLs of the overall portfolio and the individual investors are being recorded, calculated and tracked in real time. This involves aggregating and recording historical data on positions so that we can report and track real time performance. We are using a mixture of technologies from a tailored backend off chain solution to the use of Subgraphs.
Smart Contract Security: Our smart contracts are audited by Hacken and monitored constantly with services like Tenderly so that we can have alerting and logging capabilities that allows us to take actions in case of an incident.
Risk Management: We have built the tools necessary to collect historical data and offer a complete solution for risk management around every investment product.
Alerting system: We have built our alerting system on top of PagerDuty which allows us and institutional clients to have real time alerting and incident management. The alerting system is connected to our risk framework which allows investors to manage risk in real time.
The future road map is based on growing our yield generating products and at the same time continue simplifying the adoption of our tools through facilitating ease of use and accessibility through third party integrations.
Strategy Optimization & Growth
- Non-EVM integrations such as Cosmos and Solana
- Cross Chain Vault and Bridging
- Validator Nodes infrastructure and Yield Products
- Real World Assets
Ease of Use - drive adoption
- No-Code Strategy-Vault Factory
- Single step to launch your own fund
- SDK for whitelabel
- Productize our Backtesting framework and environment
- Integrate ERC 4337 - Account Abstraction
- Institutional Investor tools (series creation, tax calculations, API services)
- Machine learning for anomaly detection
- Machine learning for trend detection and forecasting
Third Party Integrations
- Third party integrations marketplace (Zappier, Slack, etc…)
- Other SAAS and ERPs
- Tax Accounting Software