> For the complete documentation index, see [llms.txt](https://docs.rome.builders/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rome.builders/ar/halat-alastkhdam/defi-protocols.md).

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

أنماط التكامل لـ DeFi على EVM في Rome — الإقراض باستخدام أوراكل Solana، وتركيب Jupiter وKamino من Solidity، ومجمّعات السيولة المشتركة.

تمكّن Rome بروتوكولات DeFi على EVM من التفاعل تركيبيًا مع منظومة DeFi الأصلية على Solana بشكل ذرّي. تغطي هذه الصفحة أنماط التكامل الشائعة. يعمل بالفعل على Rome عدة بروتوكولات — Aave v3، وCompound v3 (Aerarium)، وUniswap V2/V3/V4، وRome DEX — انظر [التطبيقات على روم](/ar/alttbyqat-ala-rome/apps.md).

الكود أدناه توضيحي؛ أسماء الواجهات لبرامج Solana التابعة لأطراف ثالثة هي أمثلة، وليست واجهات SDK مشحونة.

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

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

## النمط 1: بروتوكول إقراض مع Oracles الخاصة بـ Solana

الاستيراد أدناه يأتي من [`rome-solidity`](https://github.com/rome-protocol/rome-solidity)، والذي يتم تثبيته من GitHub، وليس من npm: `npm install github:rome-protocol/rome-solidity`، أو `forge install rome-protocol/rome-solidity` مع إعادة التعيين `@rome-protocol/rome-solidity/=lib/rome-solidity/` (التفاصيل في [نشر عقود Solidity](/ar/adlh-almtw-ryn/deploy-solidity.md#using-the-rome-solidity-sdk)). مرّر عنوان الـ feed من [السجل](/ar/almntjat/oracle-gateway.md#consume-a-feed-in-three-steps) بدلًا من تثبيته صراحةً.

```solidity
import {IAggregatorV3Interface} from "@rome-protocol/rome-solidity/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 عبر بوابة الأوراكل
        // الواجهة نفسها التي يستخدمها 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. كلاهما بشكل ذرّي — مخاطر تنفيذ صفرية

## التطبيقات المرجعية

انسخ تطبيق Rome يعمل بدلًا من البدء من صفحة فارغة:

* [**rome-dex**](https://github.com/rome-protocol/rome-dex) — AMM ثنائي المسار؛ قدّم فكرة جديدة وانشرها لمستخدمي Solana وEVM عبر مجمّع واحد.
* [**aerarium**](https://github.com/rome-protocol/aerarium) — واجهة إقراض Compound v3 ثنائية المسار.
* [**cardo**](https://github.com/rome-protocol/cardo) — بوابة توزيع تطبيقات CPI (مقايضة / إقراض / عقود دائمة / تركيب).
* [**rome-aave-v3-demo**](https://github.com/rome-protocol/rome-aave-v3-demo) — واجهة إقراض Aave v3.
* [**compound-on-rome-comet**](https://github.com/rome-protocol/compound-on-rome-comet) — عقود سوق المال Comet.
* [**rome-oracle-gateway**](https://github.com/rome-protocol/rome-oracle-gateway) — تطبيق جديد عبر VMs متعددة: يقرأ حسابات أسعار Solana (Pyth، Switchboard)، وينشرها على EVM، ويقدّمها إلى Solidity عبر معيار Chainlink `AggregatorV3Interface`.

## ذات صلة

* [أوراكل غيتواي](/ar/almntjat/oracle-gateway.md) — موجّهات أسعار متوافقة مع Chainlink
* [Rome SDK](/ar/almntjat/rome-sdk.md) — واجهات مكتوبة ببنية قوية لبروتوكولات DeFi


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
