Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions submissions/kamino-lend/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "kamino-lend"
version = "0.1.0"
edition = "2021"

[[bin]]
name = "kamino-lend"
path = "src/main.rs"

[dependencies]
clap = { version = "4", features = ["derive"] }
tokio = { version = "1", features = ["full"] }
reqwest = { version = "0.12", features = ["json"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
anyhow = "1"
base64 = "0.22"
bs58 = "0.5"
21 changes: 21 additions & 0 deletions submissions/kamino-lend/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 GeoGu360

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
49 changes: 49 additions & 0 deletions submissions/kamino-lend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# kamino-lend

Kamino Lend plugin for OKX Plugin Store — supply, borrow, and manage positions on [Kamino Lend](https://kamino.finance), the leading lending protocol on Solana.

## Features

- **Markets**: View all Kamino lending markets with current supply/borrow APYs and TVL
- **Positions**: Query your current lending obligations and health factor
- **Supply**: Deposit assets to earn yield
- **Withdraw**: Withdraw supplied assets
- **Borrow**: Borrow assets against collateral (dry-run supported)
- **Repay**: Repay outstanding loans (dry-run supported)

## Chain Support

- Solana mainnet (chain 501)

## Usage

```bash
# List markets and APYs
kamino-lend markets

# Check your positions
kamino-lend positions

# Supply 0.01 USDC
kamino-lend supply --token USDC --amount 0.01

# Withdraw 0.01 USDC
kamino-lend withdraw --token USDC --amount 0.01

# Preview borrow (dry-run)
kamino-lend borrow --token SOL --amount 0.001 --dry-run

# Preview repay (dry-run)
kamino-lend repay --token SOL --amount 0.001 --dry-run
```

## Key Addresses

- Main Market: `7u3HeHxYDLhnCoErrtycNokbQYbWGzLs6JSDqGAv5PfF`
- Kamino Lend Program: `KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD`

## Important Notes

- Amounts are always in UI units (0.01 USDC = 0.01, not 10000)
- Solana transactions expire in ~60 seconds; transactions are submitted immediately
- Borrowing requires prior collateral supply (obligation must exist)
29 changes: 29 additions & 0 deletions submissions/kamino-lend/plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
schema_version: 1
name: kamino-lend
version: "0.1.0"
description: "Supply, borrow, and manage positions on Kamino Lend — the leading Solana lending protocol"
author:
name: "GeoGu360"
github: "GeoGu360"
category: defi-protocol
tags:
- lending
- borrowing
- solana
- kamino
- defi
license: MIT

components:
skill:
dir: skills/kamino-lend

build:
lang: rust
binary_name: kamino-lend
source_repo: GeoGu360/onchainos-plugins
source_commit: "866b8a5550e4c3f0bf74b5874ea652025ddd564c"
source_dir: kamino-lend

api_calls:
- "https://api.kamino.finance"
194 changes: 194 additions & 0 deletions submissions/kamino-lend/skills/kamino-lend/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
---
name: kamino-lend
version: 0.1.0
description: Supply, borrow, and manage positions on Kamino Lend — the leading Solana lending protocol
---



## Pre-flight Dependencies (auto-injected by Plugin Store CI)

> Run once per session before first use. These checks ensure required tools are installed.

### Install onchainos CLI (auto-injected)

```bash
onchainos --version 2>/dev/null || curl -fsSL https://raw.githubusercontent.com/okx/onchainos-skills/main/install.sh | sh
```

### Install kamino-lend binary (auto-injected)

```bash
if ! command -v kamino-lend >/dev/null 2>&1; then
OS=$(uname -s | tr A-Z a-z)
ARCH=$(uname -m)
case "${OS}_${ARCH}" in
darwin_arm64) TARGET="aarch64-apple-darwin" ;;
darwin_x86_64) TARGET="x86_64-apple-darwin" ;;
linux_x86_64) TARGET="x86_64-unknown-linux-gnu" ;;
linux_aarch64) TARGET="aarch64-unknown-linux-gnu" ;;
esac
curl -fsSL "https://github.com/okx/plugin-store-community/releases/download/plugins/kamino-lend@0.1.0/kamino-lend-${TARGET}" -o ~/.local/bin/kamino-lend
chmod +x ~/.local/bin/kamino-lend
fi
```

---


# Kamino Lend Skill

## Overview

Kamino Lend is the leading borrowing and lending protocol on Solana. This skill enables you to:
- View lending markets and current interest rates
- Check your lending positions and health factor
- Supply assets to earn yield
- Withdraw supplied assets
- Borrow assets (dry-run preview)
- Repay borrowed assets (dry-run preview)

All on-chain operations are executed via `onchainos wallet contract-call` after explicit user confirmation.

## Pre-flight Checks

Before executing any command:
1. Ensure `kamino-lend` binary is installed and in PATH
2. Ensure `onchainos` is installed and you are logged in: `onchainos wallet balance --chain 501`
3. Wallet is on Solana mainnet (chain 501)

## Commands

### markets — View Lending Markets

Trigger phrases:
- "Show me Kamino lending markets"
- "What are the interest rates on Kamino?"
- "Kamino supply APY"
- "Kamino lending rates"

```bash
kamino-lend markets
kamino-lend markets --name "main"
```

Expected output: List of markets with supply APY, borrow APY, and TVL for each reserve.

---

### positions — View Your Positions

Trigger phrases:
- "What are my Kamino positions?"
- "Show my Kamino lending obligations"
- "My Kamino health factor"
- "How much have I borrowed on Kamino?"

```bash
kamino-lend positions
kamino-lend positions --wallet <WALLET_ADDRESS>
```

Expected output: List of obligations with deposits, borrows, and health factor.

---

### supply — Supply Assets

Trigger phrases:
- "Supply [amount] [token] to Kamino"
- "Deposit [amount] [token] on Kamino Lend"
- "Earn yield on Kamino with [token]"
- "Lend [amount] [token] on Kamino"

Before executing, **ask user to confirm** the transaction details (token, amount, current APY).

```bash
kamino-lend supply --token USDC --amount 0.01
kamino-lend supply --token SOL --amount 0.001
kamino-lend supply --token USDC --amount 0.01 --dry-run
```

Parameters:
- `--token`: Token symbol (USDC, SOL) or reserve address
- `--amount`: Amount in UI units (0.01 USDC = 0.01, NOT 10000)
- `--dry-run`: Preview without submitting (optional)
- `--wallet`: Override wallet address (optional)
- `--market`: Override market address (optional)

**Important:** After user confirmation, executes via `onchainos wallet contract-call --chain 501 --unsigned-tx <base58_tx> --force`. The transaction is fetched from Kamino API and immediately submitted (Solana blockhash expires in ~60 seconds).

---

### withdraw — Withdraw Assets

Trigger phrases:
- "Withdraw [amount] [token] from Kamino"
- "Remove my [token] from Kamino Lend"
- "Get back my [token] from Kamino"

Before executing, **ask user to confirm** the withdrawal amount and token.

```bash
kamino-lend withdraw --token USDC --amount 0.01
kamino-lend withdraw --token SOL --amount 0.001
kamino-lend withdraw --token USDC --amount 0.01 --dry-run
```

Parameters: Same as `supply`.

**Note:** Withdrawing when you have outstanding borrows may fail if it would bring health factor below 1.0. Check positions first.

After user confirmation, submits transaction via `onchainos wallet contract-call`.

---

### borrow — Borrow Assets (Dry-run)

Trigger phrases:
- "Borrow [amount] [token] from Kamino"
- "Take a loan of [amount] [token] on Kamino"
- "How much can I borrow on Kamino?"

```bash
kamino-lend borrow --token SOL --amount 0.001 --dry-run
kamino-lend borrow --token USDC --amount 0.01 --dry-run
```

**Note:** Borrowing requires prior collateral supply. Use `--dry-run` to preview. To borrow for real, omit `--dry-run` and **confirm** the transaction.

Before executing a real borrow, **ask user to confirm** and warn about liquidation risk.

---

### repay — Repay Borrowed Assets (Dry-run)

Trigger phrases:
- "Repay [amount] [token] on Kamino"
- "Pay back my [token] loan on Kamino"
- "Reduce my Kamino debt"

```bash
kamino-lend repay --token SOL --amount 0.001 --dry-run
kamino-lend repay --token USDC --amount 0.01 --dry-run
```

Before executing a real repay, **ask user to confirm** the repayment details.

---

## Error Handling

| Error | Meaning | Action |
|-------|---------|--------|
| `Kamino API deposit error: Vanilla type Kamino Lend obligation does not exist` | No prior deposits | Supply first to create obligation |
| `base64→base58 conversion failed` | API returned invalid tx | Retry; the API transaction may have expired |
| `Cannot resolve wallet address` | Not logged in to onchainos | Run `onchainos wallet balance --chain 501` to verify login |
| `Unknown token 'X'` | Unsupported token symbol | Use USDC or SOL, or pass reserve address directly |

## Routing Rules

- Use this skill for Kamino **lending** (supply/borrow/repay/withdraw)
- For Kamino **earn vaults** (automated yield strategies): use kamino-liquidity skill if available
- For general Solana token swaps: use swap/DEX skills
- Amounts are always in UI units (human-readable): 1 USDC = 1.0, not 1000000
Loading