# بروتوكولات DeFi

يتيح Rome لبروتوكولات DeFi الخاصة بـ EVM التأليف مع منظومة DeFi الأصلية في Solana بشكل ذري. تغطي هذه الصفحة أنماط التكامل الشائعة.

## لماذا DeFi على Rome؟

* **الوصول إلى سيولة Solana** — Jupiter، Kamino، Drift، Meteora، Raydium، Orca
* **قابلية التأليف الذرية** — عمليات DeFi متعددة الخطوات في معاملة واحدة
* **أدوات Solidity** — بيئة تطوير ومراجعة مألوفة
* **حالة واحدة** — مستخدمو EVM وSolana يتشاركون المجمعات نفسها

## النمط 1: بروتوكول إقراض مع أوراكلز Solana

```solidity
import {IAggregatorV3Interface} from "@rome-protocol/solidity-sdk/contracts/oracle/IAggregatorV3Interface.sol";

contract RomeLending {
    IAggregatorV3Interface public priceFeed;

    constructor(address _priceFeed) {
        priceFeed = IAggregatorV3Interface(_priceFeed);
    }

    function getCollateralValue(uint256 amount) public view returns (uint256) {
        (, int256 price,,,) = priceFeed.latestRoundData();
        // سعر Pyth/Switchboard عبر Oracle Gateway
        // نفس الواجهة كما في Chainlink على Ethereum
        return (amount * uint256(price)) / 1e8;
    }
}
```

## النمط 2: مجمّع DEX عبر CPI

```solidity
contract RomeSwap {
    function swap(
        bytes32 fromMint,
        bytes32 toMint,
        uint256 amount,
        uint256 minOut
    ) external {
        // CPI إلى Jupiter/Raydium/Meteora
        // جميع سيولة DEX على Solana متاحة من Solidity
        CpiProgram.invoke(JUPITER_PROGRAM, accounts, swapData);
    }
}
```

## النمط 3: خزانة العائد

```solidity
contract YieldVault {
    function deposit(uint256 amount) external {
        // قبول إيداع USDC
        // CPI → Jupiter: التحويل إلى الرموز الأمثل
        // CPI → Kamino: التوريد كضمان
        // CPI → Drift: فتح تحوّط محايد للدلتا
        // كلها ذرية — معاملة واحدة، الكل أو لا شيء
    }
}
```

## النمط 4: المراجحة عبر البروتوكولات

استخدام `RemusTx` (معاملات ذرية عبر rollup):

1. الشراء على DEX A في rollup 1
2. البيع على DEX B في rollup 2
3. كلاهما بشكل ذري — صفر مخاطر تنفيذ

## ذات صلة

* [مؤلف DeFi](/ar/almntjat/defi-composer.md) — بنية تحتية لخزائن متعددة البروتوكولات
* [بوابة الأوراكل](/ar/almntjat/oracle-gateway.md) — خلاصات أسعار متوافقة مع Chainlink
* [Rome SDK](/ar/almntjat/rome-sdk.md) — واجهات مُنقَّحة لبروتوكولات DeFi


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.rome.builders/ar/halat-alastkhdam/defi-protocols.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
