> 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/ko/use-cases/defi-protocols.md).

# DeFi 프로토콜

Rome에서 EVM DeFi를 위한 통합 패턴 — Solana 오라클을 사용하는 대출, Solidity에서 Jupiter와 Kamino를 조합하기, 그리고 공유 유동성 풀.

Rome은 EVM DeFi 프로토콜이 Solana의 네이티브 DeFi 생태계와 원자적으로 조합되도록 합니다. 이 페이지에서는 일반적인 통합 패턴을 다룹니다. 여러 가지는 이미 Rome에서 운영 중입니다 — Aave v3, Compound v3(Aerarium), Uniswap V2/V3/V4, 그리고 Rome DEX — 참조 [Rome의 앱](https://docs.rome.builders/ko/rome-1/apps.md).

아래 코드는 예시용이며, 서드파티 Solana 프로그램의 인터페이스 이름은 예시일 뿐이고 배포되는 SDK 인터페이스가 아닙니다.

## 왜 Rome에서 DeFi를 하나요?

* **Solana 유동성에 접근** — Jupiter, Kamino, Drift, Meteora, Raydium, Orca
* **원자적 조합성** — 여러 단계의 DeFi 작업을 하나의 트랜잭션으로
* **Solidity 도구** — 익숙한 개발 및 감사 생태계
* **공유 상태** — EVM과 Solana 사용자가 동일한 풀을 공유

## 패턴 1: Solana 오라클을 사용하는 대출 프로토콜

아래 import는 다음에서 가져옵니다 [`rome-solidity`](https://github.com/rome-protocol/rome-solidity), 이는 npm이 아니라 GitHub에서 설치됩니다: `npm install github:rome-protocol/rome-solidity`, 또는 `forge install rome-protocol/rome-solidity` remapping과 함께 `@rome-protocol/rome-solidity/=lib/rome-solidity/` (자세한 내용은 [Solidity 계약 배포](https://docs.rome.builders/ko/developer-guides/deploy-solidity.md#using-the-rome-solidity-sdk)). 피드 주소는 다음에서 전달하세요 [registry](https://docs.rome.builders/ko/products/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();
        // Oracle Gateway를 통한 Pyth/Switchboard 가격
        // Ethereum의 Chainlink와 동일한 인터페이스
        return (amount * uint256(price)) / 1e8;
    }
}
```

## 패턴 2: CPI를 통한 DEX 애그리게이터

```solidity
contract RomeSwap {
    function swap(
        bytes32 fromMint,
        bytes32 toMint,
        uint256 amount,
        uint256 minOut
    ) external {
        // Jupiter/Raydium/Meteora로 CPI
        // 모든 Solana DEX 유동성을 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` (여러 Rome 체인의 여러 EVM 트랜잭션을 하나의 Solana 트랜잭션에서 원자적으로 처리):

1. 한 Rome 체인의 DEX A에서 매수
2. 다른 Rome 체인의 DEX B에서 매도
3. 둘 다 원자적으로 실행되며, 하나라도 실패하면 둘 다 되돌려집니다.

## 참조 구현

빈 페이지에서 시작하는 대신 동작하는 Rome 앱을 포크하세요:

* [**rome-dex**](https://github.com/rome-protocol/rome-dex) — 이중 레인 AMM; 새로운 아이디어를 가져와 하나의 풀로 Solana와 EVM 사용자 모두에게 배포하세요.
* [**aerarium**](https://github.com/rome-protocol/aerarium) — 이중 레인 Compound v3 대출 UI.
* [**cardo**](https://github.com/rome-protocol/cardo) — CPI 앱 배포 포털(스왑 / 대출 / 무기한 선물 / 조합).
* [**rome-aave-v3-demo**](https://github.com/rome-protocol/rome-aave-v3-demo) — Aave v3 대출 UI.
* [**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) — 신규 크로스-VM 앱: Solana 가격 계정(Pyth, Switchboard)을 읽고, 이를 EVM에 게시한 뒤, 표준 Chainlink를 통해 Solidity에 제공합니다 `AggregatorV3Interface`.

## 관련

* [Oracle Gateway](https://docs.rome.builders/ko/products/oracle-gateway.md) — Chainlink 호환 가격 피드
* [Rome SDK](https://docs.rome.builders/ko/products/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/ko/use-cases/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.
