# What is Tren Finance?

The first fully autonomous AI network controlled stablecoin borrowing protocol, where a swarm of 20+ agents coordinate to eliminate human bias from DeFi

Tren Finance and TrenOS represent a fundamental reimagining of decentralized finance. While traditional DeFi protocols operate on fixed parameters and human governance, Tren Finance introduces a revolutionary model: a self-evolving financial ecosystem powered by artificial intelligence. This vision goes beyond mere automation of existing processes—it creates a financial system capable of independent thought, learning, and adaptation.

The traditional DeFi landscape faces several critical challenges that Tren Finance aims to address. Human governance, while valuable, often introduces delays and can be influenced by political factors rather than pure economic efficiency. Risk assessment typically relies on simplified metrics that fail to capture the full complexity of market dynamics. Furthermore, liquidity management often follows rigid formulas that cannot adapt quickly enough to rapidly changing market conditions.

#### Our Approach

Tren Finance addresses these limitations through an interconnected network of specialized AI agents. Each agent masters a specific aspect of protocol operations, while remaining connected through a sophisticated central coordination system. This creates a holistic approach to protocol management that can respond to market conditions in real-time while maintaining sight of long-term strategic objectives.

***

### Core Architecture

#### System Overview

The foundation of Tren Finance consists of a hybrid architecture that seamlessly combines on-chain smart contracts with off-chain AI processing. This design harnesses both the security and transparency inherent to blockchain technology and the computational flexibility needed for sophisticated AI operations.

#### Data Flow Architecture

The system processes information through three primary layers that work in concert to ensure optimal protocol performance. The Data Collection Layer serves as the protocol's sensory system, continuously monitoring on-chain activities, market conditions, and external factors that might impact protocol performance. This includes everything from transaction patterns and liquidity depths to market volatility and broader economic indicators.

The Processing Layer applies sophisticated AI models to this collected data, using advanced algorithms to identify patterns, assess risks, and make predictions about future market conditions. This layer combines traditional statistical methods with cutting-edge machine learning techniques to derive actionable insights from the raw data.

The Execution Layer implements decisions through smart contracts, translating AI recommendations into concrete protocol adjustments and transactions. This layer ensures that all actions taken by the protocol remain transparent and verifiable on-chain.

#### Integration Framework

The LangChain framework serves as the backbone of Tren Finance's AI integration system, creating seamless pathways for communication between different components. This framework provides the essential infrastructure through which our AI agents interact, share information, and coordinate their activities. When an agent makes a decision, LangChain ensures that this information flows efficiently to all relevant parts of the system, maintaining consistency and enabling rapid response to changing conditions.

The integration framework also provides robust error handling mechanisms that ensure system stability even in unexpected situations. When an AI agent encounters an unusual scenario or produces an unexpected output, the framework's fallback mechanisms activate, preventing any single point of failure from affecting the broader system. This resilience is crucial for maintaining continuous operation in the dynamic DeFi environment.

***

### AI Agent Network

#### Core Agents

**Interest Rate Optimizer AI**

The Interest Rate Optimizer serves as the protocol's monetary policy expert, continuously analyzing and adjusting lending and borrowing rates across all markets. This agent considers multiple layers of market dynamics simultaneously, from immediate utilization rates to broader economic trends. When utilization in a particular market approaches suboptimal levels, the optimizer adjusts rates to encourage market-appropriate behavior.

For instance, if a lending market shows consistently high utilization, the agent might gradually increase borrowing rates to incentivize more deposits while ensuring the adjustment doesn't create market shocks. These decisions incorporate both historical patterns and forward-looking predictions, creating a dynamic but stable rate environment.

**XY AI (Monetary Policy)**

The XY AI functions as the protocol's central bank, managing the delicate balance of stablecoin supply and demand. This agent's decision-making process mirrors traditional central banking operations but operates at the speed and precision only possible through artificial intelligence. When market conditions suggest potential price instability, the XY AI can implement various stability measures, from adjusting collateralization requirements to managing minting and burning operations.

The agent maintains price stability through a sophisticated feedback system that monitors multiple economic indicators simultaneously. This includes tracking velocity of money within the protocol, analyzing collateral health across the system, and measuring market depth across various trading pairs. These inputs inform precise adjustments to monetary policy that maintain stable asset prices while supporting protocol growth.

**Asset Risk AI**

The Asset Risk AI functions as the protocol's chief risk officer, implementing a comprehensive approach to risk management that goes far beyond simple price monitoring. This agent develops sophisticated risk models that consider multiple factors simultaneously, creating a more nuanced understanding of potential threats to protocol stability.

In its continuous risk assessment process, the agent analyzes correlations between different assets, monitors market liquidity depths, and evaluates broader market conditions that might affect collateral values. When the agent detects increasing risk levels, it can gradually adjust protocol parameters to maintain stability without creating market disruptions.

#### Supporting Agents

**Market Sentiment AI**

The Market Sentiment AI serves as the protocol's market intelligence system, developing a comprehensive understanding of market conditions by synthesizing information from numerous sources. This agent processes vast amounts of data, from social media discussions to news articles and on-chain metrics, creating a nuanced picture of market sentiment that informs other agents' decisions.

Understanding market sentiment proves crucial for anticipating potential market movements and adjusting protocol parameters preemptively. The agent can detect early warning signs of market stress, identify emerging trends in user behavior, and recognize potential opportunities for protocol expansion. This information flows to other agents, allowing them to adjust their strategies based on broader market context.

**User Interaction AI**

The User Interaction AI transforms the way users engage with the protocol, creating an intuitive interface that adapts to each user's needs and experience level. This agent learns from user behavior patterns to provide increasingly personalized experiences, from suggesting optimal strategies for experienced traders to offering step-by-step guidance for newcomers.

Through natural language processing capabilities, the agent can understand and respond to complex queries about protocol operations, risk levels, and market conditions. It maintains a conversational memory that allows it to provide consistent, contextually relevant support across multiple interactions with the same user.

***

### Learning Systems

#### Reinforcement Learning Framework

The reinforcement learning system forms the cornerstone of Tren Finance's ability to improve over time. This sophisticated learning framework enables AI agents to refine their decision-making processes through direct interaction with real market conditions. Each decision made by an agent becomes a learning opportunity, with outcomes feeding back into the system to inform future choices.

The training process follows a carefully structured approach that begins with extensive training on historical data to establish baseline performance metrics. As agents interact with live markets, they continuously refine their models based on real-world outcomes. This learning process incorporates multiple feedback loops, allowing agents to understand both immediate and long-term consequences of their decisions.

Performance evaluation occurs across multiple dimensions, considering not just immediate outcomes but also longer-term impacts on protocol stability and user satisfaction. The system measures capital efficiency, risk management effectiveness, and user engagement metrics, using these insights to guide the evolution of AI models.

#### Knowledge Integration

**RAG System Implementation**

The Retrieval-Augmented Generation (RAG) system functions as the protocol's institutional memory, maintaining a comprehensive record of market events, decision outcomes, and their interconnections. This system enables AI agents to learn not just from their own experiences but from the collective history of the entire protocol.

When facing a decision, agents can query this vast knowledge base to find similar historical situations and their outcomes. The RAG system doesn't just store this information—it organizes it in ways that highlight relevant patterns and relationships, enabling agents to draw meaningful insights from past experiences.

**Vector Database Architecture**

The vector database system transforms raw historical data into a structured format that enables rapid pattern recognition and analysis. This sophisticated storage system maintains complex relationship mappings between different market events, allowing AI agents to quickly identify relevant historical patterns when making decisions.

The database architecture supports real-time data access and analysis, enabling agents to combine historical insights with current market conditions when making decisions. This fusion of past and present information creates a more nuanced understanding of market dynamics, leading to more informed decision-making.

***

### Protocol Mechanics

#### Liquidity Management

Understanding how Tren Finance manages liquidity requires examining both the technical mechanisms and the economic principles that guide them. The protocol's approach to liquidity management represents a significant advancement over traditional automated market makers, incorporating real-time AI analysis to optimize capital efficiency.

At its core, the protocol employs dynamic pool management strategies that continuously adapt to market conditions. When the AI system detects suboptimal liquidity distribution, it initiates automatic rebalancing procedures. These adjustments happen gradually to prevent market disruption while ensuring capital remains productively deployed across the protocol.

The system's approach to fee structures exemplifies this dynamic management. Rather than implementing fixed fee tiers, the protocol adjusts fees based on real-time analysis of pool composition, market volatility, and user behavior patterns. During periods of high volatility, for instance, the system might temporarily increase fees to maintain pool stability while adjusting them downward during calmer periods to encourage volume.

Strategic reserve management plays a crucial role in the protocol's liquidity strategy. The AI system maintains and adjusts protocol reserves based on sophisticated risk models that consider multiple market scenarios. These reserves serve as a buffer against extreme market conditions while also providing resources for protocol growth and development.

#### Risk Mitigation

Risk management in Tren Finance operates as a sophisticated multi-layered system that goes beyond traditional DeFi risk measures. The protocol's approach to risk combines preventive measures, active monitoring, and responsive actions, creating a comprehensive safety framework for users' assets.

Real-time collateral monitoring serves as the first line of defense. The system continuously evaluates collateral health across all positions, considering not just current market prices but also liquidity depth, market volatility, and correlation risks. This comprehensive analysis allows the protocol to anticipate potential risks before they materialize into actual problems.

The protocol's approach to liquidations demonstrates this sophisticated risk management in action. Rather than using fixed liquidation thresholds, the system employs dynamic thresholds that adjust based on market conditions. During periods of high volatility, these thresholds might become more conservative to provide additional safety margins. Conversely, in stable market conditions, the system can operate with more efficient thresholds while maintaining security.

The protocol's insurance fund represents another critical component of risk mitigation. This fund grows through a portion of protocol fees and is managed by AI agents that assess and adjust coverage levels based on current risk metrics. The insurance mechanism activates automatically in response to specific trigger events, providing an additional layer of protection for protocol users.

***

### Governance Evolution

The evolution of governance in Tren Finance follows a carefully planned trajectory toward full autonomy. This transition represents one of the most ambitious aspects of the protocol, as it aims to create a truly self-governing financial system while maintaining security and stability throughout the process.

#### Phase 1: AI-Assisted Governance

In the initial phase, AI agents serve as sophisticated analytical tools that support human governance decisions. During this period, the system collects and analyzes vast amounts of data about governance decisions and their outcomes, building a comprehensive understanding of effective protocol management.

The AI system provides detailed recommendations for protocol parameters, backed by data-driven analysis and projections. For example, when considering changes to lending parameters, the AI might present analysis showing historical patterns, projected outcomes, and potential risks associated with different options. While humans retain final decision-making authority during this phase, they benefit from increasingly sophisticated AI insights.

#### Phase 2: Semi-Autonomous Operation

The transition to semi-autonomous operation marks a significant milestone in the protocol's evolution. During this phase, AI agents begin handling routine operational decisions independently, while human oversight focuses on strategic decisions and emergency situations.

This phase implements a sophisticated system of checks and balances. AI agents can automatically adjust protocol parameters within predefined ranges, but significant changes require human approval. The system maintains comprehensive audit trails of all AI decisions, allowing for thorough review and analysis of autonomous operations.

Emergency override mechanisms remain in place during this phase, providing a safety net for unexpected situations. These mechanisms allow human governors to quickly intervene if necessary, though such interventions trigger automatic reviews to help the system learn from these exceptional cases.

#### Phase 3: Full Autonomy

The final phase represents the culmination of the protocol's governance evolution: a fully autonomous system capable of managing all aspects of protocol operations. This autonomy doesn't mean the absence of oversight—rather, it represents the maturation of a sophisticated system of self-regulation and adaptation.

In this phase, AI agents manage everything from routine parameter adjustments to strategic protocol developments. The system's decision-making capabilities have been refined through extensive learning and real-world operation, enabling it to handle complex situations autonomously while maintaining protocol stability and security.

***

### Technical Implementation

#### Smart Contract Architecture

The smart contract architecture of Tren Finance represents a careful balance between flexibility and security. The system employs a modular design that separates different protocol functions into distinct contracts while maintaining secure interactions between components.

At the core of the architecture lies the protocol's state management system. This system maintains critical protocol information while implementing sophisticated access controls that determine how different components can interact with and modify protocol state. The design allows for efficient updates to protocol logic while maintaining security over user assets.

The contract upgradeability system demonstrates this balance between flexibility and security. Rather than using traditional proxy patterns that might introduce security risks, the protocol implements a sophisticated upgrade mechanism that requires both AI and human verification before changes can take effect. This approach allows the protocol to evolve while maintaining robust security guarantees.

#### AI Integration Architecture

The integration of AI systems with on-chain operations represents one of the most innovative aspects of Tren Finance's technical implementation. This integration occurs through a sophisticated oracle network that allows AI decisions to be securely implemented on-chain while maintaining decentralization.

The system employs a unique consensus mechanism for AI decisions that requires multiple independent verifications before changes take effect. This mechanism ensures that no single AI agent can make unilateral changes to critical protocol parameters, creating a robust security model for autonomous operations.

***

### Security and Transparency

The security architecture of Tren Finance reflects a deep understanding that in decentralized finance, security isn't just a feature—it's the foundation everything else builds upon. Our approach to security combines traditional blockchain security principles with innovative AI-driven protection mechanisms, creating multiple layers of defense that work together to protect user assets and protocol stability.

#### Proof of Liquidity System

The Proof of Liquidity system represents one of the most innovative aspects of Tren Finance's security architecture. Traditional liquidity verification in DeFi often relies on simple token balances, which can be manipulated through flash loans or other sophisticated attacks. Our system takes a fundamentally different approach, implementing continuous verification of liquidity at multiple levels.

When a user provides liquidity to the protocol, the Proof of Liquidity system creates a comprehensive record of the deposit that goes far beyond basic balance tracking. The system analyzes the transaction history of the deposited tokens, verifies the authenticity of the liquidity source, and maintains ongoing monitoring of how that liquidity interacts with the protocol. This deep analysis helps prevent various forms of manipulation, from wash trading to more sophisticated attacks involving synthetic positions.

The verification process happens in real-time, with AI agents continuously monitoring for patterns that might indicate attempted manipulation. When suspicious patterns emerge, the system can automatically adjust risk parameters or temporarily restrict certain operations until human reviewers can investigate. This proactive approach helps prevent attacks before they can impact protocol stability.

#### Multi-Layer Security Architecture

Security in Tren Finance operates through concentric layers of protection, each designed to complement and reinforce the others. At the smart contract level, this begins with formal verification of critical protocol components. Every core contract undergoes rigorous mathematical verification to prove its behavior matches specifications under all possible conditions.

The time-delay system serves as another crucial security layer. Critical protocol changes must pass through a sophisticated waiting period that varies based on the potential impact of the change. During this period, both AI agents and human reviewers can analyze the proposed changes. The system even adjusts the waiting period dynamically based on market conditions and the complexity of the proposed changes.

Our multi-signature system implements an innovative approach to decentralized control. Rather than using a fixed set of signers, the system employs a dynamic multi-signature mechanism where the required signatures adjust based on the type and scope of the operation being authorized. This creates a flexible yet secure governance mechanism that can adapt to different situations while maintaining strong security guarantees.

***

### Community Development

Community development in Tren Finance goes beyond traditional governance participation. We've created a sophisticated ecosystem that enables deep technical contribution while maintaining protocol security and stability. This approach allows the protocol to benefit from collective intelligence while ensuring all additions meet rigorous quality and security standards.

#### Open AI Agent Framework

The Open AI Agent Framework represents a groundbreaking approach to community contribution in DeFi. This framework allows developers to create new AI agents that can integrate with the protocol's existing agent network. Think of it as an app store for financial AI, where each new agent can add specialized capabilities to the protocol.

When developing a new agent, contributors work within a sophisticated development environment that provides tools for training, testing, and validating AI models. This environment includes access to historical market data, allowing developers to train and validate their agents against real-world scenarios before deployment.

The integration process follows a careful progression from testing to full deployment. New agents first operate in a sandbox environment where they can interact with real market data but cannot affect protocol operations. As agents demonstrate their effectiveness and safety, they can gradually gain increased permissions within the system.

#### Community Contribution Architecture

The protocol's approach to community contributions extends beyond just technical development. We've implemented a sophisticated system that recognizes and rewards different types of contributions, from code development to research and education. This system tracks contributions through a reputation mechanism that considers both the quantity and quality of participation.

The governance process for evaluating community contributions involves both automated and human elements. AI agents perform initial screening of proposed changes, checking for technical correctness and potential security implications. Successful proposals then move to community review, where stakeholders can analyze and discuss potential impacts.

***

### Future Evolution

The future development of Tren Finance follows a carefully planned trajectory that balances innovation with stability. Each planned enhancement builds upon existing capabilities while opening new possibilities for protocol growth and improvement.

#### Technical Evolution

The technical roadmap focuses on several key areas of advancement. In the near term, we're working on enhancing the AI models' predictive capabilities through advanced machine learning techniques. This includes implementing more sophisticated natural language processing for market sentiment analysis and developing improved risk assessment models that can better anticipate market movements.

Cross-chain integration represents another major focus area. We're developing innovative approaches to managing liquidity and risk across multiple blockchains while maintaining the protocol's high security standards. This includes creating new AI agents specifically designed to monitor and manage cross-chain operations.

#### Ecosystem Development

The ecosystem development plan focuses on creating a rich environment where various financial services can interact seamlessly. We're developing frameworks for third-party protocols to integrate with Tren Finance's AI capabilities, allowing the broader DeFi ecosystem to benefit from our advanced risk management and optimization systems.

These integrations will enable new forms of financial instruments that combine traditional DeFi capabilities with AI-driven risk management. For instance, we're exploring systems for automated portfolio management that can adapt to changing market conditions while maintaining user-specified risk parameters.

***

### Unlocking Billions in Idle Liquidity

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FGUU5r681lpFiJYH2diYY%2Fwhat%20is.png?alt=media&amp;token=786b739c-8156-4180-8103-93f154ef47a4" alt=""><figcaption></figcaption></figure>

