| name | secured-finance |
| description | Secured Finance固定金利プロトコルの知識。「Secured Finance」「固定金利」「貸出」「デポジット」で使用。 |
| allowed-tools | Read, Bash |
Secured Finance 統合スキル
概要
Secured Finance は固定金利の貸出/借入プロトコル。 Private Planner では Sepolia テストネットで実際に TX を実行する。
コントラクト情報
| コントラクト | アドレス (Sepolia) |
|---|---|
| LendingMarketController | 0x35e9D8e0223A75E51a67aa731127C91Ea0779Fe2 |
| TokenVault | 0xB74749b2213916b1dA3b869E41c7c57f1db69393 |
| CurrencyController | 0x7dca6b6BF30cd28ADe83e86e21e82e3F852bF2DC |
主要な関数
depositAndExecuteOrder (1TX でデポジット+注文)
function depositAndExecuteOrder(
bytes32 ccy, // 通貨 (ETH: 0x455448...)
uint256 maturity, // 満期タイムスタンプ
uint8 side, // 0: LEND, 1: BORROW
uint256 amount, // 金額 (wei)
uint256 unitPrice // 価格 (10000 = 100%)
) external payable returns (uint256 filledAmount);
通貨バイトコード
const CURRENCY_BYTES32 = {
ETH: "0x4554480000000000000000000000000000000000000000000000000000000000",
USDC: "0x5553444300000000000000000000000000000000000000000000000000000000",
};
Unit Price → APR 変換
function unitPriceToAPR(unitPrice: number, maturity: number): number {
const price = unitPrice / 10000;
const yearsToMaturity = (maturity - Date.now() / 1000) / (365 * 24 * 60 * 60);
return ((1 - price) / yearsToMaturity) * 100;
}
Subgraph URL
https://api.studio.thegraph.com/query/64582/sf-prd-sepolia/version/latest
実装時の注意
- ETH の場合は
{ value: amount }で ETH を送金 - USDC の場合は事前に approve が必要
- maturity は Unix タイムスタンプ(秒)
- unitPrice は 0-10000 の範囲