> 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/id/produk/defi-composer.md).

# DeFi Composer

DeFi Composer memungkinkan vault multi-protokol bergaya Yearn yang ditulis dalam Solidity, yang menyusun berbagai protokol DeFi Solana secara atomik melalui CPI.

## Ringkasan

Satu fungsi Solidity dapat mengoordinasikan operasi di seluruh Jupiter, Kamino, Drift, Meteora, dan protokol Solana lainnya — semuanya secara atomik. Jika satu langkah gagal, seluruh transaksi dibatalkan.

```solidity
function executeStrategy(uint256 amount) external {
    // 1. Tukar 50% USDC ke SOL melalui Jupiter
    IJupiter(JUPITER).swap(USDC, SOL, amount / 2, minSolOut);

    // 2. Setorkan SOL sebagai jaminan di Kamino
    IKamino(KAMINO).deposit(SOL, solAmount);

    // 3. Pinjam USDC dengan jaminan SOL
    IKamino(KAMINO).borrow(USDC, borrowAmount);

    // 4. Buka posisi short SOL-PERP di Drift (delta hedge)
    IDrift(DRIFT).placeOrder(SOL_PERP, SHORT, size, leverage);

    // Semuanya atomik. Satu fungsi Solidity. Empat lompatan CPI.
}
```

## Mengapa Solidity untuk Komposisi DeFi?

* **Perkakas yang familier** — developer Solidity tidak perlu mempelajari Rust/Anchor
* **Ekosistem matang** — manfaatkan OpenZeppelin, perkakas audit yang sudah ada, alur kerja Hardhat/Foundry
* **Komposabilitas** — `try/catch`, modifier, dan pewarisan bekerja secara alami
* **Eksekusi atomik** — model transaksi Solana menjamin semuanya atau tidak sama sekali

## Strategi Referensi (Direncanakan)

| Strategi              | Protokol               | Deskripsi                                                            |
| --------------------- | ---------------------- | -------------------------------------------------------------------- |
| Pengoptimal Hasil SOL | Kamino, Drift          | Setor SOL, pinjam aset stabil, lindungi delta pada perps             |
| Hasil Stablecoin      | Kamino, Orca           | Sediakan likuiditas stablecoin di seluruh pool, rebalancing otomatis |
| Netral Delta          | Jupiter, Kamino, Drift | Tukar + supply + hedge untuk hasil tanpa eksposur                    |
| Arbitrase LST         | Jupiter, Marinade      | Manfaatkan perbedaan harga LST                                       |

## Status

**Dirancang** — bergantung pada Rome SDK Phase 2 (antarmuka IJupiter, IDrift, IKamino). Infrastruktur CPI inti sudah aktif; antarmuka bertipe spesifik protokol sedang dalam pengerjaan.

## Berikutnya

* [Rome SDK](/id/produk/rome-sdk.md) — antarmuka Solidity bertipe untuk program Solana
* [Panggil Solana dari EVM](/id/panduan-pengembang/call-solana-from-evm.md) — panduan CPI
* [Batasan](/id/konsep-inti/constraints.md) — batas kedalaman CPI dan anggaran komputasi


---

# 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 dynamically by asking a question.

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

```
GET https://docs.rome.builders/id/produk/defi-composer.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