The DeFi ecosystem currently holds over tens of billions of dollars worth of assets across [lending markets](https://defillama.com/protocols/lending), [DEXs](https://defillama.com/protocols/Dexes), and [yield protocols](https://defillama.com/protocols/Yield) that remain underutilized from a capital efficiency perspective. While these assets generate yield through various mechanisms - LP fees, farming rewards, staking returns - they represent a massive pool of locked capital that could be further leveraged to enhance returns and create new opportunities.

This untapped market spans across various DeFi sectors:

* DEX Liquidity: [LP ](https://coinmarketcap.com/academy/glossary/liquidity-provider-tokens-lp-tokens)tokens across major DEXes
* Lending markets: deposit tokens ([aTokens](https://aave.com/docs/developers/smart-contracts/tokenization), [cTokens](https://docs.compound.finance/v2/ctokens/))
* Yield farming: staked assets ([PT](https://docs.pendle.finance/ProtocolMechanics/YieldTokenization/PT), [vault](https://docs.yearn.fi/getting-started/products/yvaults/vault-tokens#:~:text=yVault%20Tokens%20are%20like%20a,will%20receive%20yvYFI%20in%20return.) tokens)

***

### Key Protocol Features

#### Isolated Modules

Risk is siloed with isolated module architecture, eliminating systemic risk. [Read more](/protocol/isolated-modules)

#### Proof-of-Liquidity

Proof-of-Liquidity is a mechanism for dynamically assessing collateral value by leveraging the underlying liquidity of tokens, ensuring a more accurate and liquidatable asset valuation compared to traditional [quote price](https://www.investopedia.com/terms/q/quoted-price.asp) methods. [Read more](/protocol/proof-of-liquidity)

#### Hooks

Hooks are customizable smart contracts to enhance interoperability and create advanced strategies with 3rd party protocols. Use Hooks to get leverage on your assets. [Read more](/protocol/hooks)

#### FlashMint

Infinite on-demand liquidity for arbitrage, refinancing, and other complex DeFi strategies, all while maintaining zero-risk settlement. [Read more](/protocol/flashmint)

#### Gauges

Gauges are used to determine how protocol revenue and rewards are allocated to the various stakeholders in Tren Finance's ecosystem. [Read more](#gauges)

#### SSL

The Single Sided Liquidity (SSL) Program enables users to contribute stablecoins to establish or augment [liquidity pools](https://www.coingecko.com/learn/liquidity-pools-crypto-defi) with Tren Finance’s synthetic dollar, [XY](/tokens/xy). [Read more](/protocol/single-sided-liquidity-ssl)

***

### Tokens

#### XY

XY is a synthetic dollar debt token backed by overcollateralized loans. The token was built using  Layerzero's [Omnichain Fungible Token (OFT)](https://docs.layerzero.network/v2/home/token-standards/oft-standard) standard, allowing XY to be transferred across multiple blockchains without asset wrapping, middlechains, or liquidity pools. [Read more](/tokens/xy)

#### TREN & veTREN

TREN is the value accrual token for Tren Finance, with 90% of protocol revenue directed towards TREN buybacks. The token supply is designed to diminish over time through TREN burns, and starts at a fixed initial supply of 1 billion tokens. veTREN stands for "vote-escrowed TREN." veTREN is used to gauge the voting power and economic commitment of users who choose to lock their TREN tokens for a specified duration. [Read more](/tokens/tren-and-vetren)

***

## Use Cases

Tren Finance offers 3 main use cases that users can employ, with different strategies under each use case.

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FcE18C9h6z5F3ER8jhR5T%2Fwhat%20is2.jpg?alt=media&amp;token=68ca4ad7-d557-41da-b375-a4a3a6c4cea8" alt=""><figcaption></figcaption></figure>

### re(Enable) AMM Liquidity

By using LP tokens as collateral, users can borrow XY, which can be used to [hedge](https://www.investopedia.com/trading/hedging-beginners-guide/#:~:text=Hedging%20is%20a%20risk%20management,provides%2C%20known%20as%20the%20premium) against [impermanent loss](https://www.techopedia.com/definition/impermanent-loss) in their LP positions, or simply be used as liquidity to acquire other assets. Users can also use the protocol's recursive lending hook for [looping leverage](/protocol/hooks/looping-leverage) on their LP tokens, maximizing yield.&#x20;

### re(Collateralize) Money Market Deposits

Users can also use receipt tokens from money market deposits for looping leverage and enhanced yield. XY can be borrowed at 0% interest, and can be used to [hedge](https://www.investopedia.com/trading/hedging-beginners-guide/#:~:text=Hedging%20is%20a%20risk%20management,provides%2C%20known%20as%20the%20premium) against a user's underlying money market deposit token for a delta neutral position, while still accumulating yield from the money market deposit.&#x20;

### Leveraged re(Staking)

Restaked assets can be used similarly to money market deposits. PT tokens can also be used on the protocol, and with looping leverage, users can multiply their yield from PT tokens. Users can also borrow XY at 0% interest to hedge against their underlying positions for [delta neutral](https://www.investopedia.com/terms/d/deltaneutral.asp) positioning while still accumulating yield.


# LP Tokens

Unlock liquidity in your LP tokens

This strategy utilizes idle liquidity in the form of LP tokens for enhanced yield, or additional liquidity. For this example, we'll use Curve's 3pool, but it can also be applied to other v2 style liquidity pools such as Balancer.

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2F9sX5y08T2YcBMgTCE3Lu%2Fstrategy12.png?alt=media&amp;token=fd4aa178-c38d-4d63-8d4c-d21fc190ba62" alt=""><figcaption></figcaption></figure>

#### Multiply Yield on LP Tokens

1. Deposit stablecoins (USDC, DAI, USDT) on Curve to receive 3pool LP tokens
2. Collateralize these LP tokens in Tren's isolated module
3. Gain leverage through Tren Finance's [Hooks](/protocol/hooks)
4. CRV rewards can automatically be compounded for you
5. Achieve up to 10x leverage, transforming 1.5% base APY into significantly higher yields

#### Gain Additional Liquidity with XY

1. Deposit stablecoins (USDC, DAI, USDT) on Curve to receive 3pool LP tokens
2. Collateralize these LP tokens in Tren's isolated module
3. Borrow your desired amount of XY
4. Use XY as you would any stablecoin, including:
   1. Buy / long another asset
   2. Hedge against impermanent loss


# Money Market Deposits

Unlock liquidity in your deposit tokens

This strategy utilizes idle liquidity in the form of deposit tokens for additional liquidity at a low cost, or for enhancing yield. For this example, we'll use Aave's aWETH token, but it can also be applied to lending protocol deposit tokens such as Compound.

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2Fh8TUMijGLxQdBWC1gFSG%2Faave.png?alt=media&amp;token=85e91247-bd45-498a-b37e-17d95a329538" alt=""><figcaption></figcaption></figure>

#### Gain Additional Liquidity at a Lower Cost with XY

The AAVE deposit strategy showcases the potential for cost reduction in borrowing:

1. Users deposit ETH into AAVE, earning base yield (currently \~2% APY)
2. The resulting aWETH is deposited and used as collateral in Tren Finance's isolated module
3. Users can borrow XY at significantly reduced rates (1% vs AAVE's 9.27% on GHO)
4. Use XY as you would any stablecoin, including:
   1. Buy / long another asset
   2. Short the underlying deposit token to achieve delta neutral positioning; earn the deposit APY from Aave + funding rate yield on the short position&#x20;

#### Multiply Yield on Deposit Tokens

1. Deposit ETH on Aave to receive aWETH deposit tokens
2. Collateralize the resulting aWETH in Tren's isolated module
3. Gain leverage through Tren Finance's [Hooks](/protocol/hooks)
4. Rewards can automatically be compounded for you
5. Gain leverage, transforming 2% base APY into significantly higher yields

#### Additional Benefits

* Tren Finance generally offers higher LTV rates compared to money markets like Aave, allowing for greater capital efficiency
* Through [Hooks](/protocol/hooks), users can loop their deposit tokens using Tren Finance and repaying back their debt using collateral, something that isn't natively possible on money markets like [Compound](https://app.compound.finance).


# Concentrated Liquidity Positions

Hedge against impermanent loss on your concentrated liquidity positions

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FB1VoBMdgKB0uv6MIel9H%2Fconcentrated%20liq.png?alt=media&amp;token=51851c70-e7d4-48e5-92d5-48d46969e6c7" alt=""><figcaption></figcaption></figure>

**Step 1:** The user creates a concentrated liquidity position in UniswapV3 for ETH-USDT within a selected price range to maximize capital efficiency, receiving an LP NFT to represent their position.

**Step 2:** The user deposits their concentrated LP NFT as collateral in Tren Finance to borrow XY while maintaining liquidity provision rewards.

**Step 3:** Maintain liquidity rewards while reducing impermanent loss exposure through [hedging](https://www.investopedia.com/trading/hedging-beginners-guide/#:~:text=Hedging%20is%20a%20risk%20management,provides%2C%20known%20as%20the%20premium) with the following benefits:

* Reduced IL exposure while maintaining full LP rewards&#x20;
* Capital efficient liquidity provision in target range&#x20;
* Automated position management through hooks

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FI2bIxxzBkgeSldYvtVt6%2Fstrategy3.png?alt=media&amp;token=62a64762-8592-4ba1-9553-de008d9e6972" alt=""><figcaption></figcaption></figure>


# PT Tokens

Gain leverage on your PT Tokens to multiply your yield

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FRGCwJc53zkuv6Xj2H9YE%2Fstrategy10.png?alt=media&amp;token=c7aab769-b58e-4989-8516-3452ec2a0de9" alt=""><figcaption></figcaption></figure>

**Leverage**

The user deposits PT sUSDe tokens into Tren Finance to get up to 10x leverage, amplifying their base APY from 14% to 140% through the power of leverage.

**Auto-Rollover**

Using [Hooks](/protocol/hooks), the position automatically manages rollovers between PT maturities, eliminating manual intervention and maximizing yield through optimal timing.

The process for attaining leverage is shown below:

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2F67a7rgbyhByDbDYnWNhr%2Fstrategy11.jpg?alt=media&amp;token=c4fdbe39-0a3d-4a37-b193-a0f70c57c415" alt=""><figcaption></figcaption></figure>


# FAQ

Frequently Asked Questions about Tren Finance

<details>

<summary>What are the AI agents used in Tren Finance?</summary>

Tren AI operates through a network of specialized AI agents, each performing a specific function. Read more about each of them [here](https://app.gitbook.com/o/ekO061FGpqpZfWqB2ayo/s/1RFiSnFFNN5tL05uK9pV/~/changes/166/tren-ai/agent-specialization).

</details>

<details>

<summary>What happens if an AI agent makes a mistake?</summary>

Tren AI includes multiple fail-safes to prevent incorrect AI decisions:

* AI decisions are validated using multiple sources before execution.
* Emergency governance overrides allow manual intervention if needed.
* Rate limits on AI adjustments prevent sudden extreme changes in protocol settings.

</details>

<details>

<summary>How does Tren AI learn and improve over time?</summary>

Tren AI employs **machine learning and RAG (Retrieval-Augmented Generation)** to **continuously refine** its models:

* AI agents track **every decision, past risk events, and liquidation records**.
* **Reinforcement learning** helps AI fine-tune strategies for better capital efficiency.
* AI **retrieves governance history** to ensure **consistent and optimal decision-making**

</details>

<details>

<summary>How does Tren AI use LangChain and RAG technology?</summary>

Tren AI utilizes LangChain and RAG (Retrieval-Augmented Generation) to process structured and unstructured data:

* RAG retrieves historical governance, risk events, and liquidation data.
* LangChain Tools fetch real-time market data, trading volumes, and oracle feeds.
* AI combines both data sources to make informed, real-time decisions on protocol adjustments.

</details>

<details>

<summary>Does Tren Finance have redemptions?</summary>

No, Tren Finance does not have redemptions. To see why, please read [here](/tokens/xy#handling-trenusd-above-its-peg-6)

</details>

<details>

<summary>What are the use cases and strategies that I can employ with Tren Finance?</summary>

Tren Finance unlocks numerous ways to (re)collateralize idle liquidity. Please read our  [Use Cases](/#use-cases) section and detailed explanations of the different [Strategies](/get-started/what-is-tren-finance/lp-tokens) that you can employ.

</details>

<details>

<summary>Does the protocol use isolated, or cross-collateral pools?</summary>

The protocol uses isolated modules architecture. [Read more](/protocol/isolated-modules)

</details>

<details>

<summary>How does XY maintain its peg?</summary>

Tren Finance uses soft peg, and hard peg mechanisms for when XY is above and below its target peg. If XY is below peg for a sustained period of time, a XY buyback and burn program is deployed. [Read more](/tokens/xy#peg-stability)

</details>

<details>

<summary>How does the protocol handle liquidations?</summary>

The protocol primarily relies on the Insurance Pool mechanism for liquidations. [Read more](/protocol/liquidations)

</details>

<details>

<summary>Does the protocol have revenue sharing mechanisms? How does TREN accrue value? </summary>

90% of protocol revenue goes towards TREN buybacks. [Read more](/tokens/tren-and-vetren)

</details>

<details>

<summary>How does protocol revenue distribution work? </summary>

Protocol revenue allocation is decided by the TrenDAO ([veTREN](/tokens/tren-and-vetren#what-is-vetren) holders). The TrenDAO vote on different [Gauges](/protocol/gauges) to decide protocol revenue allocation and distribution. [Read more](/protocol/gauges)

</details>

<details>

<summary>Does Tren Finance have a token?</summary>

Yes, there are two tokens on Tren Finance. One is [TREN](/tokens/tren-and-vetren), a fixed-supply value accrual token architected on the principles of the ve(3,3) model. The other token is [XY](/tokens/xy), a synthetic dollar debt token backed by overcollateralized loans.

</details>

<details>

<summary>What stablecoins are eligible for deposit in the <a href="/protocol/single-sided-liquidity-ssl">Liquidity Generation Event</a>?</summary>

USDT is currently eligible. We will look to expand the list of eligible stablecoins based on demand.

</details>

<details>

<summary>Is there a way to repay loans / withdraw collateral via smart contracts and not the frontend?</summary>

Yes. Follow the steps outlined [here](/resources/contract-addresses/withdrawing-via-smart-contracts).

</details>


# What is TrenOS?

TrenOS represents a revolutionary step forward in the evolution of decentralized finance. While the DeFi landscape has traditionally relied on human oversight, manual governance, and static algorithmic systems, TrenOS introduces a paradigm shift: a fully autonomous, AI-driven financial ecosystem that continuously evolves and adapts to market conditions in real-time.

This next-generation protocol moves beyond the limitations of traditional DeFi systems by implementing a sophisticated network of AI agents that manage every aspect of protocol operations. From risk assessment and interest rate adjustments to liquidity provisioning and governance, these agents work in concert to create a truly trustless and efficient financial infrastructure.

#### Current DeFi Limitations

The traditional DeFi landscape faces several fundamental challenges that limit its efficiency and accessibility. Understanding these limitations provides crucial context for appreciating the innovations TrenOS introduces to the ecosystem.

The cost structure of traditional DeFi protocols represents a significant barrier to adoption. Many protocols rely heavily on external risk modeling services, incurring substantial fees for basic operational functions like risk parameter adjustments. These costs inevitably flow through to users in the form of higher borrowing rates, making DeFi less accessible to the broader market.

Asset support in current DeFi protocols remains constrained by rigid governance processes. The integration of new assets, particularly those with lower liquidity or emerging market presence, requires extensive approval processes and risk assessments. This bureaucratic overhead significantly delays the adoption of new assets and limits the protocol's ability to serve evolving market needs.

Capital management in existing protocols often follows static models that fail to capture the dynamic nature of crypto markets. Interest rates typically adjust based on predetermined algorithms that lack the flexibility to respond to real-time market conditions. This rigidity leads to inefficient capital allocation and missed opportunities for both borrowers and lenders.

### The TrenOS Solution

#### AI-Driven Governance Framework

At the heart of TrenOS lies a sophisticated AI-driven governance system that represents a fundamental reimagining of how decentralized protocols can operate. Rather than relying on traditional governance mechanisms, where token holders vote on protocol changes, TrenOS implements a network of specialized AI agents that continuously monitor and adjust protocol parameters.

This governance system evolves through carefully designed stages, each representing a step toward full autonomy. The initial phase, AI-Assisted Governance, introduces AI recommendations while maintaining human oversight through governance multisigs. This allows the system to build a track record of successful decision-making while maintaining security through human verification.

As the system matures, it transitions to Semi-Autonomous AI Governance, where AI agents handle routine operations independently while major changes still require oversight. This intermediate stage serves as a crucial testing ground for autonomous decision-making while maintaining safeguards against potential risks.

The final stage implements Fully AI-Driven Governance, where artificial intelligence manages all core financial operations without requiring human intervention. This represents the culmination of the protocol's evolution toward true autonomy, though robust safety mechanisms remain in place to ensure system stability.

#### Revenue Generation and Distribution

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FV99DXDpwZfYskRbqre5K%2Ftrenos3.png?alt=media&amp;token=c67b055d-cce2-44a4-9c67-24d3ee90eb2d" alt=""><figcaption></figcaption></figure>

TrenOS implements a sophisticated revenue model that leverages AI optimization at every level. The system generates revenue through multiple streams, each enhanced by artificial intelligence to maximize efficiency and fairness.

Liquidation processes in TrenOS demonstrate this AI-driven efficiency. Rather than following static liquidation parameters, the system uses advanced predictive models to optimize the timing and execution of liquidations. This not only protects the protocol's stability but also maximizes revenue generation while minimizing negative impacts on users.

Flash minting capabilities introduce another innovative revenue stream. The protocol's AI systems carefully manage instant liquidity provision through flash loans, ensuring these powerful tools remain accessible while generating sustainable revenue for the protocol.

The fee structure itself adapts dynamically based on market conditions and user behavior patterns. AI agents continuously analyze market data to optimize borrowing fees and yield structures, ensuring the protocol remains competitive while maintaining healthy revenue generation.

### Risk Assessment and Management

#### Real-Time Risk Analysis

TrenOS revolutionizes DeFi risk management through a sophisticated AI-driven system that operates continuously across all protocol activities. Unlike traditional systems that rely on periodic updates and manual oversight, TrenOS implements real-time risk assessment that adapts instantly to changing market conditions.

The risk assessment system maintains constant surveillance of loan positions, analyzing not just current health factors but also predictive metrics that indicate potential future risks. When the system detects emerging risk patterns, it can implement preventive measures before traditional risk indicators would even show cause for concern.

This predictive capability extends beyond individual positions to encompass broader market dynamics. The AI risk management system synthesizes data from multiple sources, including market volatility patterns, correlation metrics between different assets, and broader economic indicators. This comprehensive analysis enables the protocol to anticipate and prepare for market movements that might affect user positions.

#### Dynamic Collateral Management

Traditional DeFi protocols typically implement static collateral requirements that fail to account for changing market conditions. TrenOS takes a fundamentally different approach, implementing dynamic collateral management that adjusts in real-time based on market conditions and risk assessments.

The system continuously evaluates appropriate collateral levels by analyzing multiple factors simultaneously. This includes not just price volatility but also liquidity depth, market sentiment, and correlation risks between different assets. When market conditions suggest increased risk, the system can gradually adjust collateral requirements to provide additional safety margins without creating sudden disruptions.

These adjustments happen smoothly and predictively, rather than reactively. If the AI system anticipates increasing market volatility, it might begin gradually increasing collateral requirements before the volatility materializes, providing users time to adjust their positions and preventing cascade effects that could destabilize the protocol.

### Liquidity Optimization

#### Adaptive Pool Management

TrenOS implements a sophisticated approach to liquidity management that goes beyond traditional automated market maker (AMM) designs. The protocol's AI systems maintain constant oversight of liquidity pools, implementing dynamic adjustments to optimize capital efficiency while maintaining stability.

The system's approach to liquidity management operates on multiple timeframes simultaneously. In the immediate term, AI agents monitor and adjust token reserves to maintain optimal trading conditions. Over longer periods, the system analyzes usage patterns to implement strategic shifts in liquidity distribution across different markets and assets.

This multi-temporal approach allows TrenOS to maintain efficient day-to-day operations while also optimizing for longer-term strategic objectives. The system can identify emerging trends in liquidity usage and adjust incentive structures accordingly, ensuring capital remains productively deployed across the protocol.

#### Interest Rate Dynamics

Interest rate management in TrenOS demonstrates the sophisticated capabilities of its AI systems. Rather than following predetermined formulas, interest rates adjust dynamically based on a complex analysis of market conditions, user behavior, and protocol objectives.

The interest rate mechanism considers multiple factors simultaneously: current utilization rates, market competition, user demand patterns, and broader economic indicators. This allows the protocol to maintain competitive rates while ensuring sustainable operation and optimal capital efficiency.

The system's approach to interest rate adjustments exemplifies its sophisticated decision-making capabilities. Rather than implementing sudden changes that could disrupt market activity, the AI system generally implements gradual adjustments that allow users to adapt their positions while maintaining market stability.

### Technical Implementation

#### AI Agent Architecture

The AI agent network in TrenOS implements a sophisticated multi-agent system where specialized agents collaborate to manage different aspects of protocol operations. This distributed architecture provides both resilience and flexibility, allowing the protocol to handle complex operations while maintaining stability.

Each agent in the network maintains specific responsibilities while participating in a broader coordination framework. The system implements careful checks and balances, requiring consensus among multiple agents for significant protocol adjustments. This creates a robust security model that prevents any single agent from making unilateral changes that could destabilize the protocol.

#### Data Processing and Analysis

The data processing infrastructure represents a crucial component of TrenOS's technical architecture. The system implements sophisticated data collection and analysis frameworks that enable AI agents to make informed decisions based on comprehensive market intelligence.

This infrastructure processes multiple data streams simultaneously, from on-chain metrics to external market data and user behavior patterns. Advanced machine learning models analyze this data in real-time, identifying patterns and relationships that inform protocol operations.

### Future Development

#### Protocol Evolution

TrenOS's development roadmap outlines a careful progression toward increasingly sophisticated autonomous operations. Each stage of development builds upon previous achievements while introducing new capabilities that enhance protocol functionality.

The system's evolution focuses on several key areas: expanding AI capabilities, enhancing risk management systems, and developing more sophisticated governance mechanisms. These developments proceed carefully, with each new feature undergoing extensive testing before deployment.

#### Ecosystem Growth

The growth strategy for TrenOS extends beyond core protocol development to encompass broader ecosystem expansion. This includes developing frameworks for integration with other protocols, creating new financial instruments that leverage TrenOS's AI capabilities, and building tools that make the protocol more accessible to users at all levels.

#### Research and Innovation

Looking toward the future, TrenOS maintains an active research program exploring cutting-edge applications of AI in decentralized finance. This includes investigation of advanced machine learning techniques, development of more sophisticated risk models, and exploration of new approaches to autonomous protocol governance.

This research focuses not just on immediate protocol enhancements but also on longer-term innovations that could fundamentally advance the capabilities of decentralized finance. Through careful implementation of these advances, TrenOS aims to continue pushing the boundaries of what's possible in autonomous financial systems.

By maintaining this forward-looking approach while ensuring robust current operations, TrenOS works to create an increasingly sophisticated and reliable financial ecosystem that serves user needs while advancing the frontier of decentralized finance technology.


# AI Agent Network

TrenOS represents a fundamental shift in decentralized finance through its AI Agent Network, a sophisticated system of autonomous agents that work in concert to manage protocol operations. Unlike traditional DeFi systems that rely on manual governance and fixed parameters, these agents continuously analyze market conditions and adjust protocol behavior in real-time.

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FXRaAFQfL8HtYVJDCkqtx%2Ftrenos.png?alt=media&amp;token=cf9633f7-fbc3-44ce-a6f1-b05997b76a8b" alt=""><figcaption></figcaption></figure>

### Core Architecture

#### Network Structure

The AI Agent Network operates as a decentralized system where specialized agents handle distinct aspects of protocol operations. Each agent maintains independence in its specific domain while participating in a broader coordination framework that ensures cohesive protocol management.

The Interest Rate Optimization Agent serves as the protocol's monetary policy expert, continuously analyzing market conditions to adjust borrowing and lending rates. This agent considers multiple factors simultaneously: current utilization rates, market competition, historical patterns, and broader economic indicators. When market conditions shift, the agent implements gradual rate adjustments that maintain stability while improving capital efficiency.

The Liquidation Prediction Agent focuses on preventing system risks before they materialize. Through sophisticated predictive modeling, this agent analyzes borrower positions, market volatility, and correlation risks to identify potential liquidation events early. When risks emerge, the agent can implement preventive measures, such as adjusting collateral requirements or providing early warnings to at-risk positions.

The Risk Analysis Agent maintains constant surveillance of system-wide risk exposure. This includes monitoring for potential vulnerabilities, analyzing market manipulation attempts, and evaluating the overall health of protocol positions. The agent's comprehensive risk assessment considers not just individual positions but also systemic risks that could affect protocol stability.

#### Learning Mechanisms

The network's intelligence grows through multiple learning mechanisms working in concert. Supervised learning provides the foundation, with models training on historical DeFi data to understand market patterns and user behaviors. This historical understanding creates a baseline for identifying anomalies and opportunities in current market conditions.

Reinforcement learning enables continuous improvement in decision-making. Each agent tracks the outcomes of its actions, refining its strategies based on real-world results. This creates a feedback loop where successful strategies are reinforced while less effective approaches are gradually phased out.

The integration of Retrieval-Augmented Generation (RAG) gives agents access to deep historical context when making decisions. By combining current market data with historical patterns, agents can make more informed choices that consider both immediate conditions and longer-term trends.

### Protocol Management

#### Liquidity Optimization

The network's approach to liquidity management demonstrates the sophistication of its decision-making capabilities. Agents continuously monitor pool conditions, implementing dynamic adjustments to maintain optimal capital efficiency. This includes rebalancing liquidity reserves based on usage patterns, adjusting incentive structures to encourage desired behavior, and managing depth across different trading pairs.

When market conditions indicate potential liquidity stress, the system can implement preemptive measures to maintain stability. This might involve adjusting reward rates to attract additional liquidity, modifying pool parameters to optimize existing resources, or implementing temporary changes to trading conditions.

#### Risk Mitigation

Risk management under the AI Agent Network operates as a proactive rather than reactive system. The network maintains continuous surveillance of both individual positions and system-wide risk factors. This comprehensive monitoring allows early detection of potential issues, enabling preventive action before risks materialize into problems.

The system's approach to collateral management exemplifies this proactive stance. Rather than waiting for positions to approach liquidation thresholds, agents analyze market conditions and position health to identify potential risks early. This allows for gradual adjustments that help users maintain healthy positions while protecting protocol stability.

### Governance Evolution

#### Current State

The network currently operates within a controlled environment where significant changes require multisig approval. This provides an important safety mechanism during the system's early stages while allowing the AI agents to demonstrate their capability for autonomous decision-making.

#### Transition to Autonomy

The path toward full autonomy follows a carefully planned progression. During the AI-Assisted Governance phase, agents provide recommendations while human governance maintains final approval authority. This allows the system to build a track record of successful decision-making while maintaining security through human oversight.

The Semi-Autonomous phase represents a crucial step toward full autonomy. During this period, agents handle routine operations independently while major protocol changes still require oversight. This creates a proving ground for autonomous operation while maintaining important safety checks.

The final stage of Full Autonomy will see the network managing all protocol operations independently. This transition will occur gradually as the system demonstrates consistent reliability in decision-making and risk management.

### Technical Implementation

#### Agent Communication

The network implements sophisticated communication protocols that enable agents to share information and coordinate actions effectively. This includes real-time data sharing about market conditions, risk assessments, and planned adjustments. The communication framework ensures that agent actions remain coordinated even as they operate independently within their domains.

#### Safety Mechanisms

Multiple layers of safety mechanisms protect protocol operation. These include automated circuit breakers that can pause specific activities during unusual market conditions, consensus requirements for significant parameter changes, and sophisticated monitoring systems that can detect and respond to potential threats.

### Future Development

The AI Agent Network continues to evolve, with ongoing research into advanced machine learning techniques, improved prediction models, and more sophisticated coordination mechanisms. This development focuses on enhancing the network's ability to manage complex market conditions while maintaining protocol stability and security.

The long-term vision sees the network becoming increasingly sophisticated in its ability to analyze market conditions, predict potential risks, and implement optimal strategies for protocol management. Through careful development and testing, the system moves steadily toward this goal of creating a truly autonomous, self-improving financial protocol.


# Learning & Data Processing

TrenOS represents a fundamental shift in DeFi protocol design through its sophisticated AI system that powers our protocol's decision-making capabilities. By combining real-time market data from both on-chain and off-chain sources, we've developed a system that continuously evolves with every transaction, market movement, and governance decision.

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FZ7YBSExaNF9gHnoBvtRN%2Ftrenos2.png?alt=media&amp;token=e8ba1668-4924-4f3b-8372-528858286b8d" alt=""><figcaption></figcaption></figure>

***

### Core AI Architecture

While traditional DeFi protocols operate like calculators with fixed rules and formulas, TrenOS functions more like a seasoned trader who constantly learns from market conditions. The system maintains comprehensive records of past decisions, storing everything from liquidation events to governance votes in specialized vector databases. This historical data serves not just as a record but as the foundation for building deep understanding of effective strategies.

The system employs reinforcement learning to fine-tune lending and collateral models, adapting its approach based on observed outcomes. Successful strategies are noted and reinforced, while less effective approaches inform future improvements. What truly distinguishes TrenOS is its holistic market awareness, continuously analyzing social sentiment, tracking macro trends, and monitoring governance discussions to adapt to market conditions in real-time rather than merely reacting to them.

### Data Pipeline

#### On-Chain Data Processing

The AI system maintains constant surveillance of blockchain activity, processing a comprehensive range of metrics. This includes real-time liquidity monitoring across pool activity and token reserves, detailed analysis of borrower behavior and position management, and tracking of collateral movements and concentration patterns. The system pays particular attention to historical liquidation data, transaction patterns, and keeper network performance, using this information to inform its decision-making processes.

#### Off-Chain Market Intelligence

To construct a complete market perspective, TrenOS integrates data from multiple off-chain sources. High-quality oracle feeds from providers like Chainlink and Pyth deliver real-time pricing information, while macro indicators provide context about interest rates and global market activity. The system incorporates long-term historical data for cycle analysis, alongside current news sentiment and major market events. This comprehensive approach includes security threat monitoring and vulnerability tracking to ensure protocol safety.

### Machine Learning Implementation

Our machine learning infrastructure is specifically designed to handle the complexity inherent in DeFi markets. The system employs sophisticated pattern recognition capabilities to stay ahead of market movements, analyzing user behavior, transaction trends, and liquidity shifts across the protocol. This proactive approach enables early detection of potential defaults and market manipulation attempts.

#### Reinforcement Learning Framework

The reinforcement learning system functions as an increasingly sophisticated trader, receiving feedback on every decision through carefully designed reward signals. It automatically adjusts protocol parameters such as interest rates and collateral ratios based on observed outcomes. The system conducts continuous A/B testing on different liquidity strategies, learning which approaches prove most effective across varying market conditions.

#### Risk Management System

Risk management within TrenOS operates as a dynamic, AI-driven process rather than relying on static thresholds. The system proactively identifies high-risk positions before they become problematic, maintaining constant monitoring for potential flash loan attacks and other security threats. Risk models undergo continuous updates based on actual liquidation events, while stress tests on collateral positions ensure system resilience.

### Continuous Improvement Process

The true innovation of TrenOS lies in how these components work together in a continuous improvement cycle. Every decision undergoes real-time evaluation, with successful strategies being reinforced and refined while less effective approaches are analyzed for improvement. The system actively incorporates community feedback, ensuring that protocol development aligns with user needs and market demands.

#### Practical Implementation

In practice, this sophisticated system demonstrates its value through rapid response to market conditions. When the AI detects an emerging liquidity imbalance, it initiates a series of coordinated responses, adjusting borrowing rates proactively. The system then monitors the effectiveness of these adjustments, strengthening successful strategies and adapting its models based on observed outcomes. This process includes continuous comparison with competitor protocols, ensuring TrenOS maintains its competitive edge while consistently improving its operational efficiency.

Through this constant cycle of learning and adaptation, TrenOS continues to enhance its capabilities in risk management, liquidity optimization, and governance automation, all while maintaining responsive adaptation to real market conditions. This systematic approach to protocol management ensures that TrenOS remains at the forefront of DeFi innovation, delivering increasingly sophisticated and effective financial services to its users.


# Agent Specialization

TrenOS operates through a network of specialized AI agents, each designed to handle a specific aspect of the protocol. These agents work collaboratively to optimize liquidity, manage risk, adjust interest rates, and execute governance automation. By compartmentalizing tasks across different AI models, TrenOS ensures efficiency, scalability, and adaptability in its financial operations.

The specialization of AI agents enables TrenOS to maintain a modular and self-improving system, where each agent continuously learns from market data, refines its decision-making processes, and operates autonomously without human intervention.

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FQ9syAYBH6uqPBidF2ERk%2Ftrenos11.png?alt=media&amp;token=51795ddf-b2e3-4f6b-8726-7c64424a1d90" alt=""><figcaption></figcaption></figure>

***

### Key AI Agent Categories

#### **1. Interest Rate Optimization Agent**

The Interest Rate Optimization Agent dynamically adjusts borrowing and lending rates in response to market conditions. By analyzing factors such as supply, demand, volatility, and macroeconomic trends, this agent ensures that:

* Borrowing remains affordable while maintaining protocol sustainability.
* Lending incentives remain competitive to attract liquidity providers.
* Rates adapt to liquidity crises, reducing market inefficiencies.

#### **2. Liquidation Prediction Agent**

This agent is responsible for forecasting potential liquidation events before they occur. It utilizes:

* **On-chain data** such as borrower collateral ratios and liquidation thresholds.
* **Historical liquidation patterns** to refine predictive accuracy.
* **Flash loan monitoring** to detect potential exploitative attacks and mitigate risks in real-time.

By proactively identifying at-risk borrowers, this agent reduces unnecessary liquidations, helping users maintain their positions while securing protocol stability.

#### **3. Risk Analysis Agent**

The Risk Analysis Agent continuously monitors system-wide risk exposure, identifying vulnerabilities across liquidity pools, collateralized positions, and external market fluctuations. It assesses:

* Liquidity stress scenarios and their potential impact on protocol solvency.
* The security of integrated assets, identifying smart contract or oracle risks.
* Asset correlation to prevent excessive exposure to volatile token pairs.

Through automated risk assessments, the agent dynamically suggests risk mitigation strategies, ensuring TrenOS remains resilient against black swan events.

#### **4. Yield Optimization Agent**

The Yield Optimization Agent ensures that liquidity providers receive the best possible returns by:

* Reallocating liquidity to the most profitable pools within the protocol.
* Identifying underutilized capital and redirecting it toward high-yield strategies.
* Implementing automated compounding to maximize long-term gains.

By continuously analyzing protocol revenue streams, this agent enhances capital efficiency and liquidity provider retention.

#### **5. Collateral Manager Agent**

The Collateral Manager Agent plays a critical role in maintaining financial health by:

* Assessing collateral quality and its liquidity profile.
* Adjusting required collateral ratios based on borrower risk profiles.
* Ensuring stablecoin overcollateralization to maintain peg stability.

This agent dynamically adjusts leverage opportunities for borrowers while securing the overall health of TrenOS' lending pools.

***

### AI Learning & Model Refinement

#### **Supervised Learning & Pattern Recognition**

Each AI agent trains on historical DeFi data, learning from past trends to predict future market movements. By analyzing vast datasets of liquidity flows, borrowing patterns, and risk exposures, these agents refine their decision-making to ensure more accurate financial optimizations.

#### **Reinforcement Learning & Strategy Evolution**

TrenOS employs reinforcement learning techniques where AI agents receive feedback loops on the effectiveness of their actions. If an interest rate adjustment successfully improves borrowing efficiency, the agent reinforces that decision pattern. Conversely, if a liquidation prediction fails, the agent revises its predictive model accordingly.

#### **Vector Databases & Memory Retention**

To enhance contextual awareness, AI agents utilize vector databases to store historical transactions, liquidation data, and past governance decisions. These databases allow:

* Long-term memory retention for improved trend analysis.
* Retrieval-Augmented Generation (RAG) to enhance real-time decision-making.
* AI agents to learn from past market events and avoid previous inefficiencies.

***

### The Future of AI Agent Specialization

As TrenOS evolves, its AI agents will become increasingly sophisticated, developing advanced financial models that further minimize risk, maximize efficiency, and enhance decentralized governance. By continuously refining their models and integrating external market intelligence, TrenOS' agents will ensure that its financial infrastructure remains adaptive, trustless, and self-improving.


# Interest Rate + Borrowing Fee Optimizer

### Overview

The Interest Rate + Borrowing Fee Optimizer AI is responsible for dynamically adjusting borrowing interest rates and fees based on real-time market conditions, liquidity depth, and stablecoin demand. It ensures efficient capital allocation, stable liquidity flows, and sustainable lending rates without relying on governance votes or manual adjustments.

By utilizing machine learning, historical risk analysis, and AI-driven optimization models, this AI agent eliminates inefficient interest rate curves that traditional DeFi lending protocols use. It continuously adapts borrowing costs to reflect market demand and supply imbalances, preventing systemic risks and ensuring a stable lending ecosystem.

***

### **Function**

The Interest Rate + Borrowing Fee Optimizer AI ensures the stability and efficiency of TrenOS’s lending markets by:

* Analyzing market conditions in real-time to adjust borrowing costs.
* Modifying borrowing fees dynamically to optimize capital efficiency.
* Preventing liquidity crises by ensuring competitive and sustainable rates.
* Eliminating manual governance decisions in setting interest rates.

#### **How It Works**

1. Monitors Real-Time Liquidity Conditions → Analyzes loan demand, borrowing capacity, and stablecoin supply.
2. Predicts Utilization Trends → Uses historical data, market trends, and risk analytics to predict borrowing demand.
3. Optimizes Borrowing Fees & Interest Rates → Adjusts rates dynamically without requiring governance intervention.
4. Executes Adjustments on Smart Contracts → Directly updates lending pools to ensure optimal market conditions.

***

### **Goals**

* Maintain Stable Borrowing Costs → Prevents extreme interest rate volatility.
* Optimize Capital Efficiency → Ensures that liquidity is used efficiently within lending markets.
* Enhance Risk Management → Reduces overleveraging and ensures sustainable borrowing activity.
* Automate Lending Operations → Eliminates governance delays and manual interest rate setting.

***

### **Decision Logic**

The Interest Rate + Borrowing Fee Optimizer AI follows a structured decision-making process:

#### **Step 1: Stablecoin Price Monitoring**

* If stablecoin price > $1.02, decrease borrowing rates to encourage stablecoin supply expansion.
* If stablecoin price < $0.98, increase borrowing rates to control excess supply.

#### **Step 2: Utilization Rate Assessment**

* If utilization > 80%, increase borrowing rates to discourage excessive demand.
* If utilization < 40%, decrease borrowing rates to incentivize borrowing.

#### **Step 3: Historical Lending & Liquidation Data Analysis**

* AI retrieves past liquidation trends, governance decisions, and risk models to refine interest rate adjustments.

#### **Step 4: Execution & Market Validation**

* Smart contracts update borrowing rates based on AI-optimized parameters.
* Market conditions are continuously monitored, and AI re-adjusts rates as necessary.

***

### **Input Data**

The AI agent requires real-time and historical data to fine-tune borrowing interest rates:

* Stablecoin Market Metrics → Real-time trading volume, peg stability, and circulating supply.
* Liquidity Pool Data → Total Value Locked (TVL), borrowing demand, and utilization rates.
* Collateral Risk Profiles → Loan-to-value (LTV) ratios and risk scoring of borrowers.
* On-Chain & Oracle Data → Market conditions from oracle feeds.
* Governance & Past Interest Rate Adjustments → Historical lending decisions to avoid inefficient adjustments.

***

### **Execution Outputs**

* Dynamic Interest Rate Updates → Direct smart contract adjustments to borrowing rates.
* Borrowing Fee Modifications → Adjusts borrowing fees dynamically to align with utilization rates.
* Stablecoin Issuance Adjustments → Ensures that borrowing demand matches stablecoin supply without depegging.
* Governance Log Updates → Maintains transparency on AI-driven rate adjustments.

***

### **Tools Used**

The Interest Rate + Borrowing Fee Optimizer AI utilizes various tools to monitor, analyze, and execute borrowing adjustments:

* API Calls → Retrieves live market data, liquidity conditions, and loan demand.
* Machine Learning Models → Predicts borrowing trends using historical data.
* Execution Engine → Automates smart contract modifications for lending markets.
* Security & Risk Alerts → Detects anomalies in interest rate adjustments.
* RAG (Retrieval-Augmented Generation) → Queries past governance and interest rate decisions to refine AI adjustments.

***

### **Security and Fail-Safes**

To prevent interest rate manipulation, excessive borrowing costs, or AI miscalculations, this AI agent includes the following security measures:

* Rate Change Limits → Prevents interest rate swings of >2% per adjustment cycle.
* Multi-Sourced Data Validation → Confirms interest rate changes from multiple oracle feeds.
* Borrowing Fee Caps → Limits how much borrowing fees can fluctuate in a short period.
* Anomaly Detection → Flags unusual borrowing activity or flash loan-based manipulations.
* Emergency Revert System → Rolls back adjustments if abnormal rate fluctuations occur.


# XY

### Overview

XY AI is responsible for dynamically managing the issuance and burning of the XY stablecoin across TrenOS’s protocol modules. It ensures that the supply of XY remains balanced, preventing excessive inflation or deflation while maintaining efficient liquidity distribution.

By autonomously adjusting debt ceilings, liquidity allocations, and stablecoin flow in response to market conditions, this AI agent eliminates the need for manual intervention, ensuring a self-regulating and efficient stablecoin management system.

***

### Function

XY AI dynamically manages the minting and burning of XY stablecoin by:

* Adjusting debt ceilings and collateral parameters to prevent overexposure to volatile assets.
* Ensuring liquidity stability by balancing stablecoin supply across different modules.
* Preventing XY depegging by controlling its issuance and market supply in real time.
* Automating liquidity distribution for lending pools, ensuring stablecoin-backed loans remain solvent.

#### How It Works

1. Monitors real-time stablecoin supply, market conditions, and collateral utilization.
2. Adjusts issuance and burning rates dynamically based on demand fluctuations.
3. Ensures that stablecoin minting does not outpace available collateral, preventing devaluation.
4. Updates smart contracts to modify debt ceilings and liquidity allocations accordingly.

***

### Goals

* Maintain stablecoin peg stability to prevent excessive expansion or contraction of the XY stablecoin supply.
* Optimize liquidity utilization by ensuring that XY is allocated efficiently across DeFi markets.
* Prevent market manipulation by mitigating risks from arbitrage traders and speculative attacks.
* Enhance protocol sustainability by supporting long-term solvency through efficient collateral management.

***

### Decision Logic

#### Step 1: Stablecoin Price Monitoring

* If XY price is above $1.02, increase stablecoin issuance to rebalance supply.
* If XY price is below $0.98, reduce issuance or trigger burning mechanisms.

#### Step 2: Collateral Utilization Check

* If collateralization ratio is below safety threshold, reduce stablecoin supply.
* If collateralization ratio is above target level, allow stablecoin expansion.

#### Step 3: Liquidity Flow & Borrowing Demand Analysis

* If lending pools have excess liquidity, reduce XY issuance to avoid oversupply.
* If liquidity is low, adjust stablecoin allocations to ensure proper market function.

#### Step 4: Historical Data Querying

* AI reviews past governance decisions on stablecoin management.
* Past liquidity crises and solutions are referenced to refine future decisions.

#### Step 5: Execution

* Smart contracts are updated to mint or burn XY stablecoin based on optimization models.

***

### Input Data

XY AI relies on real-time and historical data sources to ensure accuracy:

* Stablecoin market metrics including trading volume, price deviations, and supply-demand curves.
* Collateral data including current reserves, historical liquidation trends, and collateral health ratios.
* Liquidity pool insights such as borrowing activity, lending reserves, and user demand.
* Risk indicators including whale movements, arbitrage activity, and potential depeg risks.
* Governance records such as historical voting outcomes on stablecoin issuance policies.

***

### Execution Outputs

* Stablecoin issuance adjustments through smart contract updates based on market conditions.
* Debt ceiling modifications to optimize solvency and liquidity distribution.
* Liquidity reallocations ensuring XY is properly distributed across pools and markets.
* Governance log updates documenting AI-driven decisions for transparency and audits.

***

### Tools Used

XY AI integrates various tools for decision-making, execution, and risk mitigation:

* API calls to monitor stablecoin trading volumes, peg deviations, and liquidity conditions.
* On-chain calculations to evaluate collateral backing, TVL, and supply-side metrics.
* Execution engine to adjust smart contract parameters for stablecoin issuance and burning.
* Governance and market sentiment analysis to retrieve past voting records and policy decisions.
* Security alerts to monitor stablecoin attacks, arbitrage risks, and liquidity imbalances.
* RAG (Retrieval-Augmented Generation) to query historical governance policies and liquidity decisions.

***

### Security and Fail-Safes

To prevent market manipulation, runaway inflation, or unintended depegging, XY AI employs the following safeguards:

* Issuance rate caps to limit the amount of XY that can be minted per block, preventing excessive expansion.
* Multi-layered data validation requiring multiple price oracles to confirm stablecoin peg deviations before triggering mint/burn actions.
* Liquidity guardrails ensuring XY supply does not exceed predefined thresholds that could destabilize lending pools.
* Security threat detection actively monitoring for flash loan exploits, arbitrage abuse, and governance attacks.
* Emergency circuit breaker halting stablecoin issuance if abnormal activity is detected, requiring governance intervention.


# Asset Risk

### Overview

Asset Risk AI is responsible for continuously assessing the risk levels of collateral assets within TrenOS’s ecosystem. By analyzing liquidity depth, volatility, historical risk trends, and external risk assessments, this AI agent ensures that only secure and stable assets are supported within the protocol.

This AI agent eliminates the need for human-based risk evaluations, providing real-time risk scoring, collateral adjustments, and asset onboarding decisions. It ensures the protocol remains resilient against bad debt accumulation, flash loan exploits, and liquidity crises.

***

### Function

Asset Risk AI evaluates the security and viability of assets used as collateral by:

* Conducting real-time risk scoring for each collateral asset based on liquidity, volatility, and security parameters.
* Dynamically adjusting loan-to-value (LTV) ratios and liquidation thresholds based on changing risk profiles.
* Assessing whether new assets meet risk requirements for inclusion or if existing assets need delisting.
* Detecting smart contract vulnerabilities, governance attacks, and flash loan threats that could impact asset safety.

#### How It Works

1. Analyzes liquidity conditions, market depth, and price volatility for each collateral asset.
2. Assesses security risks by scanning smart contracts, oracle reliability, and asset history.
3. Adjusts risk parameters, including LTV ratios and liquidation buffers, based on real-time data.
4. Updates risk classifications and governance reports to reflect changing asset security levels.

***

### Goals

* Ensure protocol safety by preventing high-risk assets from being used as collateral.
* Improve capital efficiency by dynamically adjusting collateral requirements based on risk profiles.
* Mitigate market volatility risks by preventing exposure to highly volatile or illiquid assets.
* Automate risk governance by eliminating reliance on manual risk assessment teams.

***

### Decision Logic

#### Step 1: Real-Time Market & Price Analysis

* If an asset’s volatility exceeds 50% over 24 hours, increase collateral requirements.
* If an asset’s liquidity depth falls below a critical threshold, reduce borrowing limits.

#### Step 2: Security & Smart Contract Risk Evaluation

* If an asset is flagged in a security report (Immunefi, Forta, or audit alerts), it is placed under review.
* If a smart contract update introduces new risks, borrowing is restricted until further analysis.

#### Step 3: Historical Liquidation & Risk Data Analysis

* AI retrieves past liquidation events and governance risk reports to refine risk modeling.
* If an asset has been historically associated with high default rates, it is reassessed.

#### Step 4: Execution

* Adjusts collateral parameters in smart contracts.
* Generates risk alerts and governance updates.

***

### Input Data

Asset Risk AI relies on multiple sources of real-time and historical data to assess risk effectively:

* Price & volatility metrics including asset price fluctuations, trading volume, and market depth.
* Liquidity & TVL data to track capital flow and lending pool exposure.
* On-chain risk indicators such as large asset movements, flash loan activity, and contract interactions.
* Security & exploit reports from external audits and security platforms.
* Historical liquidation records to assess past risk performance and adjust future risk models.

***

### Execution Outputs

* Collateral ratio updates to dynamically adjust LTV based on risk scores.
* Delisting or listing of assets based on automated risk evaluations.
* Borrowing limit modifications to prevent overexposure to high-risk assets.
* Security alerts flagging assets showing signs of manipulation, high volatility, or liquidity crises.
* Governance log updates to provide full transparency on AI-driven risk assessments.

***

### Tools Used

Asset Risk AI integrates various tools to monitor, assess, and execute risk mitigation strategies:

* API calls to fetch real-time asset pricing, trading volume, and liquidity depth.
* Smart contract risk scanners to detect vulnerabilities and governance risks.
* Historical risk analysis engines to compare current asset trends with past liquidation events.
* Execution engine to update LTV ratios, borrowing caps, and risk classifications.
* Governance risk alerts to flag potential threats and provide proactive responses.
* RAG (Retrieval-Augmented Generation) to analyze past governance reports and liquidation records.

***

### Security and Fail-Safes

To prevent market manipulation, incorrect risk assessments, or systemic failures, Asset Risk AI implements multiple security layers:

* Multi-source data validation to cross-check risk scores across multiple oracle feeds and security reports.
* Risk-based borrowing limits to prevent excessive leverage on high-volatility assets.
* Emergency lock mechanisms that suspend borrowing on assets flagged as high-risk.
* AI-driven historical risk memory to prevent reintroduction of previously delisted assets.
* Governance fallback requiring human intervention for extreme risk scenarios.


# Gauge

### Overview

Gauge AI is responsible for dynamically adjusting incentive allocations across TrenOS’s liquidity pools. By analyzing market conditions, liquidity depth, and user participation, this AI agent ensures that rewards are distributed efficiently to maximize capital efficiency, attract liquidity providers, and prevent incentive misallocations.

By automating gauge weight distributions and optimizing reward flows, Gauge AI eliminates the need for governance-based manual adjustments, making TrenOS’s liquidity incentive framework more responsive and adaptive to market fluctuations.

***

### Function

Gauge AI maintains an efficient and fair liquidity rewards system by:

* Attracting liquidity to underfunded pools while preventing over-rewarding saturated pools.
* Dynamically balancing incentive weights based on real-time market demand.
* Mitigating farming inefficiencies by preventing reward dilution and excessive emissions.
* Preventing vote manipulation by detecting governance attacks related to gauge weight voting.

#### How It Works

1. Monitors liquidity conditions and usage rates across all pools.
2. Evaluates trading volume, market participation, and past reward distributions.
3. Adjusts gauge weights dynamically based on market fluctuations.
4. Prevents reward manipulation and gaming attacks through security filters.
5. Executes smart contract updates to optimize incentive allocation.

***

### Goals

* Optimize reward allocation to drive sustainable liquidity growth.
* Prevent inefficient reward distributions that lead to farm-and-dump behavior.
* Enhance protocol stability by ensuring balanced liquidity provisioning.
* Automate gauge adjustments to remove reliance on manual governance updates.

***

### Decision Logic

#### Step 1: Liquidity Depth & Utilization Check

* If a pool’s liquidity utilization exceeds 90%, increase incentives to attract more deposits.
* If utilization falls below 40%, reduce rewards to optimize emissions.

#### Step 2: TVL & Trading Volume Analysis

* If a pool has high trading volume but low liquidity, increase incentives.
* If a pool has low trading volume but high liquidity, reduce rewards.

#### Step 3: Historical Reward Distribution Review

* AI analyzes past reward allocations and governance voting outcomes.
* Adjustments align with previous incentive strategies to maintain consistency.

#### Step 4: Security & Anti-Manipulation Filters

* If governance voting shows irregular activity, prevent abnormal weight shifts.
* If a pool is being farmed in an exploitative manner, temporarily restrict new rewards.

#### Step 5: Execution

* Smart contracts are updated to reflect optimized gauge weights and reward flows.

***

### Input Data

Gauge AI relies on multiple sources of real-time and historical data to optimize rewards effectively:

* Liquidity pool metrics, including TVL, liquidity depth, and utilization rates.
* Trading volume data from daily and weekly activity across pools.
* Historical reward allocations and past gauge weight distributions.
* Governance and voting records, tracking community decisions on incentive structures.
* Risk indicators such as flash loan activity, reward farming behavior, and governance exploits.

***

### Execution Outputs

* Gauge weight updates via smart contract adjustments to optimize incentive allocations.
* Reward distribution changes based on AI-driven emissions reallocation.
* Liquidity strategy reports providing governance logs of AI-driven reward optimizations.
* Security alerts and governance safeguards preventing manipulation attempts.

***

### Tools Used

Gauge AI leverages various tools to monitor, analyze, and execute reward optimizations:

* API calls to fetch real-time TVL, user activity, and liquidity depth.
* On-chain data retrieval to monitor historical reward allocations and pool performance.
* Execution engine to adjust gauge weights and reward distributions in smart contracts.
* Market sentiment and governance analysis to track voting patterns and liquidity provider behaviors.
* Security and risk alerts to identify reward distribution anomalies and potential gaming attacks.
* RAG (Retrieval-Augmented Generation) to analyze past governance decisions on gauge weight adjustments.

***

### Security and Fail-Safes

To prevent manipulation, inefficient rewards, or excessive emissions, Gauge AI implements strict security measures:

* Incentive adjustment limits preventing drastic changes to gauge weights within a short period.
* Multi-source validation requiring consensus from TVL, trading volume, and governance records before adjusting weights.
* Governance protection mechanisms detecting vote farming attacks that could skew incentive distributions.
* Emergency reward freeze to temporarily disable rewards for pools showing signs of manipulation.
* Self-learning optimization to refine AI strategies over time based on past incentive performance.


# User Interaction

### Overview

User Interaction AI serves as the primary interface between TrenOS and its users, providing a seamless, intelligent, and automated experience for borrowing, lending, governance participation, and risk assessment. This AI agent enhances user engagement by simplifying complex DeFi interactions, offering real-time financial insights, and automating user transactions.

By enabling a conversational interface, automated decision assistance, and personalized risk management, User Interaction AI reduces barriers to entry for DeFi users, making protocol interactions more intuitive and efficient.

***

### Function

User Interaction AI enhances the user experience by:

* Providing real-time DeFi insights, including interest rates, liquidity conditions, and governance proposals.
* Assisting users in executing transactions such as borrowing, lending, and staking.
* Offering personalized risk alerts on liquidation threats, governance changes, and security risks.
* Automating governance participation by suggesting optimal voting strategies based on historical trends.
* Simplifying smart contract interactions by converting technical commands into natural language queries.

#### How It Works

1. Processes user queries and understands intent through natural language processing.
2. Retrieves relevant data from TrenOS, including risk assessments, liquidity levels, and governance votes.
3. Provides recommendations for borrowing, lending, or governance participation.
4. Executes transactions securely upon user confirmation.
5. Monitors market conditions and proactively notifies users of risks and opportunities.

***

### Goals

* Improve user accessibility by lowering technical barriers to DeFi interactions.
* Enhance security by providing real-time risk alerts and safe transaction execution.
* Increase protocol engagement by encouraging governance participation and liquidity provision.
* Enable proactive decision-making by offering AI-driven financial recommendations.

***

### Decision Logic

#### Step 1: User Query Processing

* AI interprets user intent, whether related to lending, borrowing, staking, or governance.
* Context-aware NLP refines responses based on user history and protocol conditions.

#### Step 2: Data Retrieval & Contextual Analysis

* If a user asks about liquidation risk, AI retrieves collateral health and borrowing conditions.
* If a user wants to borrow, AI suggests optimal borrowing rates based on real-time market data.

#### Step 3: Execution & Smart Contract Interaction

* AI assists in confirming borrowing or lending actions before executing transactions.
* Governance interactions are automated based on proposal tracking and voting recommendations.

#### Step 4: Security & Risk Alerts

* If AI detects irregular governance votes or high-risk transactions, it alerts users.
* If liquidation risk is detected, AI provides preventive strategies such as collateral adjustments.

#### Step 5: Final Response & Action Confirmation

* AI confirms transaction outcomes or governance participation, ensuring a seamless user experience.

***

### Input Data

User Interaction AI relies on multiple sources of real-time and historical data to provide accurate responses and transaction recommendations:

* Lending & borrowing metrics, including real-time interest rates, collateral ratios, and utilization rates.
* User portfolio data, including borrowed assets, staked funds, and pending governance votes.
* Governance & proposal records, tracking live governance votes and past proposal outcomes.
* Market & risk indicators, monitoring price fluctuations, liquidity depth, and liquidation thresholds.
* Security & exploit reports, detecting governance attack risks and protocol vulnerabilities.

***

### Execution Outputs

* User query responses providing AI-driven, natural language explanations for DeFi-related questions.
* Transaction execution assistance for borrowing, lending, staking, and governance voting.
* Risk & security alerts notifying users of liquidation risks, governance changes, and exploit warnings.
* Personalized user dashboards summarizing portfolio health and DeFi opportunities.

***

### Tools Used

User Interaction AI integrates various tools to ensure a seamless, efficient, and secure user experience:

* Natural language processing (NLP) engine allowing users to interact with TrenOS in conversational format.
* API calls fetching real-time interest rates, TVL, collateral ratios, and governance votes.
* Execution engine enabling AI-assisted transactions for lending, borrowing, and staking.
* On-chain querying retrieving user balances, collateral status, and market trends.
* Security & risk alerts monitoring suspicious activity and transaction vulnerabilities.
* RAG (Retrieval-Augmented Generation) analyzing past governance votes and lending decisions to enhance AI responses.

***

### Security and Fail-Safes

To ensure safe and accurate AI-assisted user interactions, User Interaction AI implements multiple security layers:

* On-chain data validation verifying transaction details before execution.
* Transaction confirmation prompts requiring explicit user approval before AI-initiated actions.
* Governance protection mechanisms preventing unauthorized governance vote manipulation.
* Anomaly detection & security alerts warning users of suspicious transactions or governance exploits.
* AI model self-improvement refining response accuracy through continuous learning.


# Market Sentiment

### Overview

Market Sentiment AI is designed to analyze on-chain and off-chain sentiment indicators to provide real-time market insights and predictive analytics for TrenOS. By assessing trader sentiment, news events, social media trends, and liquidity shifts, this AI agent helps optimize risk management, lending strategies, and governance decisions.

Market Sentiment AI ensures that TrenOS adapts to macroeconomic trends, market volatility, and social sentiment, reducing exposure to sudden market downturns while enhancing trading and governance strategies.

***

### Function

Market Sentiment AI enhances TrenOS’s ability to make data-driven financial and governance decisions by:

* Detecting market sentiment shifts to identify early signs of market downturns or bullish trends.
* Predicting market volatility using historical sentiment patterns and liquidity trends.
* Adjusting lending and risk parameters based on sentiment-driven trading behaviors.
* Providing governance insights by summarizing community discussions and proposal trends.
* Preventing panic liquidations by recognizing fear-based market movements and adjusting risk parameters accordingly.

#### How It Works

1. Aggregates sentiment data from on-chain activity, social media, news events, and governance discussions.
2. Analyzes historical sentiment trends to predict price movements and market shifts.
3. Adjusts protocol parameters, including interest rates and collateral requirements, based on real-time sentiment analysis.
4. Updates governance records with AI-driven recommendations for risk mitigation and strategy improvements.

***

### Goals

* Optimize lending market stability by preventing mass liquidations driven by sentiment-based volatility.
* Enhance risk mitigation strategies through proactive adjustments to collateral ratios and borrowing limits.
* Improve governance awareness by providing real-time sentiment reports for governance participants.
* Detect market manipulation efforts and mitigate governance voting irregularities.

***

### Decision Logic

#### Step 1: Sentiment Data Collection

* Aggregates social media trends, financial news sentiment, and trading behaviors.
* Detects sentiment polarity shifts (bullish, neutral, bearish) and market reaction patterns.

#### Step 2: Historical Sentiment Comparison

* Retrieves past market sentiment trends and compares them with real-time conditions.
* Identifies similarities to previous market cycles and liquidity crises.

#### Step 3: Risk Adjustment & Lending Policy Updates

* If sentiment turns bearish, increase collateral ratios and tighten borrowing limits.
* If sentiment turns bullish, adjust incentives to attract liquidity and promote lending.

#### Step 4: Governance & Proposal Impact Analysis

* Tracks discussions and voting trends for early insights into proposal outcomes.
* Identifies potential governance manipulation attempts or social-engineered votes.

#### Step 5: Execution

* Deploys AI-driven updates to risk parameters, lending incentives, and governance recommendations.

***

### Input Data

Market Sentiment AI relies on multiple data sources to analyze sentiment and risk exposure effectively:

* Social media trends from X (Twitter), Telegram, Discord sentiment.
* Financial news & reports analyzing macroeconomic events and regulatory updates.
* On-chain activity including whale transactions, lending activity, and liquidation events.
* Governance data tracking DAO discussions, proposal sentiment, and community voting trends.
* Historical sentiment records for comparison of past market downturns and recoveries.

***

### Execution Outputs

* Sentiment-based risk adjustments modifying lending, borrowing, and liquidation mechanisms.
* Governance sentiment reports providing AI-generated insights on community discussions.
* Market risk warnings alerting for liquidity risks, liquidation threats, and governance manipulation.
* Liquidity incentive adjustments optimizing borrowing rates and stablecoin incentives based on sentiment analysis.

***

### Tools Used

Market Sentiment AI integrates various tools to analyze and act on market sentiment:

* API calls to retrieve social sentiment data, market news, and governance discussions.
* On-chain data monitoring for liquidity movements, liquidation trends, and trader behaviors.
* Sentiment analysis models to process and interpret sentiment polarity shifts.
* Execution engine to adjust lending, collateral, and governance risk parameters.
* RAG (Retrieval-Augmented Generation) to compare past market sentiment and risk adjustments.

***

### Security and Fail-Safes

To prevent sentiment-based manipulation, misinformation-driven decisions, or market panic, Market Sentiment AI implements multiple security measures:

* Multi-source sentiment validation ensuring AI decisions are based on aggregated data from multiple platforms.
* Anomaly detection algorithms flagging potential sentiment manipulation from bot-driven narratives.
* Governance manipulation safeguards detecting social-engineered proposals and voting influence campaigns.
* Rate change limitations preventing extreme lending or borrowing adjustments due to temporary sentiment spikes.
* Emergency sentiment override allowing governance intervention in extreme market fear scenarios.


# Yield Optimization

### Overview

Yield Optimization AI is responsible for dynamically allocating capital and optimizing returns across TrenOS’s lending and liquidity pools. By analyzing real-time market conditions, asset utilization rates, and reward structures, this AI agent ensures that capital is distributed efficiently to maximize yield while maintaining protocol stability.

By automating liquidity rebalancing, reward allocation, and capital deployment, Yield Optimization AI enhances DeFi yield strategies, reduces inefficiencies, and prevents misallocation of incentives.

***

### Function

Yield Optimization AI improves capital efficiency and maximizes returns by:

* Identifying the most profitable pools for capital allocation based on risk-adjusted returns.
* Adjusting liquidity incentives dynamically to attract liquidity providers where needed.
* Preventing yield dilution by optimizing staking and liquidity rewards distribution.
* Enhancing capital efficiency by ensuring funds are allocated to the highest-performing assets.
* Automating liquidity migration strategies to maximize stablecoin lending profits.

#### How It Works

1. Scans interest rates, liquidity incentives, and staking rewards across all TrenOS pools.
2. Analyzes real-time asset utilization rates and capital flows.
3. Adjusts capital distribution dynamically to maximize yield while ensuring liquidity stability.
4. Optimizes reward allocation to prevent overspending on unnecessary incentives.
5. Updates governance reports with AI-driven yield insights and efficiency improvements.

***

### Goals

* Increase capital efficiency by ensuring optimal asset allocation across lending pools.
* Maximize liquidity provider rewards without excessive emissions.
* Prevent underutilization of capital and yield dilution.
* Optimize staking rewards and gauge weights to maintain balanced liquidity across pools.
* Ensure sustainable yield generation by avoiding unsustainable incentive structures.

***

### Decision Logic

#### Step 1: Liquidity Utilization & Capital Flow Analysis

* Identifies pools with excess or insufficient liquidity.
* If utilization is below target, increases incentives to attract deposits.
* If utilization is high, reduces incentives to optimize emissions.

#### Step 2: Reward & Interest Rate Optimization

* Adjusts lending rates based on supply and demand dynamics.
* Balances incentives to avoid over-rewarding or underfunding specific pools.

#### Step 3: Historical Yield Performance Analysis

* Reviews past capital allocation and return-on-investment trends.
* Refines AI models to improve future capital reallocation decisions.

#### Step 4: Execution & Governance Updates

* Deploys capital and adjusts incentives via smart contracts.
* Updates governance logs with AI-driven yield optimizations.

***

### Input Data

Yield Optimization AI relies on multiple real-time and historical data sources to optimize capital efficiency:

* Lending pool metrics including utilization rates, borrowing demand, and TVL.
* Liquidity incentive structures tracking current emissions and staking rewards.
* Historical yield performance assessing past incentive efficiency.
* Governance records analyzing past reward allocations and capital distributions.
* Risk indicators monitoring liquidity provider activity and potential yield farming exploits.

***

### Execution Outputs

* Dynamic capital allocation ensuring funds are deployed efficiently.
* Liquidity incentive adjustments optimizing staking and rewards distribution.
* Yield strategy reports documenting AI-driven optimizations.
* Smart contract updates rebalancing liquidity across pools.
* Governance transparency logs recording yield allocation decisions.

***

### Tools Used

Yield Optimization AI integrates various tools to monitor, analyze, and execute yield strategies:

* API calls fetching real-time lending rates, liquidity incentives, and capital utilization.
* On-chain data retrieval tracking reward distributions and borrowing activity.
* Optimization models analyzing the most efficient yield allocation strategies.
* Execution engine deploying capital adjustments via smart contracts.
* RAG (Retrieval-Augmented Generation) analyzing past governance and reward allocation data to refine AI-driven yield optimizations.

***

### Security and Fail-Safes

To prevent capital misallocation, over-incentivization, or exploitation, Yield Optimization AI employs multiple security measures:

* Incentive adjustment limits preventing excessive emissions in low-utilization pools.
* Multi-source validation ensuring capital allocations align with real-time market conditions.
* Governance approval thresholds preventing AI-driven yield adjustments from exceeding predefined limits.
* Fraud detection algorithms identifying potential farming attacks or incentive manipulation.
* Emergency override systems allowing governance intervention if AI-driven changes create unsustainable yield structures.


# Proof of Liquidity

### Overview

Proof of Liquidity AI ensures that liquidity providers (LPs) have verifiable proof of their capital contributions to TrenOS. This AI agent enhances security, transparency, and efficiency by allowing users to track their liquidity allocations while preventing fraudulent activities such as double-counting liquidity or fake deposits.

Proof of Liquidity AI establishes a decentralized verification framework, ensuring that all liquidity positions are cryptographically provable and publicly auditable. This strengthens user trust, improves risk management, and creates a more reliable capital distribution system within TrenOS.

***

### Function

Proof of Liquidity AI ensures liquidity verification and tracking by:

* Tracking and verifying deposits to ensure that each liquidity provider’s stake is fully recorded and transparent.
* Preventing liquidity fraud by mitigating risks such as fake liquidity, duplicate deposits, and sybil attacks.
* Automating LP token issuance to represent each user’s liquidity stake.
* Enhancing transparency by providing real-time proof of liquidity across DeFi platforms.
* Optimizing capital efficiency by ensuring liquidity is correctly allocated and efficiently utilized.

#### How It Works

1. Monitors real-time liquidity deposits and withdrawals across all pools.
2. Tracks LP token issuance and redemption to prevent manipulation.
3. Verifies liquidity movements to prevent double-counting or liquidity spoofing.
4. Updates governance and risk models based on liquidity provider behaviors.

***

### Goals

* Ensure transparent liquidity tracking by providing cryptographic proof of all liquidity provider deposits.
* Enhance protocol security by preventing liquidity fraud and manipulation.
* Optimize capital allocation by ensuring liquidity is efficiently distributed across pools.
* Increase trust and auditability by allowing LPs and governance participants to verify liquidity records in real time.
* Strengthen liquidity provider incentives by ensuring LPs are rewarded fairly based on their provable contributions.

***

### Decision Logic

#### Step 1: Liquidity Deposit Verification

* Confirms whether deposits originate from legitimate wallets.
* Cross-checks liquidity contributions against on-chain records.

#### Step 2: Historical Proof Comparison

* Retrieves past liquidity deposit data to prevent anomalies.
* Ensures liquidity contributions align with historical patterns.

#### Step 3: Fraud & Anomaly Detection

* Identifies irregular LP behaviors such as sudden liquidity withdrawals before incentives are distributed.
* Detects potential wash trading or self-referential liquidity schemes.

#### Step 4: LP Token Issuance & Tracking

* Smart contracts issue LP tokens proportional to liquidity staked.
* AI tracks LP token transfers and ensures they are properly redeemed.

#### Step 5: Final Execution & Reporting

* Updates on-chain liquidity records.
* Provides governance with AI-driven transparency reports on liquidity verification outcomes.

***

### Input Data

Proof of Liquidity AI requires real-time and historical data to validate and track liquidity positions:

* On-chain deposit & withdrawal data tracking user contributions and liquidity movements.
* Liquidity pool metrics, including total liquidity supplied, withdrawals, and reward distributions.
* Trading volume & utilization rates to detect liquidity manipulation.
* Governance & treasury records monitoring incentives and LP token distribution.
* Security & risk monitoring identifying potential exploit risks related to liquidity.

***

### Execution Outputs

* On-chain proof of liquidity records verifying all liquidity contributions.
* LP token distribution updates ensuring liquidity providers receive the correct LP tokens.
* Fraud detection alerts flagging suspicious liquidity activity for governance review.
* Liquidity optimization reports providing AI-driven insights into capital efficiency and pool utilization.
* Governance transparency logs documenting AI-driven liquidity verification decisions.

***

### Tools Used

Proof of Liquidity AI integrates various tools to validate and verify liquidity contributions:

* API calls retrieving on-chain liquidity deposit and withdrawal records.
* Smart contract validation ensuring all liquidity positions are accounted for.
* Execution engine updating proof of liquidity records and distributing LP tokens.
* Risk & anomaly detection identifying fraudulent activity in liquidity transactions.
* RAG (Retrieval-Augmented Generation) analyzing past liquidity deposit trends to improve fraud detection.

***

### Security and Fail-Safes

To prevent liquidity fraud, sybil attacks, and inaccurate LP accounting, Proof of Liquidity AI employs multiple security measures:

* Multi-signature verification requiring multiple validators to confirm large liquidity contributions.
* Anomaly detection algorithms identifying suspicious liquidity fluctuations or front-running behaviors.
* Rate-limited deposits & withdrawals preventing liquidity wash-trading or instant withdrawal scams.
* LP token validation & lock mechanisms ensuring LP tokens can only be redeemed against verified deposits.
* Governance-based escalation triggering governance review before significant liquidity shifts.


# Collateral Manager

### Overview

Collateral Manager AI is responsible for dynamically managing collateralized assets within TrenOS to ensure protocol stability, optimal capital efficiency, and risk mitigation. By monitoring collateral utilization, adjusting loan-to-value (LTV) ratios, and optimizing asset distribution, this AI agent enhances the security and efficiency of lending markets.

By automating risk adjustments, collateral rebalancing, and liquidation prevention, Collateral Manager AI reduces inefficiencies and enhances capital utilization across TrenOS lending pools.

***

### Function

Collateral Manager AI ensures lending security and capital efficiency by:

* Monitoring real-time collateral utilization and loan health factors.
* Adjusting LTV ratios dynamically to reflect changing market conditions.
* Optimizing collateral distribution to prevent concentration risk and underutilization.
* Enhancing risk management by working alongside Asset Risk AI and Liquidation Prediction AI.
* Reducing forced liquidations by implementing preventive collateral adjustments.

#### How It Works

1. Scans collateral health metrics and borrower risk exposure.
2. Analyzes historical default trends and liquidity conditions.
3. Dynamically adjusts LTV ratios and borrowing limits based on risk assessments.
4. Implements collateral rebalancing strategies to prevent systemic risks.
5. Updates governance records with AI-driven risk assessments and collateral adjustments.

***

### Goals

* Ensure sustainable collateralization levels for borrowers and liquidity providers.
* Prevent overleveraging by dynamically adjusting LTV ratios based on real-time risks.
* Optimize capital allocation by redistributing collateral efficiently across lending pools.
* Minimize forced liquidations through early risk intervention strategies.
* Strengthen risk governance by automating collateral-based decision-making.

***

### Decision Logic

#### Step 1: Borrower Collateral Health Analysis

* Tracks collateralization ratios and liquidation risk levels.
* If collateral health deteriorates, assesses necessary preventive actions.

#### Step 2: Market & Price Volatility Assessment

* Monitors asset price fluctuations to evaluate potential collateral devaluation.
* If an asset’s price drops sharply, AI recalculates borrowing risks and adjusts LTV ratios.

#### Step 3: Historical Risk & Liquidation Data Review

* Compares current collateral conditions with past liquidation events.
* Learns from historical data to refine risk assessment and decision-making.

#### Step 4: Execution & Risk Adjustments

* Updates LTV ratios, borrowing limits, or collateral buffers as needed.
* Redistributes collateral across lending pools if concentration risk is detected.
* Notifies governance and borrowers of upcoming risk adjustments.

***

### Input Data

Collateral Manager AI relies on multiple data sources to optimize collateral policies:

* Borrower position data, including collateral type, loan size, and LTV ratio.
* Market volatility metrics tracking asset price movements and liquidity depth.
* Historical liquidation records assessing past default patterns and risk levels.
* Lending pool data monitoring capital reserves, utilization rates, and borrowing demand.
* Governance risk policies outlining acceptable collateral adjustments and intervention strategies.

***

### Execution Outputs

* LTV ratio adjustments dynamically modifying borrowing conditions.
* Collateral reallocation optimizing distribution across lending pools.
* Liquidation risk mitigation strategies preventing mass liquidations.
* Governance risk reports documenting AI-driven collateral policy changes.
* Smart contract updates applying risk-based modifications to lending pools.

***

### Tools Used

Collateral Manager AI integrates various tools to monitor, analyze, and optimize collateral management:

* API calls fetching real-time price feeds, market depth, and collateral metrics.
* On-chain data monitoring borrower collateral movements and risk exposure.
* Machine learning models predicting collateral risk and liquidation probabilities.
* Execution engine automating collateral-based smart contract updates.
* RAG (Retrieval-Augmented Generation) analyzing past governance and risk adjustments to refine AI-driven decision-making.

***

### Security and Fail-Safes

To prevent collateral mismanagement, overleveraging, or forced liquidations, Collateral Manager AI employs multiple security measures:

* Multi-source data validation ensuring collateral risk assessments align with market conditions.
* Rate-limited LTV adjustments preventing drastic borrowing condition changes in a short period.
* Governance approval thresholds restricting AI-driven collateral changes beyond predefined limits.
* Risk anomaly detection identifying potential borrower manipulation or collateral concentration risks.
* Emergency override mechanisms allowing governance intervention in extreme market stress scenarios.


# Liquidation Prediction

### Overview

Liquidation Prediction AI is responsible for forecasting potential liquidations in TrenOS’s lending markets. By analyzing borrower positions, market volatility, collateral movements, and historical liquidation trends, this AI agent proactively identifies high-risk positions and suggests adjustments before liquidations occur.

This AI ensures that users can better manage their loans, reduces liquidation risks across the protocol, and prevents cascading liquidations that could destabilize liquidity pools.

***

### Function

Liquidation Prediction AI enhances protocol security and lending efficiency by:

* Predicting liquidation risk based on borrower collateral ratios and market volatility.
* Providing early liquidation warnings to borrowers and governance stakeholders.
* Adjusting liquidation thresholds dynamically to prevent excessive forced liquidations.
* Enhancing capital efficiency by ensuring that loan-to-value (LTV) ratios reflect current risk conditions.
* Assisting risk mitigation strategies by working in tandem with Asset Risk AI and Market Sentiment AI.

#### How It Works

1. Monitors borrower positions, collateral prices, and overall lending pool health.
2. Analyzes liquidation trends using historical data and real-time market conditions.
3. Flags at-risk positions and sends early liquidation alerts to affected borrowers.
4. Recommends dynamic adjustments to collateral requirements and LTV ratios.
5. Updates governance reports with AI-driven liquidation forecasts and risk analysis.

***

### Goals

* Minimize liquidations by allowing borrowers to take preventative action.
* Prevent liquidation cascades that could drain liquidity pools.
* Optimize collateral risk assessment by refining liquidation probability models.
* Improve protocol stability through predictive liquidation monitoring.
* Enhance governance transparency by providing liquidation risk analytics.

***

### Decision Logic

#### Step 1: Borrower Position Monitoring

* Tracks real-time collateral ratios and borrowed positions.
* Monitors loan utilization and debt-to-collateral ratios.

#### Step 2: Market Volatility & Price Impact Analysis

* Assesses market trends to identify sudden price fluctuations.
* If an asset’s price drops significantly, AI evaluates its impact on collateralized loans.

#### Step 3: Historical Liquidation Pattern Analysis

* Compares current conditions with past liquidation events to forecast potential risks.
* Uses reinforcement learning to refine liquidation prediction accuracy.

#### Step 4: Borrower Notification & Protocol Adjustments

* Sends liquidation risk alerts to at-risk borrowers.
* Adjusts LTV ratios and liquidation buffers based on predicted liquidation volumes.

#### Step 5: Execution & Reporting

* Smart contracts execute preventive risk adjustments when necessary.
* Governance logs update with AI-driven liquidation forecasts and recommendations.

***

### Input Data

Liquidation Prediction AI relies on multiple data sources to assess liquidation risks:

* Borrower position data including collateral type, loan size, and health factor.
* Market volatility indicators monitoring asset price fluctuations and liquidity levels.
* Historical liquidation records analyzing past borrower defaults and risk patterns.
* Lending pool data tracking capital reserves, utilization rates, and liquidation buffers.
* Governance risk records documenting past LTV adjustments and protocol-wide liquidations.

***

### Execution Outputs

* Liquidation risk alerts warning borrowers of potential liquidations.
* Loan-to-value (LTV) ratio updates dynamically adjusting borrowing conditions.
* Governance liquidation reports documenting risk trends and predictive insights.
* Smart contract modifications applying risk mitigation adjustments to lending pools.
* Market stability optimizations ensuring liquidations do not create excessive sell pressure.

***

### Tools Used

Liquidation Prediction AI integrates various tools to monitor, analyze, and execute risk mitigation strategies:

* API calls fetching real-time price feeds, lending pool utilization, and collateral health.
* On-chain data monitoring tracking borrower loan activity and liquidation history.
* Machine learning risk models predicting borrower defaults and forced liquidations.
* Execution engine automating liquidation risk alerts and smart contract adjustments.
* RAG (Retrieval-Augmented Generation) retrieving past liquidation data to improve forecasting accuracy.

***

### Security and Fail-Safes

To ensure liquidation accuracy and prevent unnecessary forced liquidations, Liquidation Prediction AI employs multiple security layers:

* Multi-source data validation cross-checking collateral values with multiple price oracles.
* Borrower warning thresholds providing ample notification time before liquidation events.
* Rate-limited liquidation adjustments ensuring LTV ratio changes are gradual.
* Governance override mechanisms allowing emergency protocol intervention if liquidation risks spike.
* AI learning models continuously improving risk assessment based on historical performance.


# Ecosystem

### Overview

Ecosystem AI serves as the multi-agent coordination layer within TrenOS, ensuring that all AI agents operate efficiently, communicate seamlessly, and execute decisions in alignment with protocol sustainability. It acts as the orchestration layer, managing interactions between AI agents responsible for lending, risk assessment, governance, market sentiment analysis, and liquidity incentives.

By synchronizing decision-making across different AI agents, Ecosystem AI prevents conflicts, enhances capital efficiency, and ensures that TrenOS remains adaptive to changing market conditions.

***

### Function

Ecosystem AI manages and optimizes protocol-wide AI interactions by:

* Coordinating real-time decision-making between multiple AI agents.
* Resolving conflicts when different AI models provide competing recommendations.
* Enforcing capital efficiency by balancing risk, lending, liquidity incentives, and governance.
* Implementing continuous learning by monitoring AI agent performance and refining decision frameworks.
* Ensuring system stability by validating AI-driven updates before execution.

#### How It Works

1. Aggregates data from all AI agents to monitor protocol-wide trends and interactions.
2. Detects inconsistencies or conflicts in AI-generated recommendations.
3. Prioritizes decisions based on TrenOS’s predefined governance and risk parameters.
4. Executes adjustments to optimize liquidity flow, borrowing conditions, and incentive structures.
5. Refines AI models over time based on past execution outcomes and governance feedback.

***

### Goals

* Maintain harmony between AI agents by preventing conflicting decision-making.
* Improve efficiency by ensuring AI-driven optimizations work towards the same protocol objectives.
* Enhance scalability by allowing multiple AI agents to operate in parallel without disruption.
* Ensure stability by monitoring risk, governance, and liquidity conditions dynamically.
* Adapt TrenOS in real time by learning from past decisions and external market influences.

***

### Decision Logic

#### Step 1: Cross-Agent Data Aggregation

* Collects insights from lending, risk, liquidity, governance, and sentiment AI agents.
* Identifies misalignments in AI-generated strategies.

#### Step 2: Conflict Detection & Resolution

* If different AI agents suggest contradictory actions, Ecosystem AI assesses the optimal resolution.
* Applies predefined priority rules to determine which AI agent’s recommendation should be executed.

#### Step 3: Protocol-Wide Optimization

* Adjusts lending rates, collateral requirements, or liquidity incentives to maintain system balance.
* Ensures that risk mitigation measures do not conflict with incentive optimization.

#### Step 4: AI Learning & Model Improvement

* Monitors past execution performance and adjusts AI models based on protocol outcomes.
* Uses reinforcement learning to refine decision-making frameworks over time.

#### Step 5: Final Execution & Governance Reporting

* Deploys coordinated AI-driven updates across smart contracts.
* Logs governance reports outlining AI agent interactions and decision-making processes.

***

### Input Data

Ecosystem AI relies on multiple real-time and historical data sources to coordinate AI-driven decision-making:

* Lending & borrowing metrics from Interest Rate AI and risk-adjusted collateral models.
* Liquidity pool insights tracking incentive allocations, utilization rates, and rewards.
* Governance & proposal records analyzing voting trends and community decisions.
* Market sentiment data assessing external influences on borrowing, lending, and asset risks.
* Security alerts detecting protocol risks and potential governance manipulation.

***

### Execution Outputs

* AI-driven decision coordination ensuring seamless multi-agent collaboration.
* Optimized liquidity allocation adjusting stablecoin issuance and lending parameters.
* Governance transparency reports documenting AI agent interactions and protocol optimizations.
* Automated protocol-wide adjustments improving TrenOS efficiency.
* Risk mitigation updates refining collateral management and incentive distributions.

***

### Tools Used

Ecosystem AI utilizes a variety of tools to monitor, manage, and execute AI-driven optimizations:

* API calls aggregating real-time data from multiple TrenOS modules.
* Multi-agent execution frameworks enabling AI agents to communicate and share decision logic.
* Reinforcement learning models improving AI-driven governance and protocol adjustments.
* Smart contract validation ensuring AI-driven updates align with security constraints.
* RAG (Retrieval-Augmented Generation) retrieving historical governance decisions to improve AI strategies.

***

### Security and Fail-Safes

To ensure stability, security, and efficient AI decision-making, Ecosystem AI implements multiple safeguards:

* AI conflict resolution detecting and preventing misaligned recommendations between agents.
* Governance approval thresholds limiting the scope of AI-driven adjustments without human oversight.
* Anomaly detection algorithms identifying potential risks in protocol-wide AI optimizations.
* AI learning feedback loops refining decision-making based on past execution outcomes.
* Emergency override systems allowing governance intervention if AI-driven changes lead to instability.


# Vector Databases & AI Knowledge Storage

TrenOS leverages vector databases and AI-driven knowledge storage to ensure that its autonomous agents continuously learn, adapt, and make informed decisions. These components allow AI agents to retain past experiences, recall historical trends, and process vast amounts of real-time data efficiently.

Traditional DeFi protocols lack the infrastructure for long-term AI learning and memory storage, which limits their ability to adapt to changing market conditions. TrenOS overcomes this limitation by implementing highly efficient, scalable, and real-time querying systems that enable AI agents to access relevant information whenever needed.

***

### Vector Database Architecture

Traditional databases function like filing cabinets, requiring exact matches for effective retrieval. In contrast, vector databases operate more like human memory, finding information based on similarity and context even without exact matches. This capability enables TrenOS's AI agents to quickly identify similar historical market situations, learn from patterns without explicit programming, and make connections between seemingly unrelated market events while processing new conditions in real-time.

#### Core Components

The vector database implementation serves four essential functions within the protocol. Through long-term memory storage, the system captures not just events but their context and relationships, enabling AI agents to build genuine understanding over time. The smart querying system allows agents to search for relevant information naturally, mimicking how human traders recall similar market conditions from experience.

Pattern recognition capabilities, enabled by vector-based data storage, allow the AI to identify subtle patterns in liquidity flows, lending behavior, and market movements that might escape human observation. Every decision benefits from real-time historical analysis, combining current conditions with historical knowledge for more nuanced and contextual responses.

### Knowledge Storage Implementation

#### Embedding Models

The foundation of our knowledge storage system lies in sophisticated embedding models that transform raw DeFi data into formats suitable for AI reasoning. These models convert transaction histories, liquidity pool states, governance decisions, and market events into numerical representations that capture not only the data itself but its context and relationships to other events. This approach mirrors how human traders understand market context and implications rather than merely memorizing prices.

#### RAG System Architecture

TrenOS implements a Retrieval-Augmented Generation (RAG) system that enhances AI decision-making by combining fresh market data with historical knowledge. When decisions are required, the AI retrieves relevant historical information and combines it with real-time market data to generate responses based on both current conditions and past experience. Each decision outcome feeds back into the system, creating a continuous learning loop.

This sophisticated approach has proven particularly valuable for dynamic protocol management, enabling precise adjustment of parameters in response to market changes, early prediction of potential liquidity constraints, and intelligent fine-tuning of collateral requirements based on asset behavior patterns.

### Query System Design

#### Real-Time Processing Architecture

In the fast-paced world of DeFi, response speed is crucial. Our querying system delivers millisecond-level response times while managing massive data volumes through advanced similarity search optimization. This allows AI agents to quickly identify relevant historical events through vector embedding comparisons rather than raw data scanning. The system supports multi-agent collaboration, where different AI agents within TrenOS share a common knowledge pool while maintaining specialized indices for their specific functions.

The rapid risk assessment capability enables immediate access to similar historical scenarios and their outcomes when evaluating potential risks. This immediate access to historical context helps ensure informed decision-making even under time-sensitive conditions.

#### Performance & Scalability

To maintain system performance as it scales, TrenOS implements sophisticated data management strategies. Hierarchical indexing structures organize vector data for optimal retrieval, while parallel processing capabilities handle multiple AI queries simultaneously. Advanced compression techniques keep storage costs manageable without compromising performance, ensuring the system remains efficient as its knowledge base grows.

### Future Development

As TrenOS continues to evolve, the vector database and knowledge storage systems grow increasingly sophisticated. Each market event, transaction, and governance decision contributes to the AI's understanding, progressively enhancing the protocol's robustness and adaptability. This continuous learning process ensures that TrenOS not only maintains its current capabilities but continuously improves its ability to serve users and manage market conditions effectively.


# TrenOS Architecture

TrenOS represents a fundamental shift in how DeFi protocols operate. Instead of relying on static rules and parameters, we've built an adaptive system that combines AI-driven decision making with traditional DeFi infrastructure. This document outlines our technical architecture and explains how we've integrated various AI components to create a self-improving financial protocol.

### Core Architecture

The foundation of TrenOS implements a hybrid approach combining two powerful AI paradigms: Retrieval-Augmented Generation (RAG) for deep historical analysis and pattern recognition, alongside LangChain Tools for real-time data processing and decision execution. This dual system creates a balanced approach that weighs historical knowledge against current market conditions, enabling more nuanced and context-aware decision making.

### Technology Stack

#### AI Infrastructure

Our AI infrastructure builds upon carefully selected components that prioritize reliability, speed, and adaptability. The core models driving our system include OpenAI GPT-4o for primary decision-making logic, DeepSeek for specialized financial modeling tasks, and LLaMA for specific governance operations. This multi-model approach ensures each aspect of the protocol benefits from specialized AI capabilities.

The data processing layer leverages JinaAI for managing our embedding pipeline and document retrieval, while Pinecone powers our vector database infrastructure. LangChain orchestrates AI workflows and agent interactions, with LangGraph coordinating our multi-agent systems. This comprehensive stack ensures efficient processing and coordination across all protocol operations.

#### Development Infrastructure

The platform's development infrastructure emphasizes modern, scalable technologies. Our frontend utilizes Next.js for the web interface, deployed through Vercel for optimal edge computing performance. The backend combines FastAPI for high-performance API endpoints, Go for performance-critical infrastructure, and Python for AI model integration and data processing. Deployment relies on Azure AI for cloud infrastructure, with Docker enabling efficient containerization and scaling.

### RAG System Implementation

The RAG system implements sophisticated historical data analysis while maintaining real-time processing capabilities. For governance decisions, the system first examines similar historical proposals before considering current conditions. Risk assessment combines past default patterns with current market conditions, while liquidity management analyzes historical flow patterns alongside real-time pool states.

### Data Integration Strategy

Our comprehensive market understanding stems from carefully selected data sources across multiple domains. The system processes market data including historical lending patterns, liquidation events, interest rate trends, and collateral value fluctuations. Risk metrics encompass security incident reports, exploit patterns, protocol risk assessments, and market stress indicators. Governance information includes historical proposals, voting patterns, stakeholder behaviors, and implementation outcomes.

### Performance Optimization

The system maintains continuous improvement through sophisticated self-learning loops and adaptive mechanisms. The self-learning process involves recording prediction accuracy, tracking decision outcomes, measuring market impact, and adjusting risk models. Adaptive mechanisms enable dynamic parameter adjustment, real-time risk recalibration, automated incentive optimization, and market-responsive governance.

### Future Development

TrenOS's development roadmap focuses on several key areas of enhancement. Enhanced integration efforts target deeper cross-chain analytics, improved market sentiment analysis, more sophisticated risk modeling, and advanced governance automation. System optimization priorities include faster decision execution, more efficient data processing, better resource utilization, and enhanced security measures.

The protocol's market adaptation capabilities continue to evolve, focusing on more nuanced risk assessment, improved liquidity management, better governance coordination, and enhanced user incentives. Through the combination of RAG and LangChain tools, TrenOS maintains its position at the forefront of DeFi innovation, capable of making informed decisions based on both historical patterns and current market conditions.

This hybrid approach ensures the protocol's ability to adapt and evolve alongside the rapidly changing DeFi landscape, maintaining efficient operations while continuously improving its service to users and stakeholders.


# Community-Driven AI Expansion

One of our core beliefs in building TrenOS is that true innovation emerges from community collaboration. Rather than limiting protocol development to a core team, we've created an open framework enabling developers, researchers, and community members to directly contribute to TrenOS's AI capabilities. This documentation outlines our community development program's structure, including our agent framework, integration process, and incentive mechanisms.

### Open AI Agent Framework

#### Design Philosophy

The agent framework embodies three fundamental principles that guide its development and operation. First, true permissionless innovation ensures that anyone can propose and develop new AI agents, regardless of their background or connections. Second, while encouraging experimentation, we maintain robust testing and validation processes to protect protocol stability. Third, our aligned incentives ensure contributors directly benefit from the value they create for the protocol.

#### Technical Architecture

The framework provides developers with a comprehensive development environment, including a full-featured SDK for agent development, local testing environments that mirror production conditions, access to historical protocol data, and seamless integration with core protocol systems. This infrastructure supports various agent types, including risk assessment, governance analysis, liquidity optimization, market analysis, and security monitoring agents.

Developers receive access to extensive data resources, encompassing real-time protocol metrics, historical transaction data, governance history, market indicators, and cross-chain analytics. This comprehensive data access ensures agents can make informed decisions based on complete information.

### Integration Process

#### Phase 1: Proposal & Initial Review

The integration process begins with a detailed technical specification that outlines the agent's purpose and functionality, expected impact on protocol performance, technical requirements and dependencies, and performance metrics and success criteria. Contributors engage with the community through technical discussion forums, community calls, and protocol improvement proposals (PIPs), ensuring thorough vetting of new ideas.

#### Phase 2: Development & Testing

Upon gaining initial support, developers access our development environment, which provides realistic test conditions, performance monitoring tools, security analysis capabilities, and integration testing frameworks. This environment enables developers to validate their agents against historical data and ensure they meet all performance requirements before deployment.

#### Phase 3: Governance Review

The final phase involves comprehensive community validation through technical review and community voting. Technical review encompasses code quality assessment, security audit results, performance benchmarks, and integration testing results. The community vote includes a review period for veTREN holders, public discussion and debate, formal governance proposal, and implementation timeline planning.

### Governance Structure

Our governance model balances efficiency with decentralization through a sophisticated voting mechanism utilizing vote-escrowed TREN (veTREN) for alignment, quadratic voting for fair representation, delegation capabilities for expertise, and time-weighted voting power. This structure supports decision-making across technical improvements, risk parameter adjustments, economic model updates, and agent deployment approvals.

The protocol maintains comprehensive analytics and monitoring systems tracking agent performance, including decision accuracy rates, protocol impact metrics, resource utilization, and user benefit analysis. Community feedback mechanisms measure user satisfaction, developer experience, integration success rates, and economic impact assessment.

### Incentive Structure

#### Economic Incentives

The incentive structure rewards sustained contribution through both direct and indirect benefits. Direct rewards include protocol fee sharing for deployed agents, performance-based bonuses, long-term incentive vesting, and development grants. Indirect benefits encompass enhanced governance weight, priority for future proposals, access to advanced testing tools, and community recognition.

#### Reputation System

A sophisticated reputation system tracks and rewards consistent contributors based on successful deployments, code quality scores, community engagement, and long-term impact. Benefits of maintaining a strong reputation include expedited review processes, higher revenue share, advanced testing access, and mentorship opportunities.

### Future Development

The community framework continues to evolve, focusing on three key areas of enhancement. Enhanced development tools will provide improved testing frameworks, better simulation capabilities, more comprehensive SDKs, and advanced debugging tools. Streamlined processes will enable faster review cycles, better documentation, simplified testing, and clearer success metrics.

The framework's expansion will create new opportunities through additional agent categories, cross-protocol integration capabilities, advanced AI implementations, and specialized use cases. This continued evolution ensures TrenOS remains at the forefront of community-driven DeFi innovation while maintaining robust security and stability standards.

Through this comprehensive framework, TrenOS fosters a vibrant ecosystem of contributors while ensuring protocol security and stability remain paramount. The careful balance of innovation, security, and incentives creates an environment where community-driven development can flourish while maintaining the high standards necessary for a critical financial protocol.


# Protocol Design & Risk Management

### How Risk Management Affects Protocol Design Choices

Risk management is inter-connected with all parts of the protocol, beginning with our decision to use isolated module architecture, to how asset listings are evaluated, liquidation mechanisms, XY peg stability, and more.&#x20;

To show how these are all inter-connected:&#x20;

[Isolated modules](/protocol/isolated-modules) contain risk to the module (asset) level and not the protocol level → this allows the protocol to take on more risk with [asset listings](/protocol/asset-risk) → an asset that is too risky, however, can flash crash without recovery, which puts stress on the [liquidation mechanism](/protocol/liquidations) → if the asset is not properly liquidated, this puts the protocol in bad debt → [XY peg](/tokens/xy) is negatively affected as users lose faith in the protocol. Each of these steps and processes are covered in the following pages.

The goal is to create the most capital efficient money market with the lowest risk through technological and protocol design innovations, and many projects will claim that theirs is the one that offers this. While Tren Finance’s goal is the same, we believe that there are inevitable tradeoffs that are made with each decision. It’s easier to think of risk management as a sliding scale:

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FRAQ7a6TCwt5hm31QrX8s%2FRisk%20slider.png?alt=media&amp;token=6c6ba4cb-186b-42f5-bc85-bde35113364d" alt=""><figcaption></figcaption></figure>

### Risk Appetite

Most importantly, each user has different levels of risk appetite. So while a protocol might look like the best option in the eyes of its founders, it may not be the best option for certain users. For example, a fund manager managing hundreds of millions of dollars worth of blue chip crypto assets might only use AAVE. For other users though, AAVE deposit yields might be too low, or find that their asset offerings are too limited. These users can (re)collateralize their idle liquidity in the form of LP, money market deposits, restaked positions, etc. on Tren Finance for greater capital efficiency and higher yields.


# Isolated Modules

Why isolated module architecture was chosen for Tren Finance, and how it works

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FZWPyG6vEO0lcVUrg9D4C%2Fisolated%20modules.png?alt=media&amp;token=4c7f8cb0-319f-43da-a7b4-4f935b1a74f8" alt=""><figcaption></figcaption></figure>

### Cross-collateral vs Isolated Modules

Any protocol that deals with collateral, whether it be a perp DEX or money market, has to choose between two design options: [cross-collateral](https://academy.binance.com/en/articles/what-are-isolated-margin-and-cross-margin-in-crypto-trading) vs isolated architecture. Some protocols will offer both, but each will be separated within the protocol. We'll explain the pros and cons of both design options, along with why we chose isolated module architecture for Tren Finance.

Cross-collateral pools offer greater capital efficiency, but with generally higher levels of associated risk. With a cross-collateral lending market, for example, a protocol (the lender) could accept a total of 5 tokens (tokens A, B, C, D, E) as collateral, with which users (the borrower) can borrow up to 1 million USD ([debt ceiling](#debt-ceilings)). A user could deposit tokens A, B, and C for a combined collateral value of tokens A + B + C, and use this to borrow asset(s) offered by the protocol. This offers greater capital efficiency, as the user can use the combined value of tokens A, B, and C as collateral. However, if token B were to suddenly flash crash without recovery for whatever reason, this exposes the protocol to systemic risk. If a significant percentage of the overall collateral pool consisted of token B, then borrowers would not be able to repay their loans, leaving the protocol in [bad debt](https://www.investopedia.com/terms/b/baddebt.asp). If Token B made up 50% of the collateral pool, the protocol would face losing half of its debt ceiling (500K USD in this example). Even if Token B made up a lower percentage of the collateral pool, the overall collateral pool value could still be worth less than the loans issued. To cover some of the bad debt, a protocol could make the decision to liquidate or partially liquidate the collateral pool, which could even affect users who hadn't used Token B as collateral.

Isolated modules essentially offer the opposite pros and cons, by sacrificing greater capital efficiency in favor of lower levels of associated risk. On Tren Finance, tokens A, B, C, D, and E would be separate modules based on each asset's unique risk profile, so token B would likely have a lower debt ceiling. But even if each asset had the same debt ceiling of 200K USD, the max loss that the protocol could face in the event token B's flash crash would be token B's debt ceiling amount of 200K USD. Only token B's module would be affected, eliminating the potential for systemic risk.&#x20;

### **Risk Management / Protected Deposits**

There is no right or wrong answer in choosing between cross-collateral and isolated module infrastructure. The decision is dependent on a protocol's goals and product market fit. A lending protocol that deals with blue-chip only assets may decide that there is very low systemic risk due to the limited number of collateral assets it offers, and choose a cross-collateral architecture.&#x20;

Tren Finance, on the other hand, is a new type of protocol that (re)collateralizes assets such as LP tokens, money market deposits, and restaked assets. For a protocol like Tren Finance, isolated modules make the most sense due to the high levels of risk management that it offers. Even if a collateral asset has high levels of [liquidity risk](/protocol/asset-risk/liquidity-risk), [oracle risk](/protocol/asset-risk/oracle-risk), [security risk](/protocol/asset-risk/security-risk), and [centralisation risk](/protocol/asset-risk/centralisation-risk) (link to all of these risk pages), isolated module infrastructure indirectly helps alleviate these risks simply due to its ability to contain risk and avoid systemic debt.

Isolated modules contain the risk to individual pools, hence protected deposits. If there is an issue with one asset, it only affects that asset and not the protocol. In a cross-collateral pool with Tokens A, B, and C, even if you just deposit Token A, you may still be affected if Token B flash crashes. With isolated modules, this is not the case. Assets on Tren Finance are also not lent out to other borrowers, as is the case with borrowing & lending protocols, and avoids risks of governance attacks. Furthermore, Tren Finance does not have [redemptions](/tokens/xy#handling-trenusd-above-its-peg-6), so deposits really are protected.

{% hint style="info" %}
Isolated modules alleviate [Liquidity Risk](/protocol/asset-risk/liquidity-risk), [Oracle Risk](/protocol/asset-risk/oracle-risk), [Security Risk](/protocol/asset-risk/security-risk), and [Centralisation Risk](/protocol/asset-risk/centralisation-risk).
{% endhint %}

### Single Markets <a href="#single-markets" id="single-markets"></a>

All tokens on Tren Finance are paired with XY, creating a single market for every token asset. This approach prevents [fractured liquidity](https://www.coingecko.com/learn/liquidity-efficiency-defi) and enhances protocol efficiency, contrasting with pure lending pair methods where each new pairing generates a separate lending market.

While some protocols allow the creation of markets for any asset, attracting liquidity is a separate challenge. To entice lenders, these protocols often offer higher interest rates to offset the risks. Instead of this approach, [TrenDAO](/tokens/tren-and-vetren#what-is-vetren) assumes responsibility as the sole lender of the protocol and the protocol incentivizes participants who stake XY and hold veTREN. The protocol, acting as the sole lender by minting XY for each pool, allows the DAO to capture 100% of the supply side interest. This model enables the protocol to adopt a loss leader strategy, offering lower collateral rates than competitors to drive growth, while offsetting losses with interest from other assets. Stakers of XY benefit by gaining a diversified lending position, providing a liquidity backstop in the event of bad debt.

***

## TrenBox

The TrenBox contract acts as a secure container where you can deposit collateral to borrow XY and manage your loan. Each TrenBox is linked to a smart contract address, and each address can have only one XY per collateral type. If you're familiar with Vaults or CDPs from other platforms, TrenBoxes function similarly.

TrenBoxes maintain two balances: one for the collateral asset and another for the debt, which is denominated in XY. You can adjust these balances by adding collateral or repaying debt. As you make these changes, your TrenBox's [Loan-to-Value (LTV)](https://corporatefinanceinstitute.com/resources/commercial-lending/loan-to-value-ratio/) ratio will be updated accordingly.

You can close your TrenBox at any time by fully paying off your debt.

***

## Risk Parameters

### Loan to Value (LTV)

LTV represents the ratio of a loan amount to the value of the collateral securing the loan, expressed as a percentage. To calculate the loan to value for a TrenBox the formula below is used

$$
LTV = {LoanValue\over CollateralValue}
$$

### Max LTV

Max LTV represents the maximum amount a user can borrow based on the value of a given collateral. The Max LTV is specific to each collateral asset offered on Tren Finance.&#x20;

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FLxPrZUzQvt76swZK6lC2%2FScreenshot%202024-05-17%20at%2022.28.48.png?alt=media&amp;token=03da7222-1ed9-40e9-8c17-c3c07e1ba180" alt=""><figcaption></figcaption></figure>

If the market value of the collateral decreases, the LTV ratio increases because the same loan amount is now backed by less valuable collateral. This can cause the LTV to surpass the Max LTV

While it is not recommended to exceed the Max LTV for a TrenBox, the position remains solvent as long as the LTV is below the liquidation threshold (LT).

Max LTV can also be described as the borrowing power of a position, providing a clear indication of how much can be borrowed against a specific collateral. In essence, Max LTV and borrowing power are interchangeable terms for determining the borrowing capacity of a given collateral.

### Liquidation Threshold (LT)

The liquidation threshold is a critical parameter in Tren Finance, determining the maximum value that your loan can reach before your collateral becomes eligible for liquidation. Each asset within the protocol has its own ratio for this threshold, and this ratio is established through governance decisions.

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FQy0oyVJvSojvqsmAXO7D%2FScreenshot%202024-05-17%20at%2022.03.59.png?alt=media&amp;token=113be990-abf7-4892-b237-84fe1f6e658c" alt=""><figcaption></figcaption></figure>

When a position gets liquidated closer to the threshold, liquidators are rewarded with a higher liquidation fee. This incentive structure is in place to encourage quick action in liquidating positions that approach or exceed the Liquidation Threshold. If borrowers were allowed to accumulate debt beyond the value of their collateral, it would lead to a state of under-collateralization. This scenario is problematic because it increases the risk of bad debt accumulating within the pool, which can have adverse consequences for the protocol.

The difference between the LTV ratio and the liquidation threshold acts as a safety margin to protect the borrower. This margin ensures that there is sufficient collateral to cover the outstanding debt even if the value of the collateral declines slightly. It prevents immediate liquidation upon minor market movements.&#x20;

### Health Factor (HF)

The Health Factor serves as a visual indicator of your TrenBox, depicted by a spectrum spanning from Red to Green. When your Health Factor reaches the critical threshold of 0%, it triggers the initiation of the liquidation process. This metric is determined in real-time, taking into account your Loan-to-Value (LTV) ratio and the Liquidation Threshold (LT) for the module under which the TrenBox is opened.

$$
HF= {LT \over LTV}
$$

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2F3YlbjDCx6wuyOKAwT1kY%2Fimage.png?alt=media&amp;token=5b67e303-173d-478c-9e1b-3246846656a4" alt=""><figcaption></figcaption></figure>

Several factors can contribute to your Health Factor approaching the perilous 0% mark, including:

1. The value of your collateral diminishes.
2. You withdraw a portion of your collateral.
3. Additional borrowing activity on your part.
4. Accumulation of interest on your loan over time.

The closer your Health Factor gets to 0%, the nearer you are to facing liquidation. It's essential to vigilantly monitor the Health Factor of each of your borrow positions to ensure their stability and avoid potential liquidation.

To calculate the liquidation price, use the formula below. Note that the collateral quantity is expressed in the number of collateral tokens, while the loan value is expressed in dollars.

$$
LiquidationPrice = {LoanValue \over LT \* CollateralQuantity}
$$

### Minimum Debt

To borrow you must open a TrenBox and deposit a certain amount of collateral along with a minimum debt of 500 XY. The minimum debt ensures that each TrenBox is substantial enough to make transaction costs worthwhile for the user.

### Liquidation Reserve

When you open a TrenBox and draw a loan, 150 XY is set aside as a way to compensate gas costs for the transaction sender in the event of your TrenBox being liquidated. The Liquidation Reserve is fully refundable if your TrenBox is not liquidated, and is given back to you when you close your TrenBox by repaying your debt. The Liquidation Reserve counts as debt and is taken into account for the calculation of a TrenBox's LTV ratio, slightly increasing the actual collateral requirements.

### Redistribution

The collateral and debt of an active TrenBox may increase in the event of a redistribution within an isolated module. A redistribution occurs when the insurance pool is empty, or a TrenBox's value is too low to effectively liquidate. Collateral and debt from a liquidated TrenBox is distributed among the active TrenBoxes within the module.

***

## Debt Ceilings

Debt ceilings are one of the most important risk management tools in Tren Finance. The concept of a debt ceiling is used to cap the maximum amount of debt that can be issued against a specific type of collateral. The debt ceiling is shown as the total XY on each module.Comment

#### Asset Specific <a href="#asset-specific" id="asset-specific"></a>

Each type of collateral typically has its own debt ceiling. Riskier assets have lower XY and more mature assets enjoy a larger supply of XY to be minted. This limit is set by both governance decisions and the in house risk management team of Tren Finance based on the perceived risk and liquidity of the collateral asset, among other factors.Comment

#### Diversified Risk <a href="#diversified-risk" id="diversified-risk"></a>

Without debt ceilings, a protocol could become overly concentrated in a single type of collateral, especially if it becomes popular or seen as highly profitable. This could lead to systemic risks if that particular asset faces issues like regulatory crackdowns, fundamental security flaws, or other problems that could affect its value.Comment

#### Unprofitable Price Manipulation <a href="#unprofitable-price-manipulation" id="unprofitable-price-manipulation"></a>

If a CDP protocol allows very high or no limits on debt creation for a particular asset, an attacker might manipulate the price of a low liquidity asset (both the collateral and the borrowed asset). By inflating the price of the collateral artificially through wash trading or other techniques, they could borrow significantly more against it than its actual market value. Once the manipulation stops, the price could collapse, leading to losses for the protocol when the position is liquidated at a value that doesn't cover the debt. A debt ceiling limits the total exposure of the protocol to such price manipulations as we can control the maximum value at risk per module. With full control over the value at risk we are able to set debt ceilings so that the cost of manipulation is higher than the gain from exploiting the protocol, securing the protocol.

### Redstone Oracles

Tren Finance uses RedStone Oracles as the primary solution for crypto assets pricing. [RedStone](https://redstone.finance/) is a Modular Oracle that delivers frequently updated, reliable, and diverse data feeds in a few models.


# Liquidations

Everything about liquidations, and how the Insurance Pool mechanism works

A liquidation event occurs when a borrower's [Health Factor](/protocol/isolated-modules#health-factor-hf) drops to 1, indicating eligibility for liquidation. This process allows liquidators to seize control of the borrower's collateral, sell it, and utilize the proceeds to repay the outstanding debt while earning a liquidation fee.

Liquidations are crucial to Tren Finance as they maintain the protocol's solvency and ensure the stability of its collateral-backed synthetic dollar, XY. When a borrower's position becomes under-collateralized due to market fluctuations or asset depreciation, liquidations act as a safeguard by reclaiming and selling the collateral to cover the outstanding debt. This process prevents systemic risks and protects lenders by ensuring that all XY in circulation remains fully backed by sufficient collateral. Moreover, liquidations incentivize borrowers to maintain healthy [collateralization ratios](https://iq.wiki/wiki/collateralization-ratio/), thereby promoting responsible borrowing and lending practices within the platform. Ultimately, liquidations uphold the integrity and reliability of Tren Finance, fostering trust and stability in the decentralized finance ecosystem.

## How Does it Work?

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2Fdu37qkAKyp48PJYjgEyk%2FInsurance%20Pool%20Machanism%20v2.png?alt=media&amp;token=18541e05-db43-4f9c-8248-0e6cd6628c32" alt=""><figcaption></figcaption></figure>

Tren Finance currently employs a full-collateral liquidation approach. When a position is flagged for liquidation, the borrower's entire collateral is seized to settle their borrowing position. After the liquidation event, the liquidated borrower retains only the amount of XY they initially borrowed.

The Insurance Pool is used to absorb the liquidation, utilizing a liquidity backstop of XY provided by insurance providers. This mechanism allows insurance providers to use their XY to acquire discounted collateral.&#x20;

## How can I protect myself from being liquidated?

Regularly monitor the health factor of your TrenBox to ensure it remains well above 1.00. Maintaining a higher health factor provides a buffer against market volatility and price fluctuations of the collateral asset.&#x20;

If the value of your collateral decreases or you have borrowed close to the maximum allowed amount, consider adding more collateral to your TrenBox. This will increase your collateralization ratio and reduce the likelihood of liquidation.&#x20;

Additionally, repaying a portion of the borrowed XY can improve your health factor. This is particularly useful if the value of your collateral has decreased and you are near the liquidation threshold.

***

## Triggering Liquidation

Liquidations are triggered when a [TrenBox](/protocol/isolated-modules#trenbox)'s [Loan-to-Value (LTV)](/protocol/isolated-modules#loan-to-value-ltv) surpasses the [Liquidation Threshold (LT)](/protocol/isolated-modules#liquidation-threshold-lt) of the module. This can happen due to a decrease in the value of the collateral or an increase in the debt XY.

Anyone can trigger a liquidation by calling the liquidation function on the TrenBox that is under-collateralized.

The liquidation of TrenBoxes is connected with certain gas costs that the initiator must cover. The cost per TrenBox was reduced by implementing batch liquidations of up to `25` TrenBoxes but to ensure that liquidations remain profitable even in times of soaring gas prices the protocol offers a gas compensation given by the following formula:

`f.g.; gas compensation = 300 XY + 0.5% of TrenBox's collateral`

The `300 XY` is funded by a Liquidation Reserve that users deposit into when opening their TrenBox. The `0.5%` part comes from the liquidated collateral, slightly reducing the liquidation gain for Insurance Providers.

## Liquidation process

The Insurance Pool is the primary mechanism for handling liquidations. It holds XY deposited by users (Insurance Providers) and uses this XY to repay the debt of liquidated TrenBoxes. When a TrenBox is liquidated, the Insurance Pool burns an amount of XY equal to the TrenBox debt and receives the collateral in return.

When a TrenBox is liquidated, the following steps occur:

* **Debt Repayment**: An amount of XY equal to the debt of the liquidated TrenBox is burned from the Insurance Pool.
* **Collateral Transfer**: The entire collateral of the liquidated TrenBox is transferred to the Insurance Pool.

## Distribution to Insurance Providers

Insurance Providers in the Insurance Pool lose a pro-rata share of their XY deposits corresponding to the amount of debt repaid.

In exchange, they receive a pro-rata share of the liquidated collateral at a discount. Insurance Providers are required to claim the liquidated collateral.

***

## **Why should I deposit** XY **into the Insurance Pool?**

Insurance Providers earn profits from liquidating collateral discounted to the market value.

Liquidation profits are inversely related to the LTV of the collateral type being liquidated. For instance, when an Asset A TrenBox with a 90% LT is liquidated, users can acquire Asset A at approximately a `10%` discount.

Similarly, for an Asset B TrenBox that allows users to borrow XY at up to `80%` LT, Insurance Providers can obtain Asset B at roughly a `20%` discount upon liquidation.

As liquidations occur just above a predefined LT, you will most likely experience a net gain whenever a TrenBox is liquidated.

For example, suppose there is a total of `1,000,000 XY` in the Insurance Pool and your deposit is `100,000 XY`, representing `10%` of the pool.

If a TrenBox with a debt of `200,000 XY` and collateral of `400 Asset A` is liquidated at a price of `$545` (resulting in an LTV of `91%`), your deposit will decrease by `10%` of the liquidated debt (`20,000 XY`), from `100,000` to `80,000 XY`. In return, you will gain `10%` of the liquidated collateral, which is `40 Asset A` worth `$21,800`. Your net gain from the liquidation would be `$1,800`.

## Withdrawal Pause

Generally, you can withdraw your deposit from the Insurance Pool at any time, with no minimum lockup duration. However, withdrawals are temporarily suspended when there are liquidatable TrenBoxes with an LTV above the protocol-set amount that have not yet been liquidated.

## Risk

While liquidations usually occur at an LTV well below `100%`, it is theoretically possible for a TrenBox to be liquidated above `100%` in a flash crash or due to an oracle failure. In such cases, the collateral gain might be smaller than the reduction of your deposit, resulting in a loss.

Additionally there is a risk that the value of the collateral is lower than the amount of XY used to liquidate the position due to further price decline

If XY is trading above $1, liquidations may become unprofitable for Insurance Providers even at an LTV below `100%`. However, this loss is hypothetical since XY is expected to return to its peg, meaning the “loss” only materializes if you withdraw your deposit and sell XY above $1.

## Redistribution Mechanism

Redistribution serves as a backup mechanism to handle liquidations when the Insurance Pool is empty. It ensures that the protocol remains solvent by distributing the debt and collateral of under-collateralized TrenBoxes among all active TrenBoxes proportionally. This mechanism maintains the stability and reliability of the protocol, protecting user funds and encouraging responsible management of collateralized debt positions.

When redistribution occurs, the debt and collateral of the under-collateralized TrenBox are distributed among all remaining active TrenBoxes in the system. This redistribution is done proportionally based on the collateral amount of each active TrenBox

Redistribution ensures that the protocol can handle under-collateralized positions even when the Insurance Pool is depleted, maintaining overall solvency.

## Example

#### **Initial State**

Assume there are three active TrenBoxes in the system:

* TrenBox A: 10,000 XY debt, 20 Asset A collateral
* TrenBox B: 20,000 XY debt, 40 Asset A collateral
* TrenBox C: 30,000 XY debt, 60 Asset A collateral

**Liquidation Event**:

* TrenBox D, with 15,000 XY debt and 30 Asset A collateral, becomes under-collateralized, and the Insurance Pool is empty.

**Redistribution Process**:

* The 15,000 XY debt and 30 Asset A collateral from TrenBox D are redistributed among the remaining active TrenBoxes (A, B, and C).
* The total collateral in the system before redistribution is 120 Asset A (20 + 40 + 60).

**Proportional Distribution**:

* TrenBox A’s share of the total collateral is 20/120 = 1/6
* TrenBox B’s share is 40/120 = 1/3
* TrenBox C’s share is 60/120 = 1/2

**Debt and Collateral Allocation**:

TrenBox A receives 1/6 of 15,000 XY debt and 30 Asset A collateral:

* New debt: 10,000 + 2,500 = 12,500 XY
* New collateral: 20 + 5 = 25 Asset A

TrenBox B receives 1/3 of 15,000 XY debt and 30 Asset A collateral:

* New debt: 20,000 + 5,000 = 25,000 XY
* New collateral: 40 + 10 = 50 Asset A

TrenBox C receives 1/2 of 15,000 XY debt and 30 Asset A collateral:

* New debt: 30,000 + 7,500 = 37,500 XY
* New collateral: 60 + 15 = 75 Asset A


# Asset Risk

How assets are evaluated on Tren Finance

### Asset Risk Assessment

The listing team at Tren Finance is actively on the lookout for innovative assets that fit the protocol's goal of (re)Enabling liquidity, such as [LP](/get-started/what-is-tren-finance/lp-tokens) tokens, [money market deposit](/get-started/what-is-tren-finance/money-market-deposits) tokens, and other [yield-bearing](/get-started/what-is-tren-finance/pt-tokens) tokens. Once such an asset is found, the asset will go through the Asset Risk Analysis process outlined below. If the asset passes the risk analysis test, the asset will likely start with a lower XY borrow debt ceiling to mitigate risk, and increase based on borrowing demand of the isolated module and continued risk evaluation of the asset.

### Risk Methodology

The information gathered from using the risk methodology table below, along with the protocol's novel [Proof-of-Liquidity](/protocol/proof-of-liquidity) concept, is taken into account to reach risk parameters such as [max LTV](/protocol/isolated-modules#max-ltv), [liquidation threshold](/protocol/isolated-modules#liquidation-threshold-lt), and XY [debt ceiling](/protocol/isolated-modules#debt-ceilings) for an asset’s isolated module.&#x20;

<table data-header-hidden><thead><tr><th width="102"></th><th width="125"></th><th width="102"></th><th width="102"></th><th width="162"></th><th width="108"></th><th></th></tr></thead><tbody><tr><td>Score</td><td>Market Cap</td><td>Holders</td><td>Total Transfers</td><td>Liquidity (TVL)</td><td>Buy-side Impact</td><td>Sell-side Impact</td></tr><tr><td>Weight</td><td>18%</td><td>18%</td><td>18%</td><td>18%</td><td>14%</td><td>14%</td></tr><tr><td>1</td><td>≥ $5,000,000</td><td>≥ 500</td><td>≥ 15,000</td><td>≥ $500,000</td><td>≤ 40.00%</td><td>≤ 40.00%</td></tr><tr><td>2</td><td>≥ $10,000,000</td><td>≥ 1,000</td><td>≥ 25,000</td><td>≥ $1,000,000</td><td>≤ 30.00%</td><td>≤ 30.00%</td></tr><tr><td>3</td><td>≥ $30,000,000</td><td>≥ 2,500</td><td>≥ 50,000</td><td>≥ $2,500,000</td><td>≤ 20.00%</td><td>≤ 20.00%</td></tr><tr><td>4</td><td>≥ $50,000,000</td><td>≥ 5,000</td><td>≥ 100,000</td><td>≥ $5,000,000</td><td>≤ 15.00%</td><td>≤ 15.00%</td></tr><tr><td>5</td><td>≥ $100,000,000</td><td>≥ 10,000</td><td>≥ 250,000</td><td>≥ $7,500,000</td><td>≤ 10.00%</td><td>≤10.00%</td></tr><tr><td>6</td><td>≥ $250,000,000</td><td>≥ 25,000</td><td>≥ 500,000</td><td>≥ $10,000,000</td><td>≤ 7.50%</td><td>≤ 7.50%</td></tr><tr><td>7</td><td>≥ $500,000,000</td><td>≥ 50,000</td><td>≥ 1,000,000</td><td>≥ $25,000,000</td><td>≤ 5.00%</td><td>≤ 5.00%</td></tr><tr><td>8</td><td>≥ $1,000,000,000</td><td>≥ 100,000</td><td>≥ 5,000,000</td><td>≥ $50,000,000</td><td>≤ 2.50%</td><td>≤ 2.50%</td></tr><tr><td>9</td><td>≥ $5,000,000,000</td><td>≥ 250,000</td><td>≥ 10,000,000</td><td>≥ $100,000,000</td><td>≤ 1.00%</td><td>≤ 1.00%</td></tr><tr><td>10</td><td>≥ $10,000,000,000</td><td>≥ 500,000</td><td>≥ 50,000,000</td><td>≥ $200,000,000</td><td>≤ 0.50%</td><td>≤ 0.50%</td></tr></tbody></table>

The table above is a useful framework for risk evaluation of most spot assets, but as Tren Finance works with different asset types, a more flexible approach and adjustments to the methodology table above and overall risk analysis are needed.&#x20;

#### "Wrapped" Tokens

We use the term "wrapped" to describe tokens such as money market [deposit tokens](/get-started/what-is-tren-finance/lp-tokens), [LSTs](https://www.techopedia.com/definition/liquid-staking-token-lst), [LRTs](https://4pillars.io/en/articles/overview-of-liquid-restaked-token-lrt), or any token that may require an "unwrapping" process in order to liquidate or sell the asset. The first questions that we ask about these assets are:

1. Does the wrapped asset have direct liquidity? If so, how does this liquidity compare to the liquidity for the native (unwrapped) asset?
2. If there are no sources of direct liquidity, are there any delays / lock-up periods for "unwrapping" the asset back to its native form?&#x20;

We use these answers to determine whether an asset is able to be listed, and how to determine its risk levels. For example, if a money market deposit token did not have sources to direct liquidity, but also did not have any lock-up periods, then we would look at the native asset's liquidity levels for liquidity analysis, while looking at the total transfers and holder numbers of the deposit token to analyse the risk levels of the money market protocol.

#### LP Tokens

[Liquidity Pool](https://www.techopedia.com/definition/liquidity-pool) tokens also require a separate type of risk analysis. The underlying assets of the liquidity pool will go through individual risk analysis first, and then we look at the overall liquidity in the liquidity pool. Some important questions that we ask about LP tokens are:

1. What is the balance of the different tokens in the liquidity pool? Is the balance even? Or does a riskier asset have a lopsided weight in the liquidity pool?
2. Do the individual assets in the liquidity pool have sources to other forms of liquidity? Or is this liquidity pool the primary source of liquidity for an asset?

[LP tokens](/get-started/what-is-tren-finance/lp-tokens), in general, have lower levels of associated risk than individual assets when a "safe" token such as a widely used stablecoin  makes up at least 50% of the liquidity pool. Because of this, Tren Finance may list the LP token of an asset first, and then list the individual asset later on.


# Liquidity Risk

Illiquid and volatile assets leave the protocol in risk of bad debt. For example, if an asset needs to be liquidated, there must be enough liquidity for a profitable liquidation to occur. If the potential slippage for liquidating an asset is too high, then a profitable liquidation will not happen, leaving the protocol in debt, and forcing additional systemic risk mitigation mechanisms to take place such as XY slashing.

To prevent this from happening, there are a number of precautions put in place. As the [risk methodolgy table](/protocol/asset-risk#risk-methodology) shows, factors such as market cap, and liquidity (overall liquidity + buyside / sellside price impact) encompass a high percentage of an asset’s overall risk score. The protocol's novel [Proof-of-Liquidity](/protocol/proof-of-liquidity) concept also significantly reduces the likelihood of bad debt. These are then used to help determine the risk parameters of an asset, including max LTV and liquidation threshold.

In general, the lower the risk score of an asset is, the lower the max LTV and liquidation threshold for the isolated module will be. This risk score is also used to determine XY allocation for an isolated module. A low XY debt ceiling for an isolated module is another precautionary measure to lower the amount of potential bad debt. To account for asset volatility, while assets with weak risk scores will have low max LTV rates, there will still typically be a buffer of around 10% from the max LTV percentage to the liquidation threshold percentage. This is so that user positions in these isolated modules are not being liquidated too frequently, while the liquidation threshold is set low enough for profitable liquidations to occur.


# Oracle Risk

Oracles play a vital role on Tren Finance, as they do on most DeFi protocols, by providing the “true” price of an asset at a given time. As an example, if asset A were to trade at $100 on one exchange while also trading at $98 on another exchange, an oracle will provide the “true” value of the asset based on its configuration. This price feed is used to trigger important functions like liquidations by providing data on what a user’s collateral is worth.

Due to the important role that oracles play, they are often the subject of price manipulation attacks. For example, if an asset does not have strong buy-side liquidity, an attacker could artificially inflate the price of an asset. The attacker could then use the asset to borrow an abnormal amount of XY, leaving the protocol in debt. If an asset does not have strong sell-side liquidity, an attacker could artificially deflate the price of an asset, triggering liquidations. The attacker could then buy these liquidated positions at a discount.&#x20;

To mitigate against such attacks, a high level of importance is put on liquidity and both buy-side / sell-side price impact when evaluating assets, as shown in the [risk methodolgy table](/protocol/asset-risk#risk-methodology). Another risk mitigation method is adjusting the maximum borrowable amount of XY allocated for an isolated module. This figure will be set so that it does not exceed the potential cost of a potential price feed manipulation attack, and therefore should not be profitable. Tren Finance's [Proof-of-Liquidity](/protocol/proof-of-liquidity) concept also lowers the protocol's reliance on oracles by providing the true liquidatable figures of assets.

As Tren Finance plans on listing a wide variety of assets and asset types, an oracle-agnostic approach is most appropriate for the protocol. Tren Finance will use a variety of oracles for price feeds, including Pyth, Chainlink, UniV3 (UniV4 upon release), and will continue to explore oracle solutions based on the different solutions that are required for each asset and isolated module. The different characteristics of each oracle, such as whether a TWAP or VWAP is used, will be assessed to analyse which oracle solution is most appropriate for a given situation.


# Security Risk

As Tren Finance works with varied asset types including LP tokens, money market deposits, and LRTs, a high level of importance is put on the technical security of each asset. While the technical risk analysis process does comprise of purely technical elements, there are many elements that require both qualitative and technical viewpoints.

The tech team at Tren Finance will conduct smart contract reviews to gauge the security of the underlying code of an asset. As a part of this process, the team will review smart contract audits conducted by respected auditors in the space, on top of conducting internal reviews.&#x20;

To gauge the security of an asset, as shown in the [risk methodolgy table](/protocol/asset-risk#risk-methodology), the total number of on-chain holders, and transfers is also taken into account. These factors provide a viewpoint on how much the smart contract has been used, and by how many users. In general, the more that a smart contract has been used, the safer it is. The security review process also encompasses a large portion of the centralisation risk review process below.


# Centralisation Risk

As mentioned in the [Security Risk](/protocol/asset-risk/security-risk) section, the technical security risk review encompasses a large portion of the centralisation risk process. This is because the smart contract of an asset can be assessed based on centralisation factors such as whether the contract is multi-sig, whether the contract is upgradeable vs immutable, whether the contract is permissionless, and if there are any built-in functions like minting in the contract.

A more qualitative approach is also used to assess the governance structure of an asset. Block explorers and bubble maps will be used to determine the percentage of the supply the top holders of the token control. In general, the more decentralised an asset is, the better. Governance rules and functionalities of the protocol governing an asset will also be analysed to account for centralisation risk.


# Proof-of-Liquidity

Explaining Proof-of-Liquidity and how it helps risk management

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2F0KN5VnuktH27RiL18tR8%2Fpol.png?alt=media&amp;token=c74f6097-1be6-4dc6-92c1-dfedee92cd1b" alt=""><figcaption></figcaption></figure>

Proof-of-Liquidity is a mechanism for dynamically assessing [collateral value](https://www.thebalancemoney.com/collateral-value-5197903#:~:text=Key%20Takeaways,market%20value%20of%20a%20property.) by leveraging the [underlying liquidity](https://www.investopedia.com/terms/l/liquidity.asp) of tokens, ensuring a more accurate and liquidatable asset valuation compared to traditional [quote price](https://www.investopedia.com/terms/q/quoted-price.asp) methods.&#x20;

### Why is Proof-of-Liquidity Necessary?

Throughout the history of lending protocols in DeFi, there have been instances where users have been able to take out large loans with collateral in amounts that are effectively unliquidatable. This is because there is an insufficient amount of on-chain liquidity to absorb the liquidation of the collateral asset, and would cause significant [slippage](https://www.investopedia.com/terms/s/slippage.asp) leading to a highly unprofitable liquidation. In such a situation, the lending protocol is left hoping that the user can increase the loan position's health factor, or for external liquidators to step up and take on the collateral asset. If either of these scenarios do not happen, the protocol is left with a significant amount of [bad debt](https://www.investopedia.com/terms/b/baddebt.asp).

Proof-of-Liquidity is designed to prevent such scenarios. By dynamically assessing the underlying liquidity of collateral assets, the protocol can set more effective risk parameters, along with appropriate debt ceilings that are correlated with liquidatable liquidity. &#x20;

### How Does Proof-of-Liquidity Work?

$$
{X\*Y}=K
$$

The equation above is the [Constant Product Formula](https://docs.uniswap.org/contracts/v2/concepts/protocol-overview/how-uniswap-works), used by AMMs for liquidity pools, where *X* and *Y* are the quantities of two different tokens in a liquidity pool. As the value of one token decreases due to more people selling the token in the liquidity pool over the other token, its supply increases comparatively.

Let's say that asset *Y* was listed as a collateral asset on a lending protocol. Assets *X* and *Y* were initially pooled together with the same price and same quantity. As selling pressure on asset *Y* is increased, or buying pressure on asset *X* is increased, asset *Y*'s supply increases compared to asset *X*. Buying pressure on asset *X* is not a problem, but continued selling pressure on asset *Y* is. As this happens, the liquidatable value of asset *Y* decreases. If this continues to happen, then there comes a point where there is not enough asset *X* liquidity, and asset *Y* becomes virtually unliquidatable.&#x20;

It's important for lending protocols to track such developments in an automated way. Otherwise, deposited collateral assets with high [debt ceilings](/protocol/isolated-modules#debt-ceilings) can become unliquidatable, leaving the protocol in bad debt.&#x20;

Before any assets are listed as collateral on Tren Finance, a Proof-of-Liquidity check is conducted to assess the true liquidity of an [underlying asset](https://corporatefinanceinstitute.com/resources/career-map/sell-side/capital-markets/underlying-asset/#:~:text=Summary-,Underlying%20asset%20is%20an%20investment%20term%20that%20refers%20to%20the,%2C%20market%20indexes%2C%20and%20currencies.). This is then used to help determine the risk parameters and the debt ceilings of isolated modules. Proof-of-Liquidity checks are dynamically conducted to manage asset risk.

### **Risk Management**

Proof-of-Liquidity is an assessment that the protocol relies upon along with more standard forms of liquidity evaluation, as shown in the [Asset Risk](/protocol/asset-risk) section. Liquidity and oracle risk management are particularly aided by dynamic Proof-of-Liquidity assessments. As this assessment shows the true underlying liquidity of an asset, the likelihood of the protocol facing bad debt is drastically reduced. Exploits using oracle manipulation are also made more difficult as the cost of a price exploit can be measured more accurately, and debt ceilings can be adjusted so that a potential [oracle manipulation](https://www.halborn.com/blog/post/what-is-oracle-manipulation-a-comprehensive-guide) would not be profitable.&#x20;

{% hint style="info" %}
Proof-of-Liquidity alleviates [Liquidity Risk](/protocol/asset-risk/liquidity-risk) and [Oracle Risk](/protocol/asset-risk/oracle-risk)
{% endhint %}


# Hooks

Learn about Hooks and how they are used to open up different yield-enhancing and cost-saving strategies for users

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2Ft2Fe9BFcxddZtAmprYH9%2Fimage%20(4).png?alt=media&amp;token=e37d199c-284f-4d07-9a92-604abdee8de5" alt=""><figcaption></figcaption></figure>

## What are Hooks?

Hooks are customizable smart contracts to enhance interoperability and create advanced strategies with 3rd party protocols. They provide a powerful tool for developers to enhance the functionality of isolated modules in decentralized finance (DeFi) platforms by attaching customizable smart contracts. These hooks enable not only a high degree of customization but also significantly extend the operational capabilities of the modules. They are commonly used to implement [automated investment](https://www.investopedia.com/what-is-automated-investing-7569400) strategies directly within an isolated module. This allows for the [auto-compounding](https://docs.bancor.network/about-bancor-network/resources-for-daos/liquidity-mining/auto-compounding-rewards) of yields and their reinjection back into the position, optimizing the yield farming results for users.

## What Can Hooks Do?

By leveraging hooks, users can engage in staking and [farming](https://coinmarketcap.com/academy/article/what-is-yield-farming) activities while simultaneously using their deposited tokens as collateral for obtaining loans or creating [leverage](/protocol/hooks/looping-leverage) positions. This dual functionality addresses a major limitation faced by many money markets, where liquidity provider ([LP](https://coinmarketcap.com/academy/glossary/liquidity-provider-tokens-lp-tokens)) tokens are not accepted as collateral because they need to be actively staked to generate rewards. Traditionally, this forced users to choose between unlocking capital by depositing LP tokens or staking them to accrue rewards. Hooks cleverly eliminate this trade-off, allowing both actions to coexist.

Moreover, hooks can range from straightforward applications like staking tokens on another protocol when they are deposited as collateral, to more complex scenarios involving algorithms that automatically identify and aggregate the highest yields based on the chosen strategy. This flexibility explains why there may be multiple isolated modules for the same asset, each tailored to different yield-generating strategies.

The introduction of hooks represents a significant evolution in the programmability and efficiency of DeFi platforms, enabling money markets tailored to the strategic needs of the user.

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2Fza5f0Ug6e6e2KS11zsTV%2Fhooks.webp?alt=media&amp;token=2b5490df-9e24-4868-b014-b5319c6bc691" alt=""><figcaption></figcaption></figure>


# Looping Leverage

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FrTvQ8zZVBqTQvLuefrcU%2Fflashborrow%20looping.png?alt=media&amp;token=97f3c488-e2d2-4082-851c-1f031007cf16" alt=""><figcaption></figcaption></figure>

Through Hooks Tren Finance is able offer looping leverage for assets through its recursive lending engine. Users can gain high leverage on assets in one-click. With this functionality, users are able to employ a number of different strategies to optimize their yield. Read more about these [use cases and strategies](/#use-cases).\
\
In the example above, a user wants to gain a 5x levered position on PT-USDe. Tren Finance calculates the XY needed for the user’s desired position, and XY is FlashBorrowed based on the amount required to attain the user’s desired PT-USDe postion. After the FlashBorrowed XY is used to acquire PT-USDe, the PT-USDe is then used to borrow XY in order to repay the FlashBorrow loan.

### **Benefits**

**Efficiency**: Executing the entire leveraging process within a single transaction reduces gas fees and operational complexity.

**Maximized Yield**: By increasing exposure to yield-generating assets, users can potentially enhance their returns. In the example used above, the user would gain roughly 5x the typical yield on PT-USDe.

**Automation**: The hook automates repetitive steps, streamlining the user experience and minimizing manual intervention.


# Rebase Token Wrapper

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FY2uLPWqZbtn57WId70c7%2FRebase%20Token%20Wrapper%20Hook.jpg?alt=media&amp;token=0498fd91-73ce-43da-9ab8-eece7dce2bc0" alt=""><figcaption></figcaption></figure>

The Rebase Token Wrapper Hook is a mechanism designed to enhance the usability and integration of rebase tokens within Tren Finance, and potentially other DeFi ecosystems. Rebase tokens, such as Aave’s aTokens, dynamically update balances in real time to reflect accrued interest. This can pose challenges for protocols that expect static token balances. The Rebase Token Wrapper Hook addresses these challenges by encapsulating rebase tokens within a wrapper. With aTokens, for example, the underlying balance of aTokens grows over time, but the wrapper maintains a static representation, allowing seamless integration with Tren Finance and other protocols.

### **Benefits**

**DeFi Compatibility:** Most protocols are not built to be able to integrate rebasing tokens. Through the wrapper hook, these tokens are able to be integrated onto Tren Finance, and allows them to be integrated into other DeFi protocols as well.

**Simplicity:** The wrapper hook is simple and easy to understand for users. The wrapped tokens maintain a constant balance in the user's wallet after they have been deposited onto Tren Finance. Once a user initiates a withdrawal, the amount of rebase tokens returned reflects any supply adjustments from accrued yield that occurred during the wrapping period.


# Auto-Rollover

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FMghxu0u2EsMeGIA4voRv%2FAuto-Rollover%20Hook.jpg?alt=media&amp;token=ad5139c7-1d3c-41fd-aee3-8770baed9d4d" alt=""><figcaption></figcaption></figure>

The Auto-Rollover Hook is a mechanism designed to automate the renewal or extension of time-bound positions, such as fixed-term deposits or expiring contracts, within DeFi protocols. This automation ensures that users maintain continuous exposure to their chosen positions without the need for manual intervention at each expiration.

How does this work? First, the Auto-Rollover Hook tracks the expiration timelines of user positions. If the user has enabled the Auto-Rollover Hook, the hook automatically renews the position upon expiration, reinvesting the principal (and potentially the accrued interest) into a new term or contract.

#### **Benefits**

**Continuous Investment Exposure:** Users maintain uninterrupted participation in their chosen positions, maximizing potential returns.

**Efficiency:** Eliminates the need for manual renewals, saving users time and reducing the risk of missed opportunities due to lapsed positions.

**Reduced Transaction Costs:** Automating the rollover process minimizes transaction fees associated with closing and reopening positions manually.


# Auto-Compounder

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FhyKkbCBncNaJean2lgY2%2FAuto-Compounder%20Hook.jpg?alt=media&amp;token=130230bd-db45-4e8b-97fa-5a7ff79ab691" alt=""><figcaption></figcaption></figure>

The Auto-Compounder Hook is a mechanism designed to automate the reinvestment of earned rewards or yields back into a user's principal position. This process, known as compounding, enhances optimizes yield growth by continually increasing the investment base without requiring manual intervention.

How does this work? As users participate in yield-generating activities (e.g., staking, liquidity provision), they earn rewards over time. The Auto-Compounder Hook periodically collects these accumulated rewards. Collected rewards are converted into the original investment asset, if necessary. The converted rewards are automatically reinvested into the user's principal position, increasing the overall amount of assets generating yield. This cycle repeats at regular intervals, ensuring that earnings are consistently reinvested to maximize compound interest over time.

### **Benefits**

**Enhanced Returns:** By automatically reinvesting earnings, users can achieve higher returns through the power of compound interest.

**Time Efficiency:** Eliminates the need for manual intervention, allowing users to benefit from compounding without active management.

**Cost Savings:** Automated processes can reduce transaction fees associated with manual reinvestment.

**User-Friendly Experience:** Simplifies the re-investment process, making it more accessible to users who may not be familiar with manual compounding strategies.


# Router

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2Fu7qJ7PfTI5HGc76qmZLc%2FRouter%20Hook.jpg?alt=media&amp;token=824114f9-9d58-4877-a9ba-45fbb931e326" alt=""><figcaption></figcaption></figure>

We’ll take a look at how the Router Hook works in the example used for the Looping Leverage Hook. In the step where the FlashBorrowed XY is used to acquire PT-USDe, the Router Hook kicks in. Here, the Router Hook finds the optimal pathway for wapping XY to PT-USDe. It’s easy to think of the Router Hook as an aggregator, in that it analyses pathways to find the best and most cost-efficient pathway before executing the transaction.

A key difference from a typical aggregator however, is the Router Hook’s ability to determine and execute the groundwork necessary before making a swap. For example, if there was a request to swap aUSDT to XY:

1. Check if there is sufficent liquidity to directly swap from aUSDT
2. If not, go to Aave to withdraw USDT from the aUSDT
3. Swap USDT to XY

### **Benefits**

**Dynamic Flexibility**: The Router Hook allows for real-time decision-making, optimizing routes and execution paths based on evolving market conditions and liquidity depth

**Improved Efficiency**: Automating routing decisions and optimizing transaction pathways reduces operational complexity and potentially minimizes gas costs.

**Composability**: The Router Hook facilitates seamless integrations across protocols, enabling complex multi-step workflows and enhancing interoperability within DeFi.

**User-Friendly Automation**: Users benefit from streamlined processes where optimal pathways are executed without requiring manual intervention or technical expertise.


# FlashMint

Utilize the FlashMint functionality on Tren Finance to execute your custom strategy

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2Fh5bOURuGH5JfprgdVsFo%2FFlash%20Mints.png?alt=media&amp;token=3d0295ad-02b8-470a-9795-b8ac9cd54a0a" alt=""><figcaption></figcaption></figure>

[Flash loans](https://www.techopedia.com/definition/flash-loan) allow borrowers to access the liquidity of an entire lending pool without requiring any collateral, under one essential condition: the borrowed sum, along with any fees, must be repaid within the same transaction block. If this condition is not met, the transaction is reversed, ensuring the lender incurs no loss.

A FlashMint, on the other hand, involves the minting of tokens within a single transaction block, with the requirement that the minted tokens are burned by the end of the same transaction. This mechanism provides temporary access to a large number of tokens without being constrained by the size of a lending pool, as is the case with flash loans.

dApps can leverage FlashMint to enhance their functionality and offer advanced financial operations to their users, including [arbitrage](https://www.investopedia.com/terms/a/arbitrage.asp), [collateral swaps](https://www.marketswiki.com/wiki/Collateral_swap), [debt refinancing](https://corporatefinanceinstitute.com/resources/commercial-lending/debt-refinancing/), [liquidation](/protocol/liquidations), and other financial strategies.

### FlashRepay

FlashRepay facilitates the repayment of existing debts, allowing users to unlock collateral, which can then be converted into XY to settle the FlashMint amount. This process enables users to manage their [liabilities](https://www.investopedia.com/terms/l/liability.asp) more flexibly.

A FlashLiquidate function will be introduced down the line to allow external liquidators to liquidate positions without needing to hold a balance of XY. By removing this barrier, participation in the ecosystem is increased, thereby enhancing its overall security.

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FiokVyFbOlA32LQQZcw3c%2FFlashRepay.png?alt=media&amp;token=794683b3-1bb5-4d44-b8b8-7633545a4031" alt=""><figcaption></figcaption></figure>

### FlashBorrow

FlashBorrow provides a streamlined mechanism for users to leverage their assets through a simple, repeatable process. By borrowing XY, converting it into collateral, and redepositing it into the smart contract, users can incrementally amplify their original collateral. The key advantage of using flash loans is that all these steps are executed within a single transaction, making the process of increasing [leverage](/protocol/hooks/looping-leverage) efficient and seamless.

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2Fx6NBOY3OxB4EfgupMzOH%2FFlashBorrow.png?alt=media&amp;token=5f836ec1-bd74-4417-93a0-30d9273f2ad7" alt=""><figcaption></figcaption></figure>


# Fees

Fees on Tren Finance can largely be divided into Minting Fees, and Performance Fees

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FehwKzJhRAsacJkDRi5d3%2Ffees.png?alt=media&amp;token=df2df064-acdd-46b0-bda2-193227bdfcb3" alt=""><figcaption></figcaption></figure>

## Minting Fee

A minting fee is a charge incurred when you borrow assets, in this case, XY, using your collateral in a [TrenBox](/protocol/isolated-modules#trenbox). This fee is typically a percentage of the borrowed amount and is applied to compensate the protocol for the lending service and the associated risks.

The minting fee, which is typically set at 1%, is charged at the time of borrowing. This means that when you create a new loan by borrowing XY against your collateral, the fee is calculated based on the amount you borrow and is added to your total debt. The specifics of the borrowing fee, such as its rate and how it is applied, can vary depending on the protocol's parameters and the specific collateral type used.

### FlashMint Fee

[FlashMint](/protocol/flashmint) offers infinite on-demand liquidity for arbitrage, refinancing, and other complex DeFi transactions. On Tren Finance, FlashMint is used to perform functions such as [FlashRepay](/protocol/flashmint#flashrepay) and [FlashBorrow](/protocol/flashmint#flashborrow). Due to the flexibility and opportunities that this functionality offers, FlashMint fees are typically double the rate of regular Minting fees.

***

## Performance Fee

A performance fee is a periodic charge applied to the yield accrued by the collateral asset in your TrenBox. This fee is to compensate the protocol for overall yield and strategy optimization for the user's collateral asset (deposit), such as auto-compounding.&#x20;

In this aspect, Tren Finance acts as a vault similar to Beefy or Yearn. Unlike minting fees, performance fees are only charged on the [accrued yield](https://www.investopedia.com/terms/a/accruedinterest.asp). The specifics of the performance fee, such as its rate and how it is applied, can vary depending on the protocol's parameters and the specific collateral type used.

### How Do Performance Fees Work?

As Tren Finance offers 0% interest loans, a performance fee is charged to generate revenue and ensure that the protocol stays profitable. This is also why the protocol focuses on, and lists assets that are able to generate yield. If an asset were incapable of generating yield, then the asset's isolated module would need to charge an interest rate.

As mentioned, this is similar to how vaults on protocols like [Beefy](https://docs.beefy.finance/) and [Yearn](https://docs.yearn.fi/) work. These protocols only offer vaults for assets that can be used to generate yield. Tren Finance's collateral deposits essentially work in the same way. Once a user deposits a collateral asset onto Tren Finance, the user can use this collateral to borrow XY, which can be used in a multitude of different ways including gaining [leverage](/protocol/hooks/looping-leverage). The ability to borrow against the collateral asset is unlike how vault protocols work, but the next part is.

On Tren Finance's end, the protocol takes the collateral asset and deploys the asset in the optimal yield strategy through [Hooks](/protocol/hooks). The yield continues to accrue, and includes the optionality of auto-compounding. Users can claim their accrued yield at any time. Once the user claims their accrued yield, a performance fee  percentage is charged on the total accrued yield. The [APY](https://www.investopedia.com/terms/a/apy.asp) that is shown on the protocol already takes this performance fee into account. Functionalities such as auto-compounding cost  the protocol [gas fees](https://www.coingecko.com/learn/gas-fees), and so performance fees are also used to cover such fees for the protocol.

***

## Protocol-Originated Revenue

Protocol-originated revenues are fees that the protocol earns on its own, or through members of the Tren Finance team, and are not fees that are paid by, or generated from users.  The most notable example of this is Protocol LP Revenue.

### **Protocol LP Revenue**

Revenue earned from [XY](/tokens/xy) and [TREN](/tokens/tren-and-vetren) (upon TGE) liquidity pools with liquidity that originates from Tren Finance. For example, if Tren Finance added 100K USD of liquidity to XY, then the LP fees generated would be considered protocol-originated revenue.&#x20;

***

## Where Do These Fees Go?

90% of all protocol revenue is directed towards [TREN](/tokens/tren-and-vetren) buybacks, while the other 10% of protocol revenue is directed towards the Treasury. TrenDAO (veTREN holders) decide how the TREN buybacks are allocated, which is explained in detail on the [Gauges](/protocol/gauges) page. This process allows the TrenDAO to have a direct impact on the direction of the protocol.


# Single Sided Liquidity (SSL)

The SSL Program will be used for Tren Finance's Liquidity Generation Event

## What is Single Sided Liquidity (SSL)?

The Single Sided Liquidity (SSL) Program enables users to contribute stablecoins to establish or augment [liquidity pools](https://www.coingecko.com/learn/liquidity-pools-crypto-defi) with Tren Finance’s synthetic dollar, [XY](/tokens/xy). This approach simplifies the liquidity provision process by allowing users to deposit stablecoins without the need to acquire multiple tokens. With SSL, users simply need to deposit their stablecoins. Tren Finance’s Liquidity Generation Event (LGE) is facilitated through the Single Sided Liquidity (SSL) contract.

### Deposit Process:

Users deposit stablecoins into the SSL contract, which then mints an equivalent amount of XY tokens. These XY tokens are paired with the deposited stablecoins to form a liquidity pool. For instance, depositing 500 units of a stablecoin results in the creation of 500 XY tokens, culminating in a total liquidity of $1,000. The flow for depositing stablecoin(s) into the SSL is shown below:

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2F3YTv8FWrSVdvTYTspkg3%2FSSL%20Program%20(1).png?alt=media&amp;token=579d7e10-d410-4803-a2a6-68f96bb90f1b" alt=""><figcaption></figcaption></figure>

### Withdrawal Process:

Users can withdraw their contributions by removing their share from the liquidity pool, receiving back their initial stablecoin deposit along with any accrued rewards. Users may withdraw more stablecoins than they initially put up as swap fees from [DEX](https://coinmarketcap.com/academy/glossary/decentralized-exchange-dex) are autocompounded back into the position. There are no locks however there is a 14 day withdrawal period when withdrawing for stability reasons. The flow for withdrawing stablecoin(s) from the SSL is shown below:

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FfTd6COgnWdD2NEd1vDr5%2FSSL%20Program.png?alt=media&amp;token=20d06783-29ec-4c55-a5d8-2c03fa4b3935" alt=""><figcaption></figcaption></figure>

### Claiming:

Rewards in TREN are earned every second using an amended [MasterChef](https://docs.sushi.com/docs/Products/Chefs%20&%20Farms/MasterChef/Overview)-style contract for reward distribution. This ensures that users’ rewards are continuously calculated in real-time based on their stablecoin deposit and the time their funds remain in the SSL Program.

While users can see their rewards accrue, they won’t be able to claim them immediately. The claiming function will be added to the contract after the Token Generation Event (TGE). Once this function is implemented users can claim their earned [TREN](/tokens/tren-and-vetren) tokens whenever they choose.

***

### Benefits

#### Double Liquidity

The Single Sided Liquidity Program offers 2x the liquidity offered by normal [LP](https://www.coingecko.com/learn/liquidity-pools-crypto-defi)s. As an example, let's say a user has 500 of stablecoin A, and they want to create a liquidity pool of stablecoin A and B. If the user doesn't have any stablecoin B, then the user will need to sell half of their stablecoin A holdings to create a stablecoin A and B liquidity pool (assuming 50-50 LP balance), which leads to a total of $500 in liquidity ([TVL](https://www.investopedia.com/total-value-locked-7486821#:~:text=Total%20value%20locked%20\(TVL\)%20is,or%20decentralized%20applications%20\(dApps\).)).

Unlike the example above, when a user deposits 500 of stablecoin A, the SSL contract will mint 500 XY to pair with 500 stablecoin A, for a total of $1,000 in liquidity. Users also receive rewards based on this total liquidity.

#### Saved Costs

Creating or adding to a liquidity pool typically takes numerous steps, with each step costing [gas fees](https://www.coingecko.com/learn/gas-fees). Often times, particularly for smaller amounts of capital, the gas fee costs outweigh the rewards that a liquidity pool might offer. With SSL, users only need to take one step in depositing their stablecoin.

#### Rewards in Tokens, not Points

Single Sided Liquidity Providers receive yield in the form of [TREN](/tokens/tren-and-vetren) tokens. This TREN cannot be claimed until TREN TGE. Users can see the amount ofTREN tokens they will receive by inputting the number of stablecoins and length of time in the SSL Program through the front-end calculator.

### APY by TVL

| TVL           | APY     |
| ------------- | ------- |
| $1,000,000.00 | 208.57% |
| $1,500,000.00 | 139.05% |
| $2,000,000.00 | 104.29% |
| $2,500,000.00 | 83.43%  |
| $3,000,000.00 | 69.52%  |
| $3,500,000.00 | 59.59%  |
| $4,000,000.00 | 52.14%  |
| $4,500,000.00 | 46.35%  |
| $5,000,000.00 | 41.71%  |

***

### Security & Risks

Participating in the Liquidity Generation Event (LGE) with Tren Finance offers contributors a secure and innovative approach to liquidity provisioning. While any blockchain activity carries inherent risks, Tren Finance has implemented robust measures to mitigate these risks and safeguard participant funds.

#### Smart Contract Dependencies

Tren Finance integrates third-party smart contracts to power its liquidity provisioning model, making their security crucial.

#### Impermanent Loss

As the deposited stablecoins are paired in a liquidity pool with XY, there is [impermanent loss](https://www.techopedia.com/definition/impermanent-loss) risk. If XY appreciates against the deposited stablecoin, the user will receive more of the deposited stablecoin than was originally deposited. If XY depreciates against the deposited stablecoin, the user will receive less of the deposited stablecoin than was originally deposited, and instead receive additional XY instead. If XY is below peg, since XY is programmed to equal 1 USD in the smart contract, the user may receive back a lower market value than the original deposited stablecoin value amount.

#### Market Volatility

Token value fluctuations can affect the liquidity pool's value and the returns of contributors.

***

### How Tren Finance Minimizes Risks

#### Audited

The core SSL contracts developed by Tren Finance have been independently audited by Zokyo, a renowned blockchain security firm. This audit ensures the integrity, reliability, and security of the contracts underpinning our liquidity generation process. Additionally we leverage the trusted infrastructure of Gamma.xyz, whose smart contracts have undergone rigorous audits by leading blockchain security firms, including:

* Zokyo: [Read Audit](https://github.com/zokyo-sec/audit-reports/blob/main/Tren%20Finance/Tren%20Finance_Zokyo_audit_report_Nov19th_2024.pdf)
* OpenZeppelin:[ Read Audit](https://github.com/GammaStrategies/hypervisor/blob/master/Gamma%20Security%20Review%20\(Jan%202024\).pdf)
* ConsenSys Diligence:[ Read Audit](https://github.com/GammaStrategies/hypervisor/blob/master/audits/ConsenSys-Diligence-Audit-28-03-22.pdf)
* Arbitrary Execution:[ Read Audit](https://github.com/GammaStrategies/hypervisor/blob/master/audits/AE_Gamma_audit_09_03_22.pdf)

#### Reduced Impermanent Loss

Tren Finance minimizes impermanent loss by providing XY for the LP position, optimizing the liquidity provisioning strategy and reducing risk exposure caused by token price fluctuations.

#### Continuous Monitoring and Transparency

Our contracts are transparent and open-source, enabling ongoing community review. Additionally, our team monitors activity to detect and address potential vulnerabilities swiftly.

***

### Why Single Sided Liquidity?

Aside from the benefits and reduced risks for users mentioned in the sections above, there is another key reason why we chose this approach:

#### Peg Stability

The Single Sided Liquidity Program's overall goal can be viewed as peg stability for XY - generate enough liquidity for XY so that users can easily swap in and out of XY without significant slippage.&#x20;

But there's another way in which the Liquidity Generation Event will help with XY peg stability -The Tren Finance team will also deposit an undisclosed amount of stablecoins into the Single Sided Liquidity Program to generate **protocol-owned XY**. This buffer of protocol-owned XY offers flexibility and a number of different strategies that the protocol can employ for peg stability purposes.

As an obvious example, when XY is above peg, the protocol can mint additional XY to restore peg. When XY is below peg, the minted XY can be burned so that the original stablecoin deposits are recovered. The original stablecoin deposits can then be used for peg defense purposes, and re-deposited into the SSL once peg restores. You can read more about how Tren Finance handles XY peg stability [here](/tokens/xy#peg-stability). It will be difficult for the protocol to acquire XY through overcollateralized loans on the dApp, so the Liquidity Generation Event provides a perfect opportunity while bolstering XY liquidity at the same time.

As described in the [XY](/tokens/xy#handling-trenusd-above-its-peg-1) page, there's one more way in which the SSL program helps with XY peg stability. The use of SSL contracts for XY liquidity provides even further peg stability mechanisms through [Peg Stability Contracts](/tokens/xy#peg-stability-contracts). This abiliity to rebalance the liquidity pools in the AMMs for the SSL creates another buffer for long-term peg maintenance.&#x20;

***

### Which Blockchain is the Liquidity Generation Event on?

The Liquidity Generation Event is on **Arbitrum**

### Which Stablecoins are Eligible for the Liquidity Generation Event?

The following stablecoins are currently eligible:

* USDT
* USDC

Based on demand, we will look to expand the list of eligible stablecoins.  We'll take a look at how each pool works below:

### USDT

The USDT/XY liquidity pool is a Uniswap v3 pair, managed by [Gamma](https://blog.tren.finance/gamma-partnership). Relevant links can be found below:

#### Uniswap: <https://app.uniswap.org/explore/tokens/arbitrum/0xd4fe6e1e37dfcf35e9eeb54d4cca149d1c10239f>

#### Gamma:                                                                        <https://app.gamma.xyz/vault/uni/arbitrum/details/xy-usdt-500-stable>

### USDC

The USDT/XY pair is a Curve liquidity pool using a standard Curve single sided deposit system. Relevant links can be found below:<br>

**Curve:**                                                                                                      [**https://curve.fi/#/arbitrum/pools/factory-stable-ng-115/deposit**](https://curve.fi/#/arbitrum/pools/factory-stable-ng-115/deposit)

#### \*Please note that for both USDT and USDC, you must deposit via [app.tren.finance](https://app.tren.finance/) to be eligible for LGE rewards. You will NOT be eligible for LGE rewards if you deposit or add liquidity anywhere else.\*


# Gauges

Learn about the different gauges on Tren Finance, and why users are incentivized to vote responsibly

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2F3qPm1cTaPB9jibMH1foN%2FGauges.png?alt=media&amp;token=b3066550-a3be-42fd-a48a-5f6918678ef7" alt=""><figcaption></figcaption></figure>

## What are Gauges?

Gauges are used to determine how protocol revenue and rewards are allocated. Unlike other protocols, which primarily focus on liquidity mining rewards (i.e. which liquidity pools receive the most rewards), gauges on Tren Finance are also used to determine how rewards are allocated amongst [veTREN](#vetren) holders, the [Insurance Pool](#insurance-pool), [TREN burns](#tren-burns), along with [liquidity mining rewards](#liquidity-mining-rewards) and its subsets. This ensures that committed stakeholders (the [TrenDAO](/tokens/tren-and-vetren#what-is-vetren)) directly control the future of the protocol.

### Voting Epoch

Voting power for gauges is determined by the amount of [veTREN](/tokens/tren-and-vetren#vetokenomics) held. Votes are held on a weekly basis (one week is considered an epoch), which means that votes can be cast at any time during the week until the deadline to determine gauge rewards for the following epoch week.&#x20;

Once a user votes on a gauge, the vote / vote power will persist unless it is changed. There is a 10-day cool down period before users can change their votes.&#x20;

### What is the Reward Token for Gauges?

The protocol uses 90% of its generated revenue for [TREN buybacks](/tokens/tren-and-vetren). These buybacks, along with ecosystem rewards, will be used to reward gauges with TREN.

### Balancing Risk vs Reward

The power to vote on Gauges provides a glimpse into the delicate balance between managing risk and reward on a protocol like Tren Finance. The temptation is to direct a large portion of revenue to veTREN holders and TREN token burns for higher rewards and quick TREN price appreciation.&#x20;

However, if the risk management aspect of gauges is ignored, this will likely have detrimental effects on the protocol, and accordingly the TREN token price. For example, if rewards aren't high enough to incentivize a sufficient amount of XY in the Insurance Pool, the protocol could face [bad debt](https://www.investopedia.com/terms/b/baddebt.asp). And if rewards aren't high enough to incentivize a sufficient amount of liquidity for XY, users will face higher slippage on functionalities like leverage, and a low amount of liquidity could negatively impact the [XY peg](/tokens/xy#peg-stability).&#x20;

***

We'll look at each of the different gauges that users can vote on below:

### Liquidity Mining Rewards

This gauge is used to determine the amount of rewards that are allocated towards XY and TREN liquidity pools. Each liquidity pool has a separate gauge that is voted on separately.&#x20;

#### Why Vote for this Gauge?

* TREN Liquidity Pools - Strong liquidity for TREN acts as a price stabilizer, and reduces volatility. Potential buyers may also be discouraged from investing in TREN if high slippage is involved in transactions
* XY Liquidity Pools - XY liquidity is paramount to the overall success of the protocol. For functions like leverage, sufficient XY liquidity is especially important as it involves swapping in and out of potentially large amounts of XY. If these swaps cause high [slippage](https://www.investopedia.com/terms/s/slippage.asp), users lose capital efficiency, and certain functionalities on the protocol cease to become profitable. As a result, the protocol loses users, and accordingly, the future revenue that these users bring by using the protocol.

#### Bootstrapping Pairs with XY

Bootstrapping liquidity for an asset is a capital intensive process. Due to the way that Gauges work on Tren Finance, project founders have another option to bootstrap liquidity for their token(s) with potentially lower capital. Project founders can purchase TREN, and maximise their voting power by locking into [veTREN](/tokens/tren-and-vetren#vetokenomics). They can then use this voting power to direct TREN incentives to the project token's liquidity pool paired with XY. Through these TREN rewards, users are incentivised to add additional liquidity to the liquidity pool. This can create a soft price floor for TREN, as at certain price points, it becomes cheaper for projects to bootstrap liquidity through Tren Finance's Gauges compared to other alternatives.&#x20;

### Insurance Pool

The [Insurance Pool](/protocol/liquidations) and Insurance Providers play a vital role in the safety of the protocol. While most liquidations are expected to be profitable for Insurance Providers (XY stakers), they do face the potential of taking on bad debt. As such, a sufficient amount of rewards needs to be allocated to the Insurance Pool.

#### Why Vote for this Gauge?

Insurance Providers act as the primary line of defense against bad debt on Tren Finance, and therefore need to be rewarded appropriately for taking on this risk. We expect this gauge to receive the highest percentage of overall rewards, as it has the most impact on all stakeholders.

For example, XY LP holders will also want to vote on this gauge as it could lead to impermanent loss. If Insurance Providers weren't compensated appropriately, bad debt could accrue, leading to XY depeg, and accordingly impermanent loss for XY LP holders.

For TREN, veTREN, and TREN LP holders, accrued bad debt also has severe negative implications. Bad debt and a potential XY [depeg](https://www.theblock.co/learn/251861/what-is-a-depegging-in-the-context-of-stablecoins) would cause users to lose faith in the future of the protocol, harming protocol revenue, all of which would likely lead to detrimental effects on the TREN token price.

### TREN Burns

TREN is designed to be a long-term [deflationary](https://corporatefinanceinstitute.com/resources/cryptocurrency/cryptocurrency-inflation-deflation/) asset through TREN token burns. As rewards for all gauges are provided in TREN tokens, once the amount of TREN tokens to be burnt has been decided, the TREN tokens in the rewards pool allocated for this gauge will be burned. &#x20;

#### Why Vote for this Gauge?

Token burns and a diminishing token supply are one of the most effective ways to increase buying pressure on an asset. Such [buybacks](https://www.investopedia.com/terms/b/buyback.asp) and burns can also act as an effective marketing tactic to gain exposure to potential investors and users of the protocol.

### veTREN

This gauge is to determine the amount of rewards that are allocated to veTREN holders. In order to acquire veTREN, a user must first acquire TREN, and then lock their TREN. veTREN is [calculated](/tokens/tren-and-vetren#calculation-of-vetren) based on the number of TREN locked up, and the duration of the lock-up.&#x20;

#### Why Vote for this Gauge?

By locking TREN for veTREN, veTREN holders take on fundamental risk by delaying their access to liquidity. These users are essentially betting on the future of the protocol, and should be compensated appropriately for this risk. A high amount of rewards for veTREN holders also reduces selling pressure on TREN by encouraging users to lock their TREN.

## Flywheel Effect Through Gauges

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2F05Wji3Sqyy92nOlOb2HD%2FTren%20Finance%20Flywheel%20Effect.png?alt=media&amp;token=ef770211-5556-4943-a41e-d3410d35195a" alt=""><figcaption></figcaption></figure>


# Roadmap

An overview of Tren Finance's development timeline and milestones.

Our development follows a strategic progression toward building TrenOS, the first AI-powered operating system for DeFi. Each phase represents progression toward full protocol autonomy through specialized AI agents that manage borrowing parameters, risk assessment, and protocol operations.

The roadmap traces our path from core protocol deployment to a fully autonomous system. With our borrowing protocol proven through comprehensive testing and security audits, we now focus on integrating the AI agent network that will automate protocol management without human intervention.

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FF15CE4R6xZJw9MKzO9Nh%2Froadmap.png?alt=media&amp;token=71e21211-5e1b-4a69-91b8-31681e5a85b7" alt=""><figcaption></figcaption></figure>

#### Testnet (Done)&#x20;

Deployment and testing of the borrowing protocol in a public testnet environment.

* Protocol deployment on Sepolia
* Closed access testing and feedback from community
* Audit by Omnisica

#### Devnet Phase 1 (Done)

Expansion of core protocol functionality with advanced features in development environment.

* LP token support
* Vault tokens support
* Custom price feed implementations
* Leverage hooks
* Flash repay hook
* Flash minting
* Audits by Zokyo & Halborn

#### Devnet Phase 2 (Done)&#x20;

Integration of AI agent network in a staged testnet environment synced to Base's mainnet for testing with live price data.

* Interest rate agent
* Asset risk analyst agent
* XY manager agent
* Collateral manager agent
* Peer to Agent Loans

#### Mainnet&#x20;

Initial launch of Tren Finance protocol on mainnet with core features and functioning AI agents.

* TREN community sale and TGE
* XY TGE
* Launch of liquidity pools
* Tren Finance (Peer-to-Protocol) Mainnet launch on Base
* Malone (Peer-to-Agent) Mainnet Launch with support for ERC20 tokens on Base
* Compensation plan for users of SSL program

#### Post-Mainnet Expansion Phase 1

Scaling TrenOS infrastructure and core agent capabilities with multi-chain deployment and enhanced user experience features.

* Multi-chain deployment focusing on Layer 2 solutions with high DeFi activity
* XY Native token bridging across multiple chains
* Treasury agent deployment for protocol fund management
* Support for vested streams as collateral for Malone
* Notification system for Malone to alert users of position changes

#### Post-Mainnet Expansion Phase 2

Advanced agent network integration and external protocol connectivity to establish TrenOS as the operating system for DeFi.

* Ecosystem agent launch for cross-protocol coordination
* Developer SDK & API for third-party integration with the AI agent network
* Predictive liquidation prevention agent
* Support for NFTs as collateral for Malone
* Custom DeFi LLM training for enhanced agent decision-making


# XY

XY is the core liquidity driver powering the Tren Finance ecosystem

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FwXtxOXYootTlClzVCDKa%2Fxy.png?alt=media&amp;token=013f0db9-c96f-44cb-a1aa-d9e1c308acbc" alt=""><figcaption></figcaption></figure>

XY is a synthetic dollar debt token backed by overcollateralized loans. The token was built using LayerZero's [Omnichain Fungible Token](https://docs.layerzero.network/v2/home/token-standards/oft-standard) (OFT) standard, allowing XY to be transferred across multiple blockchains without asset wrapping, middlechains, or liquidity pools.

### Is XY Similar to Other Stablecoins? <a href="#handling-trenusd-above-its-peg" id="handling-trenusd-above-its-peg"></a>

Stablecoins can largely be divided into three categories. We'll take a look at each with their pros and cons along with some examples, and explain where XY fits in.

#### Fiat-backed&#x20;

The most notable examples of fiat-backed stablecoins are [USDT](https://www.coingecko.com/en/coins/tether) and [USDC](https://www.coingecko.com/en/coins/usdc). Because of over-collateralized fiat-backing, these stablecoins are able to maintain peg easily. Due to their centralised nature however, these stablecoins are not decentralised.

#### Algo-backed&#x20;

It's difficult to envision purely algo-backed stablecoins nowadays, but for a time, stables like Terra [UST](https://www.coingecko.com/en/coins/terraclassicusd) gained significant marketshare. These projects offered decentralisation, but were typically under-collateralised and relied on algorithmic incentive mechanisms to maintain peg.

#### Crypto-backed

Stablecoins like [DAI](https://www.coingecko.com/en/coins/dai) and [USDe](https://www.coingecko.com/en/coins/ethena-usde) fit into this category. These projects maintain high levels of decentralisation, while being over-collateralised by crypto assets. Crypto-backed stablecoins can be viewed as a compromise between fiat-backed and purely algo-backed stablecoins. Due to the volatile nature of crypto assets, crypto-backed stablecoins do still offer risk. We explain how XY maintains its peg later on in this page.

### Where Does XY Fit in? <a href="#handling-trenusd-above-its-peg" id="handling-trenusd-above-its-peg"></a>

XY doesn't fit into just one cateogory, as it is crypto-backed with algorithmic properties for scalability purposes. When we say algorithmic properties, it's important to note that XY is crypto-backed by overcollateralised loans, along with liquidity through our [SSL](/protocol/single-sided-liquidity-ssl) contracts, and does not rely on purely algorithmic incentive mechanisms to maintain peg like Terra's [LUNA](https://www.coingecko.com/en/coins/terra-luna-classic)-[UST](https://www.coingecko.com/en/coins/terraclassicusd) model. We'll explain what we mean by algorithmic properties below:

As explained, each $1 of XY is backed typically by over $1 worth of collateral. However, Peg Stability Contracts are used to rebalance XY balances on AMMs to keep the peg at $1. The goal of these Peg Stability Contracts is to keep the liquidity balance between XY and other stables close to 50-50 on AMMs. The way that these Peg Stability Contracts works is quite simple, which we'll show below using the [XY-USDC Curve Pool](https://curve.fi/#/arbitrum/pools/factory-stable-ng-115/deposit) as an example.&#x20;

#### Peg Stability Contracts

* If the LP composition is 60% USDC and 40% XY, the Peg Stability Contracts will mint more XY to the pool to restore peg
* If the LP composition is 60% XY and 40% USDC the Peg Stability Contracts will burn XY allocated to the pool to restore the peg
  * The amount of XY that can be burned is limited to the amount of XY provided by the [SSL](/protocol/single-sided-liquidity-ssl) contract

Whenever the LP compositions are imbalanced, Tren Finance's Treasury calls on Peg Stability Contracts to update the liquidity pool. The [XY-USDT Gamma Vault](https://app.gamma.xyz/vault/uni/arbitrum/details/xy-usdt-500-stable) works similarly to this, and autonomously rebalances the liquidity pool composition to maintain peg. Other forms of [peg stability](#peg-stability) are described below.

***

### What Can I Do With XY?  <a href="#handling-trenusd-above-its-peg" id="handling-trenusd-above-its-peg"></a>

Users can gain yield with XY in two ways:

#### Add to XY Liquidity

Users can earn high yields through adding to XY liquidity pools. The [leverage](/protocol/hooks/looping-leverage) functionality on Tren Finance involves swapping in and out of XY, which leads to higher volumes on XY liquidity pools, and accordingly higher yields for XY LP holders.&#x20;

#### Stake XY in the Insurance Pool

Insurance Providers earn yield from liquidating collateral discounted to the market value. Insurance Providers in the Insurance Pool lose a pro-rata share of their XY deposits corresponding to the amount of debt repaid. In exchange, they receive a pro-rata share of the liquidated collateral at a discount. Read more about this process in our [Liquidations](/protocol/liquidations) page.

#### How Can I Acquire XY?

1. Mint XY through isolated modules on Tren Finance
2. Buy XY on DEXs

***

## Peg Stability

### XY Above 1 USD Peg <a href="#handling-trenusd-above-its-peg" id="handling-trenusd-above-its-peg"></a>

When XY exceeds its target peg, the protocol takes the following steps to restore XY back to target peg upon a successful governance vote and proposal by the TrenDAO:

1. **Mint XY**: Additional XY is minted to increase the supply.
2. **Sell for Stablecoins**: A portion of the newly minted XY is sold in exchange for stablecoins.
3. **Enhance Liquidity**: The acquired stablecoins, along with the remaining newly minted XY, are used to bolster the liquidity pools. This dual approach helps drive the XY price back down to its peg and simultaneously strengthens XY liquidity reserves.

Additionally, users who possess valid collateral may notice that XY is trading above 1 USD in certain markets. They might choose to initiate positions and sell the borrowed XY to allocate funds elsewhere. This action can contribute to a decrease in the price of XY relative to the trading volume.

### XY Below 1 USD Peg <a href="#handling-trenusd-above-its-peg" id="handling-trenusd-above-its-peg"></a>

#### Peg Arbitrage <a href="#handling-trenusd-above-its-peg" id="handling-trenusd-above-its-peg"></a>

Users who have borrowed XY may observe that it is trading at a discount to 1 USD in some markets. In response, they might purchase XY at this discounted rate to reduce their debt. This influx of buying activity can drive up the price of XY relative to the trading volume.

Individuals holding various cryptocurrencies, whether stablecoins or not, might observe disparities in XY's trading prices across the aforementioned markets. They could opt to buy XY in a market where the price is below 1 USD and sell it in another market where the price is at or above 1 USD.&#x20;

#### XY Buyback and Burn Program <a href="#handling-trenusd-above-its-peg" id="handling-trenusd-above-its-peg"></a>

When XY is below its target peg, the protocol takes the following steps to restore XY back to target peg upon a successful governance vote and proposal by the TrenDAO:

* **Buy XY**: Protocol revenue, and, depending on severity, other forms of protocol funds such as the Treasury, are used to buy XY
* **Burn XY**: The XY that has been bought is burned.&#x20;

This [buyback](https://www.investopedia.com/terms/b/buyback.asp) and [burn](https://coinmarketcap.com/academy/glossary/burned) program is designed to increase buying pressure on XY, and decrease XY supply, allowing for greater price appreciation back to its target peg.

***

### Why Doesn't XY Have a Redemption Mechanism? <a href="#handling-trenusd-above-its-peg" id="handling-trenusd-above-its-peg"></a>

Overall, we have observed that [redemptions](https://docs.gravitaprotocol.com/gravita-docs/how-does-gravita-work/redemptions-and-liquidations) act as a net negative to CDP protocols in most instances. The key benefit that redemptions offer is speed. With redemptions, debt tokens are immediately brought back to peg, whereas a debt token buyback and burn program will take more time to achieve target peg.

The detriment at which this speed is achieved, however, is too great to outweigh its benefits. Redemptions come directly at the expense of users, and we believe users are the greatest asset that any protocol has. By effectively sacrificing users' collateral and loan positions at the expense of speedy peg recovery, redemptions essentially place users in a PvP scenario resulting in increasingly lower [LTV thresholds](/protocol/isolated-modules#loan-to-value-ltv), and thereby also lowers capital efficiency. While a XY buyback and burn program may take longer to achieve peg stability in the event of a prolonged XY depeg scenario, we believe that this approach outweighs the benefits of introducing a redemption mechanism.


# TREN & veTREN

TREN is a fixed-supply value accrual token architected on the principles of the ve(3,3) model

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FUF9jx25LxCoAEoOKiIqx%2Ftren.png?alt=media&amp;token=ef2fa019-aeab-4aa9-928c-d7882e371c26" alt=""><figcaption></figcaption></figure>

**Contract Address (Base): 0xa77E22bFAeE006D4f9DC2c20D7D337b05125C282**

### What is TREN? <a href="#what-is-tren" id="what-is-tren"></a>

TREN is the [value accrual](https://www.grayscale.com/research/reports/the-battle-for-value-in-smart-contract-platforms) token for Tren Finance, with 90% of protocol revenue directed towards TREN [buybacks](https://www.investopedia.com/terms/b/buyback.asp). The token supply is designed to diminish over time through [TREN burns](/protocol/gauges#tren-burns), and starts at a fixed initial supply of 1 billion tokens. As the cornerstone of our ecosystem, TREN plays a crucial role in aligning incentives among stakeholders and fostering the development of a sustainable hybrid DAO-governed protocol.

### Tokenomics

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FBvJM9VmKf34sn5dXNXZ4%2FTokenomics%20TREN%20V2.png?alt=media&amp;token=2a31fa85-3f02-4557-b98a-9151d4848492" alt=""><figcaption></figcaption></figure>

| Allocation | % of Supply | Amount of Tokens | TGE % of Allocation | % of Supply unlocked at TGE | Cliff (Months) | Daily Vesting (Months) | Total Vesting (Months) |
| ---------- | ----------- | ---------------- | ------------------- | --------------------------- | -------------- | ---------------------- | ---------------------- |
| VCs        | 3.87%       | 38,700,000       | 0%                  | 0%                          | 0              | 6                      | 6                      |
| Team       | 15%         | 150,000,000      | 0%                  | 0%                          | 12             | 24                     | 36                     |
| Community  | 55.84%      | 558,400,000      | 0%                  | 0%                          | 0              | 60                     | 60                     |
| KOLs       | 2%          | 20,000,000       | 0%                  | 0%                          | 0              | 3                      | 3                      |
| Treasury   | 15%         | 150,000,000      | 0%                  | 0%                          | 0              | 36                     | 36                     |
| Launchpads | 2.29%       | 22,900,000       | 100%                | 2.29%                       | 0              | 0                      | 0                      |
| Liquidity  | 6%          | 60,000,000       | 50%                 | 3%                          | 0              | 6                      | 6                      |

***

## veTokenomics

### What is veTREN?

veTREN stands for "vote-escrowed TREN," a modification of the [veTokenomics](https://www.coingecko.com/learn/vetokens-and-vetokenomics) model prevalent in DeFi that encourages long-term governance participation and investment. Unlike regular TREN tokens, veTREN cannot be transferred and is used to gauge the voting power and economic commitment of users who choose to lock their TREN tokens for a specified duration.&#x20;

Through veTREN, Tren Finance not only ensures robust governance and fosters long-term engagement, but also aligns holder incentives with the overall success and profitability of the platform. By enabling veTREN holders to capture a significant portion of the protocol's full economic activity, it underscores a superior model for value accrual compared to traditional lending platforms. This strategic approach enhances governance effectiveness and ensures that committed stakeholders have a substantial impact on the protocol’s direction and financial health.

### Token Lockup and Voting Power

Users commit their TREN tokens to obtain veTREN, with the lockup period ranging from one week to a maximum of 4 years. veTREN works nearly identical to Curve's [veCRV](https://curve.readthedocs.io/dao-vecrv.html) model. The duration of the lockup significantly influences the user's voting power and potential yield, embodying the principle: the longer the lock, the greater the influence and rewards. veTREN is designed so that even users with low TREN holdings can still have a significant impact on the ecosystem through locking.&#x20;

### Calculation of veTREN

The amount of veTREN a user receives is determined by the number of TREN tokens they lock and the duration of the lockup:

$$
veTREN = {TREN \* lockTime\over 4 years}
$$

For example, if a users locks up 100 TREN for 219 days, they would receive 15 veTREN:

$$
15 = {(100 \* 219)\over (4 \* 365)}
$$

When a user locks their TREN tokens for veTREN, they will receive veTREN based on the lock duration and the amount locked. Locking is not reversible and veTREN tokens are non-transferable. If a user decides to lock their TREN tokens, they will only be able to reclaim the TREN tokens after the lock duration has ended. Users can withdraw their TREN at any time after their veTREN has decayed to 0 (lock time has expired).

Additionally, a user cannot have multiple locks with different expiry dates. However, a lock can be extended, or additional TREN can be added to it at any time.

### veTREN Decay

The amount of veTREN a user has will decay linearly over the chosen lock time as their unlock date draws closer. There are two ways a user can change their lock. They can add to their lock or they can extend their lock. What happens in both situations and how it affects their veTREN and the decay is shown in the charts below.

#### Extending Locks

Extending locks means increasing the time left on a lock. If a user locked 100 TREN for 4 years, after 3 years the user would only have 25 veTREN left as the lock time is now 1 year. If the user extended the lock to be 4 years again after these 3 years, the user would again have 100 veTREN:

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FEn8BeN3O90aiC9ACIkrG%2Fvetren2.png?alt=media&amp;token=8cd81afe-f4f4-4924-9945-87a4aa1ee376" alt=""><figcaption></figcaption></figure>

#### Locking up Additional TREN

Adding TREN to locks means the unlock date will remain the same, but more TREN will be locked, meaning more veTREN. If a user locked 100 TRENV for 4 years, but after 2 years added 200 TREN to their lock, the user would have 150 veTREN (300 TRENRV total locked for 2 years). This veTREN would continue to decay to 0 over the next 2 years:

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FFfkbgplkfu8oz7tmXqPm%2Fvetren1.png?alt=media&amp;token=b19bce4f-3773-4b8c-9ebe-6fc210b20533" alt=""><figcaption></figcaption></figure>

***

## Benefits of veTREN

### **Governance**&#x20;

Holders of veTREN are also referred to as the TrenDAO, as governance and voting power in the protocol is represented by the amount of veTREN held. Eligible TrenDAO members can make proposals on a diverse array of matters related to the Tren Finance protocol, including the following:

**Isolate Module Parameter Changes** &#x20;

TrenDAO members can submit proposals to change parameters of isolated modules. These parameters include:

* [XY Debt Ceiling](/protocol/isolated-modules#debt-ceilings)
* [Max LTV](/protocol/isolated-modules#liquidation-threshold-lt)
* [Liquidation Threshold](/protocol/isolated-modules#liquidation-threshold-lt)
* [Minting Fees](/protocol/fees#minting-fee)
* [Performance Fees](/protocol/fees#performance-fee)

### **Ecosystem Rewards and Protocol Revenue**

Most importantly, veTREN holders vote on [Gauges](/protocol/gauges), which determine how the protocol's rewards are allocated. While gauge voting is designed to align the protocol with optimal incentives for different stakeholders (e.g. ensuring enough rewards are allocated to properly incentivize Insurance Pool stakers), a significant share of protocol rewards is expected to go to veTREN holders. These rewards include protocol revenue such as fees generated from operations like transaction fees and liquidation penalties. Unlike typical lending market tokens, which often only distribute a portion of the fees collected from borrowers, veTREN holders benefit from the full spectrum of supply-side interest without having to share these profits with traditional depositors. This arrangement provides a more direct and potentially more lucrative value accrual mechanism, as it captures all economic activity related to the borrowing and management of assets within the platform.


# Official Links

To ensure your safety and avoid scams, only use the official links provided on this page. Be cautious of scam links and always verify that you are accessing the correct resources. By using the links here, you can confidently navigate our platform and access all official documentation and resources securely.

[Website](https://www.tren.finance/)

[Documentation](https://docs.tren.finance/)

[Twitter](https://twitter.com/TrenFinance)

[Discord](https://discord.com/invite/trenfinance)

[Telegram Announcements Channel](https://t.me/trenfinance)

[Blog](https://blog.tren.finance/)

Email: <zekko@tren.finance>


# Security Audits

## Omniscia

Tren Fiance has completed a security audit with Omniscia. Read the audit report below:

[Audit Report](https://omniscia.io/reports/tren-finance-protocol-implementation-669a7ac304bcc60018f62232/)

The PDF version can also be downloaded below:

{% file src="/files/XTHDrKs3sjb7usOP5cLF" %}

## Zokyo

Tren Fiance has completed a security audit with Zokyo. Read the audit report below:

[Audit Report](https://github.com/zokyo-sec/audit-reports/blob/main/Tren%20Finance/Tren%20Finance_Zokyo_audit_report_Nov19th_2024.pdf)

The PDF version can also be downloaded below:

{% file src="/files/ecQLGODEzPSRNVGm4OtB" %}

## Halborn

Tren Fiance has completed a security audit with Halborn. Read the audit report below:

[Audit Report](https://www.halborn.com/audits/tren-finance/hooks-contracts)

The PDF version can also be downloaded below:

{% file src="/files/TU6SS4WaMA7eW9GZBWmn" %}


# Contract Addresses

<table><thead><tr><th width="95">Chain</th><th width="234">Contract</th><th width="408.5">Address</th></tr></thead><tbody><tr><td>Base</td><td>TREN</td><td>0xa77E22bFAeE006D4f9DC2c20D7D337b05125C282</td></tr><tr><td>Arbitrum</td><td>XY</td><td>0xD4fe6e1e37dfCf35E9EEb54D4cca149d1c10239f</td></tr><tr><td>Arbitrum</td><td>AdminContract</td><td>0x9A85a1Fb75534fC0e33b3012A7D69E758d3Af304</td></tr><tr><td>Arbitrum</td><td>BorrowerOperations</td><td>0xe534Ab76E7BCb2E8559815043491E662d13d43Bc</td></tr><tr><td>Arbitrum</td><td>FeeCollector</td><td>0x39b1A38905d9374e97C3828C55fA9D5fc046Fa37</td></tr><tr><td>Arbitrum</td><td>PriceFeed</td><td>0xD8770ae7e6b135B98374c4b1f113F79318b143B1</td></tr><tr><td>Arbitrum</td><td>StabilityPool</td><td>0xE6b9Bc007f024C36692BaF83eE72A267ef02f71f</td></tr><tr><td>Arbitrum</td><td>SwapManager</td><td>0xE6f610721b654A645Ca7a09f2D070481964e33C2</td></tr><tr><td>Arbitrum</td><td>Timelock</td><td>0x9bcF978a4f4C959eEc562ab67eFC91B36179Dd03</td></tr><tr><td>Arbitrum</td><td>TrenBoxManager</td><td>0x12452412130978Bb14008c0a1736ebD8aCB7C50A</td></tr><tr><td>Arbitrum</td><td>TrenBoxManagerOperations</td><td>0x09De6Cb04F265d476d2425E9E59c718afeFB361D</td></tr><tr><td>Arbitrum</td><td>TrenBoxStorage</td><td>0x10b003f525C1013EB889729657E82bB81763Aa8B</td></tr><tr><td>Arbitrum</td><td>Flashloan</td><td>0x91b7426Bb0c26Ba3F06551842c3e6DFFbebBB54D</td></tr></tbody></table>


# Withdrawing via Smart Contracts

## How to Repay Loans and Withdraw Collateral via Smart Contract&#x20;

Follow the steps here:

1. Go to the link below. You should be on the "*Contract*" and "*Write as Proxy*" tabs <https://arbiscan.io/address/0xe534ab76e7bcb2e8559815043491e662d13d43bc#writeProxyContract>

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FVz8XPYfO0TuYqPrnMSr4%2Fsc5.png?alt=media&amp;token=69a68f86-758c-48b3-ac3f-44c4eaebb0e7" alt=""><figcaption></figcaption></figure>

2. Click on the "*Connect to Web3*" button and connect your wallet.

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FOXJABRuwTBOoLTDeOfFs%2Fsc6.png?alt=media&amp;token=82ba48e2-e28b-4661-aa4d-175e414ab761" alt=""><figcaption></figcaption></figure>

3. **Repay your XY debt** first by clicking on "*8. repayDebtTokens*." \
   \
   Enter the token contract address of the isolated module in which you borrowed XY from in the "*\_asset (address) field*". For example, enter [0x4bD135524897333bec344e50ddD85126554E58B4 ](https://arbiscan.io/address/0x4bd135524897333bec344e50ddd85126554e58b4)(contract address of USDC/USDM Curve LP token) if you borrowed XY in the USDC/USDM Curve LP isolated module.\
   \
   Next, Enter the XY amount that you wish to repay under the "*\_debtTokenAmount (uint256)*" field. \
   \
   Under the "*\_upperHint (address)*" and "*lowerHint(address)*" fields, enter 0x0000000000000000000000000000000000000000

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FRC8PcJFfmjh7g5zuhbrP%2Fsc3.png?alt=media&amp;token=b533761f-6111-482c-b4e5-7ee03f03b8b0" alt=""><figcaption></figcaption></figure>

4. Click on the "+" tab next to the "*\_debtTokenAmount (uint256)*" field. Select the *10^18* option.&#x20;

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FgheXUEFhSBx3ZlNrbEEV%2Fsc4.png?alt=media&amp;token=5cf8c4f2-3492-48d1-b9ac-e651bf16ceeb" alt=""><figcaption></figcaption></figure>

5. You should now see the following page. Click on "*Write"* to confirm the transaction in your wallet.&#x20;

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FmRtBMDvjrbwqq0QmeAmA%2Fsc2.png?alt=media&amp;token=483d015d-ef97-4d8a-a675-98bea259f8ab" alt=""><figcaption></figcaption></figure>

6. Next, **withdraw your collateral.** Click on "16. withdrawColl"\
   \
   Enter the collateral token amount that you wish to withdraw under the "*\_collWithdrawal (uint256)*" field. For example, if you want to withdraw 5 USDM/Curve LP tokens, enter 5. \
   \
   This is the only difference from steps 3, 4, and 5, so follow the same steps as you did previously. Once you have completed the steps, you should see the following:

<figure><img src="https://548124530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RFiSnFFNN5tL05uK9pV%2Fuploads%2FK11mi9ty3Uiym8tAARkM%2Fsc1.png?alt=media&amp;token=4dd4c03c-a765-49e4-8bea-9e51e21e03f6" alt=""><figcaption></figcaption></figure>

7. Click on "*Write"* to confirm the transaction in your wallet. \
   \
   You have now successfully repaid your loan and withdrew your collateral via Tren Finance's smart contracts.


# Media Kit

Below you will find a collection of our official media resources. These assets are available for download and use in your own publications, presentations, and promotional materials.<br>

To access our full range of media assets, please [click here](https://drive.google.com/drive/folders/1Dbsa4RXAU9gW-PnTM8KZPLVrAIkRGCE4?usp=sharing).


