@indigoprotocol/openclaw-indigo 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +104 -0
- package/SKILL.md +65 -0
- package/package.json +15 -0
- package/src/alerts/cdp-alerts.ts +38 -0
- package/src/alerts/index.ts +10 -0
- package/src/alerts/price-alerts.ts +44 -0
- package/src/alerts/staking-alerts.ts +36 -0
- package/src/commands/cdp.ts +58 -0
- package/src/commands/index.ts +11 -0
- package/src/commands/portfolio.ts +38 -0
- package/src/commands/price.ts +33 -0
- package/src/commands/staking.ts +38 -0
- package/src/formatters/cdp-formatter.ts +90 -0
- package/src/formatters/index.ts +9 -0
- package/src/formatters/portfolio-formatter.ts +91 -0
- package/src/formatters/price-formatter.ts +74 -0
- package/src/index.ts +69 -0
package/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# @indigoprotocol/openclaw-indigo
|
|
2
|
+
|
|
3
|
+
OpenClaw plugin for the [Indigo Protocol](https://indigoprotocol.io) on Cardano. Brings Indigo Protocol functionality to Telegram, Discord, and Slack through the OpenClaw platform.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
| Feature | Description |
|
|
8
|
+
|---------|-------------|
|
|
9
|
+
| MCP Integration | Indigo MCP server integration via OpenClaw |
|
|
10
|
+
| Chat Interfaces | Telegram, Discord, and Slack bot support |
|
|
11
|
+
| CDP Management | Create, adjust, and close CDPs from chat |
|
|
12
|
+
| Price Alerts | Configurable alerts for iAsset and INDY prices |
|
|
13
|
+
| Portfolio Tracking | Track wallet positions and get notifications |
|
|
14
|
+
| Staking | Manage INDY staking positions from chat |
|
|
15
|
+
|
|
16
|
+
## Architecture
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
src/
|
|
20
|
+
index.ts — Plugin entry point, config, and exports
|
|
21
|
+
commands/ — Chat command handlers
|
|
22
|
+
cdp.ts — CDP management commands
|
|
23
|
+
price.ts — Price query commands
|
|
24
|
+
staking.ts — Staking commands
|
|
25
|
+
portfolio.ts — Portfolio and stats commands
|
|
26
|
+
alerts/ — Notification alert definitions
|
|
27
|
+
price-alerts.ts — Price threshold notifications
|
|
28
|
+
cdp-alerts.ts — CDP health notifications
|
|
29
|
+
staking-alerts.ts — Staking and governance notifications
|
|
30
|
+
formatters/ — Platform-specific message formatters
|
|
31
|
+
cdp-formatter.ts — CDP data formatting
|
|
32
|
+
price-formatter.ts — Price data formatting
|
|
33
|
+
portfolio-formatter.ts — Portfolio summary formatting
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Commands
|
|
37
|
+
|
|
38
|
+
### CDP Management
|
|
39
|
+
- `/cdp list` — List your CDPs
|
|
40
|
+
- `/cdp open <asset> <collateral>` — Open a new CDP
|
|
41
|
+
- `/cdp deposit <address> <amount>` — Add collateral
|
|
42
|
+
- `/cdp withdraw <address> <amount>` — Withdraw collateral
|
|
43
|
+
- `/cdp close <address>` — Close a CDP
|
|
44
|
+
- `/cdp health [address]` — Check CDP health
|
|
45
|
+
- `/cdp mint <address> <amount>` — Mint iAssets
|
|
46
|
+
- `/cdp burn <address> <amount>` — Burn iAssets
|
|
47
|
+
|
|
48
|
+
### Prices
|
|
49
|
+
- `/price <asset>` — Get iAsset price
|
|
50
|
+
- `/price ada` — Get ADA price
|
|
51
|
+
- `/price indy` — Get INDY price
|
|
52
|
+
- `/price all` — Get all iAsset prices
|
|
53
|
+
|
|
54
|
+
### Staking
|
|
55
|
+
- `/stake info` — View staking overview and APR
|
|
56
|
+
- `/stake list` — List your staking positions
|
|
57
|
+
- `/stake open <amount>` — Open a new staking position
|
|
58
|
+
- `/stake adjust <address> <amount>` — Adjust position
|
|
59
|
+
- `/stake close <address>` — Close position
|
|
60
|
+
|
|
61
|
+
### Portfolio
|
|
62
|
+
- `/portfolio [address]` — Full portfolio summary
|
|
63
|
+
- `/balance [address]` — Check wallet balances
|
|
64
|
+
- `/tvl` — View protocol TVL
|
|
65
|
+
- `/stats` — View protocol statistics
|
|
66
|
+
|
|
67
|
+
## Alerts
|
|
68
|
+
|
|
69
|
+
Configure notifications for:
|
|
70
|
+
- **Price thresholds** — Alert when iAsset or INDY price crosses a threshold
|
|
71
|
+
- **Price changes** — Alert on significant percentage moves
|
|
72
|
+
- **iUSD depeg** — Alert when iUSD deviates from $1.00
|
|
73
|
+
- **CDP health** — Alert when collateral ratio drops
|
|
74
|
+
- **Liquidation risk** — Alert when CDP approaches liquidation
|
|
75
|
+
- **Staking rewards** — Alert on reward distributions
|
|
76
|
+
- **Governance** — Alert on new polls and ending votes
|
|
77
|
+
|
|
78
|
+
## Setup
|
|
79
|
+
|
|
80
|
+
1. Install the plugin in your OpenClaw instance
|
|
81
|
+
2. Configure the Indigo MCP server connection
|
|
82
|
+
3. Connect your Telegram, Discord, or Slack bot
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"mcpServers": {
|
|
87
|
+
"indigo": {
|
|
88
|
+
"command": "npx",
|
|
89
|
+
"args": ["@indigoprotocol/indigo-mcp"]
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Development
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npm install
|
|
99
|
+
npm run build
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## License
|
|
103
|
+
|
|
104
|
+
MIT — Indigo Protocol
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openclaw-indigo
|
|
3
|
+
description: "Indigo Protocol integration for OpenClaw with CDP management, price alerts, and portfolio tracking."
|
|
4
|
+
allowed-tools: Read, Glob, Grep
|
|
5
|
+
license: MIT
|
|
6
|
+
metadata:
|
|
7
|
+
author: indigoprotocol
|
|
8
|
+
version: '0.1.0'
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# OpenClaw Indigo Plugin
|
|
12
|
+
|
|
13
|
+
Indigo Protocol integration for the OpenClaw platform. Enables CDP management, price alerts, and portfolio tracking through Telegram, Discord, and Slack.
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- Indigo MCP integration via OpenClaw
|
|
18
|
+
- Telegram, Discord, and Slack bot support
|
|
19
|
+
- CDP management from chat
|
|
20
|
+
- Price alerts for iAssets and INDY
|
|
21
|
+
- Portfolio tracking and notifications
|
|
22
|
+
|
|
23
|
+
## Commands
|
|
24
|
+
|
|
25
|
+
| Command | Description |
|
|
26
|
+
|---------|-------------|
|
|
27
|
+
| `/cdp list` | List your CDPs |
|
|
28
|
+
| `/cdp open <asset> <amount>` | Open a new CDP |
|
|
29
|
+
| `/cdp deposit <address> <amount>` | Add collateral |
|
|
30
|
+
| `/cdp withdraw <address> <amount>` | Withdraw collateral |
|
|
31
|
+
| `/cdp close <address>` | Close a CDP |
|
|
32
|
+
| `/cdp health [address]` | Check CDP health |
|
|
33
|
+
| `/cdp mint <address> <amount>` | Mint iAssets |
|
|
34
|
+
| `/cdp burn <address> <amount>` | Burn iAssets |
|
|
35
|
+
| `/price <asset>` | Get iAsset price |
|
|
36
|
+
| `/price ada` | Get ADA price |
|
|
37
|
+
| `/price indy` | Get INDY price |
|
|
38
|
+
| `/price all` | Get all prices |
|
|
39
|
+
| `/stake info` | Staking overview |
|
|
40
|
+
| `/stake list` | List staking positions |
|
|
41
|
+
| `/stake open <amount>` | Open staking position |
|
|
42
|
+
| `/stake adjust <address> <amount>` | Adjust position |
|
|
43
|
+
| `/stake close <address>` | Close position |
|
|
44
|
+
| `/portfolio [address]` | Full portfolio summary |
|
|
45
|
+
| `/balance [address]` | Check wallet balances |
|
|
46
|
+
| `/tvl` | Protocol TVL |
|
|
47
|
+
| `/stats` | Protocol statistics |
|
|
48
|
+
|
|
49
|
+
## Alerts
|
|
50
|
+
|
|
51
|
+
| Alert | Description |
|
|
52
|
+
|-------|-------------|
|
|
53
|
+
| Price Above/Below | Threshold alerts for any iAsset or INDY |
|
|
54
|
+
| Price Change | Percentage change alerts |
|
|
55
|
+
| iUSD Depeg | Alert when iUSD deviates from $1.00 peg |
|
|
56
|
+
| Low Collateral Ratio | CDP health warnings |
|
|
57
|
+
| Liquidation Risk | CDP approaching liquidation |
|
|
58
|
+
| Liquidated | CDP liquidation notification |
|
|
59
|
+
| Reward Distribution | INDY staking rewards distributed |
|
|
60
|
+
| New Poll | Governance poll created |
|
|
61
|
+
| Poll Ending | Governance poll about to close |
|
|
62
|
+
|
|
63
|
+
## Setup
|
|
64
|
+
|
|
65
|
+
Configure the plugin in your OpenClaw instance with the Indigo MCP server connection.
|
package/package.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@indigoprotocol/openclaw-indigo",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "OpenClaw plugin for Indigo Protocol",
|
|
5
|
+
"keywords": ["indigo", "openclaw", "plugin", "cardano", "slack", "telegram", "discord"],
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "src/index.ts",
|
|
8
|
+
"files": ["SKILL.md", "src", "README.md"],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/IndigoProtocol/indigo-ai.git",
|
|
13
|
+
"directory": "packages/plugins/openclaw-indigo"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CDP Alerts
|
|
3
|
+
*
|
|
4
|
+
* Notifications for CDP health and liquidation risk.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export interface CDPAlertConfig {
|
|
8
|
+
/** CDP address to monitor */
|
|
9
|
+
cdpAddress: string;
|
|
10
|
+
/** Alert when collateral ratio drops below this percentage */
|
|
11
|
+
minRatio?: number;
|
|
12
|
+
/** Alert when CDP is at liquidation risk */
|
|
13
|
+
liquidationWarning?: boolean;
|
|
14
|
+
/** Notification channels */
|
|
15
|
+
channels: ("telegram" | "discord" | "slack")[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const cdpAlerts = {
|
|
19
|
+
name: "cdp-alerts",
|
|
20
|
+
description: "CDP health and liquidation risk notifications",
|
|
21
|
+
|
|
22
|
+
triggers: {
|
|
23
|
+
lowCollateralRatio: {
|
|
24
|
+
description: "Alert when CDP collateral ratio drops below threshold",
|
|
25
|
+
mcpTool: "analyze_cdp_health",
|
|
26
|
+
defaultThreshold: 150,
|
|
27
|
+
},
|
|
28
|
+
liquidationRisk: {
|
|
29
|
+
description: "Alert when CDP is approaching liquidation",
|
|
30
|
+
mcpTool: "analyze_cdp_health",
|
|
31
|
+
defaultThreshold: 120,
|
|
32
|
+
},
|
|
33
|
+
liquidated: {
|
|
34
|
+
description: "Alert when a CDP has been liquidated",
|
|
35
|
+
mcpTool: "get_cdps_by_owner",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
} as const;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenClaw Indigo Alerts
|
|
3
|
+
*
|
|
4
|
+
* Notification alerts for Indigo Protocol events delivered
|
|
5
|
+
* through Telegram, Discord, and Slack.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export { priceAlerts, type PriceAlertConfig } from "./price-alerts.js";
|
|
9
|
+
export { cdpAlerts, type CDPAlertConfig } from "./cdp-alerts.js";
|
|
10
|
+
export { stakingAlerts, type StakingAlertConfig } from "./staking-alerts.js";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Price Alerts
|
|
3
|
+
*
|
|
4
|
+
* Configurable price threshold alerts for iAssets and INDY.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export interface PriceAlertConfig {
|
|
8
|
+
/** Asset to monitor (iUSD, iBTC, iETH, iSOL, ADA, INDY) */
|
|
9
|
+
asset: string;
|
|
10
|
+
/** Alert when price goes above this value */
|
|
11
|
+
above?: number;
|
|
12
|
+
/** Alert when price drops below this value */
|
|
13
|
+
below?: number;
|
|
14
|
+
/** Percentage change threshold to trigger alert */
|
|
15
|
+
percentChange?: number;
|
|
16
|
+
/** Notification channels */
|
|
17
|
+
channels: ("telegram" | "discord" | "slack")[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const priceAlerts = {
|
|
21
|
+
name: "price-alerts",
|
|
22
|
+
description: "Price threshold notifications for iAssets and INDY",
|
|
23
|
+
|
|
24
|
+
triggers: {
|
|
25
|
+
priceAbove: {
|
|
26
|
+
description: "Alert when asset price exceeds threshold",
|
|
27
|
+
mcpTool: "get_asset_price",
|
|
28
|
+
},
|
|
29
|
+
priceBelow: {
|
|
30
|
+
description: "Alert when asset price drops below threshold",
|
|
31
|
+
mcpTool: "get_asset_price",
|
|
32
|
+
},
|
|
33
|
+
percentChange: {
|
|
34
|
+
description: "Alert on significant price movement",
|
|
35
|
+
mcpTool: "get_asset_price",
|
|
36
|
+
},
|
|
37
|
+
depeg: {
|
|
38
|
+
description: "Alert when iUSD deviates from $1.00 peg",
|
|
39
|
+
mcpTool: "get_asset_price",
|
|
40
|
+
asset: "iUSD",
|
|
41
|
+
threshold: 0.02,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
} as const;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Staking Alerts
|
|
3
|
+
*
|
|
4
|
+
* Notifications for INDY staking rewards and governance events.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export interface StakingAlertConfig {
|
|
8
|
+
/** Owner address to monitor */
|
|
9
|
+
ownerAddress: string;
|
|
10
|
+
/** Alert on reward distribution */
|
|
11
|
+
rewardDistribution?: boolean;
|
|
12
|
+
/** Alert on governance proposals */
|
|
13
|
+
governancePolls?: boolean;
|
|
14
|
+
/** Notification channels */
|
|
15
|
+
channels: ("telegram" | "discord" | "slack")[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const stakingAlerts = {
|
|
19
|
+
name: "staking-alerts",
|
|
20
|
+
description: "INDY staking and governance notifications",
|
|
21
|
+
|
|
22
|
+
triggers: {
|
|
23
|
+
rewardDistribution: {
|
|
24
|
+
description: "Alert when staking rewards are distributed",
|
|
25
|
+
mcpTool: "distribute_staking_rewards",
|
|
26
|
+
},
|
|
27
|
+
newPoll: {
|
|
28
|
+
description: "Alert when a new governance poll is created",
|
|
29
|
+
mcpTool: "get_polls",
|
|
30
|
+
},
|
|
31
|
+
pollEnding: {
|
|
32
|
+
description: "Alert when a governance poll is about to end",
|
|
33
|
+
mcpTool: "get_polls",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
} as const;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CDP Management Commands
|
|
3
|
+
*
|
|
4
|
+
* Chat commands for managing Indigo Protocol CDPs.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export interface CDPCommandContext {
|
|
8
|
+
address: string;
|
|
9
|
+
reply: (message: string) => Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const cdpCommands = {
|
|
13
|
+
name: "cdp",
|
|
14
|
+
description: "Manage Indigo Protocol CDPs",
|
|
15
|
+
|
|
16
|
+
commands: {
|
|
17
|
+
"/cdp list": {
|
|
18
|
+
description: "List your CDPs",
|
|
19
|
+
usage: "/cdp list",
|
|
20
|
+
handler: "get_cdps_by_owner",
|
|
21
|
+
},
|
|
22
|
+
"/cdp open": {
|
|
23
|
+
description: "Open a new CDP",
|
|
24
|
+
usage: "/cdp open <asset> <collateral_amount>",
|
|
25
|
+
handler: "open_cdp",
|
|
26
|
+
},
|
|
27
|
+
"/cdp deposit": {
|
|
28
|
+
description: "Add collateral to a CDP",
|
|
29
|
+
usage: "/cdp deposit <cdp_address> <amount>",
|
|
30
|
+
handler: "deposit_cdp",
|
|
31
|
+
},
|
|
32
|
+
"/cdp withdraw": {
|
|
33
|
+
description: "Withdraw collateral from a CDP",
|
|
34
|
+
usage: "/cdp withdraw <cdp_address> <amount>",
|
|
35
|
+
handler: "withdraw_cdp",
|
|
36
|
+
},
|
|
37
|
+
"/cdp close": {
|
|
38
|
+
description: "Close a CDP and reclaim collateral",
|
|
39
|
+
usage: "/cdp close <cdp_address>",
|
|
40
|
+
handler: "close_cdp",
|
|
41
|
+
},
|
|
42
|
+
"/cdp health": {
|
|
43
|
+
description: "Check CDP health and collateral ratio",
|
|
44
|
+
usage: "/cdp health [cdp_address]",
|
|
45
|
+
handler: "analyze_cdp_health",
|
|
46
|
+
},
|
|
47
|
+
"/cdp mint": {
|
|
48
|
+
description: "Mint iAssets from a CDP",
|
|
49
|
+
usage: "/cdp mint <cdp_address> <amount>",
|
|
50
|
+
handler: "mint_cdp",
|
|
51
|
+
},
|
|
52
|
+
"/cdp burn": {
|
|
53
|
+
description: "Burn iAssets to reduce CDP debt",
|
|
54
|
+
usage: "/cdp burn <cdp_address> <amount>",
|
|
55
|
+
handler: "burn_cdp",
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
} as const;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenClaw Indigo Commands
|
|
3
|
+
*
|
|
4
|
+
* Chat commands for interacting with Indigo Protocol through
|
|
5
|
+
* Telegram, Discord, and Slack.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export { cdpCommands } from "./cdp.js";
|
|
9
|
+
export { priceCommands } from "./price.js";
|
|
10
|
+
export { stakingCommands } from "./staking.js";
|
|
11
|
+
export { portfolioCommands } from "./portfolio.js";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Portfolio Commands
|
|
3
|
+
*
|
|
4
|
+
* Chat commands for tracking wallet positions and protocol activity.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const portfolioCommands = {
|
|
8
|
+
name: "portfolio",
|
|
9
|
+
description: "Track wallet positions and protocol stats",
|
|
10
|
+
|
|
11
|
+
commands: {
|
|
12
|
+
"/portfolio": {
|
|
13
|
+
description: "View full portfolio summary",
|
|
14
|
+
usage: "/portfolio [address]",
|
|
15
|
+
handlers: [
|
|
16
|
+
"get_cdps_by_owner",
|
|
17
|
+
"get_staking_positions_by_owner",
|
|
18
|
+
"get_sp_account_by_owner",
|
|
19
|
+
"get_blockfrost_balances",
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
"/balance": {
|
|
23
|
+
description: "Check wallet balances",
|
|
24
|
+
usage: "/balance [address]",
|
|
25
|
+
handler: "get_blockfrost_balances",
|
|
26
|
+
},
|
|
27
|
+
"/tvl": {
|
|
28
|
+
description: "View protocol TVL",
|
|
29
|
+
usage: "/tvl",
|
|
30
|
+
handler: "get_tvl",
|
|
31
|
+
},
|
|
32
|
+
"/stats": {
|
|
33
|
+
description: "View protocol statistics",
|
|
34
|
+
usage: "/stats",
|
|
35
|
+
handler: "get_protocol_stats",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
} as const;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Price Query Commands
|
|
3
|
+
*
|
|
4
|
+
* Chat commands for checking iAsset and token prices.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const priceCommands = {
|
|
8
|
+
name: "price",
|
|
9
|
+
description: "Check iAsset and token prices",
|
|
10
|
+
|
|
11
|
+
commands: {
|
|
12
|
+
"/price": {
|
|
13
|
+
description: "Get price of an iAsset",
|
|
14
|
+
usage: "/price <asset>",
|
|
15
|
+
handler: "get_asset_price",
|
|
16
|
+
},
|
|
17
|
+
"/price ada": {
|
|
18
|
+
description: "Get the current ADA price",
|
|
19
|
+
usage: "/price ada",
|
|
20
|
+
handler: "get_ada_price",
|
|
21
|
+
},
|
|
22
|
+
"/price indy": {
|
|
23
|
+
description: "Get the current INDY price",
|
|
24
|
+
usage: "/price indy",
|
|
25
|
+
handler: "get_indy_price",
|
|
26
|
+
},
|
|
27
|
+
"/price all": {
|
|
28
|
+
description: "Get all iAsset prices",
|
|
29
|
+
usage: "/price all",
|
|
30
|
+
handler: "get_assets",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
} as const;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Staking Commands
|
|
3
|
+
*
|
|
4
|
+
* Chat commands for managing INDY staking positions.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const stakingCommands = {
|
|
8
|
+
name: "staking",
|
|
9
|
+
description: "Manage INDY staking positions",
|
|
10
|
+
|
|
11
|
+
commands: {
|
|
12
|
+
"/stake info": {
|
|
13
|
+
description: "View staking overview and APR",
|
|
14
|
+
usage: "/stake info",
|
|
15
|
+
handler: "get_staking_info",
|
|
16
|
+
},
|
|
17
|
+
"/stake list": {
|
|
18
|
+
description: "List your staking positions",
|
|
19
|
+
usage: "/stake list",
|
|
20
|
+
handler: "get_staking_positions_by_owner",
|
|
21
|
+
},
|
|
22
|
+
"/stake open": {
|
|
23
|
+
description: "Open a new staking position",
|
|
24
|
+
usage: "/stake open <amount>",
|
|
25
|
+
handler: "open_staking_position",
|
|
26
|
+
},
|
|
27
|
+
"/stake adjust": {
|
|
28
|
+
description: "Adjust an existing staking position",
|
|
29
|
+
usage: "/stake adjust <position_address> <new_amount>",
|
|
30
|
+
handler: "adjust_staking_position",
|
|
31
|
+
},
|
|
32
|
+
"/stake close": {
|
|
33
|
+
description: "Close a staking position",
|
|
34
|
+
usage: "/stake close <position_address>",
|
|
35
|
+
handler: "close_staking_position",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
} as const;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CDP Message Formatter
|
|
3
|
+
*
|
|
4
|
+
* Formats CDP data for Telegram, Discord, and Slack output.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
type Platform = "telegram" | "discord" | "slack" | "plain";
|
|
8
|
+
|
|
9
|
+
interface CDPData {
|
|
10
|
+
asset: string;
|
|
11
|
+
collateral: number;
|
|
12
|
+
minted: number;
|
|
13
|
+
ratio: number;
|
|
14
|
+
address: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function formatCDPMessage(
|
|
18
|
+
cdps: CDPData[],
|
|
19
|
+
platform: Platform = "plain",
|
|
20
|
+
): string {
|
|
21
|
+
if (cdps.length === 0) {
|
|
22
|
+
return "No CDPs found.";
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
switch (platform) {
|
|
26
|
+
case "telegram":
|
|
27
|
+
return formatTelegram(cdps);
|
|
28
|
+
case "discord":
|
|
29
|
+
return formatDiscord(cdps);
|
|
30
|
+
case "slack":
|
|
31
|
+
return formatSlack(cdps);
|
|
32
|
+
default:
|
|
33
|
+
return formatPlain(cdps);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function formatTelegram(cdps: CDPData[]): string {
|
|
38
|
+
const lines = ["<b>Your CDPs</b>\n"];
|
|
39
|
+
for (const cdp of cdps) {
|
|
40
|
+
const status = cdp.ratio > 200 ? "🟢" : cdp.ratio > 150 ? "🟡" : "🔴";
|
|
41
|
+
lines.push(
|
|
42
|
+
`${status} <b>${cdp.asset}</b>`,
|
|
43
|
+
` Collateral: ${cdp.collateral.toLocaleString()} ADA`,
|
|
44
|
+
` Minted: ${cdp.minted} ${cdp.asset}`,
|
|
45
|
+
` Ratio: ${cdp.ratio}%\n`,
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
return lines.join("\n");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function formatDiscord(cdps: CDPData[]): string {
|
|
52
|
+
const lines = ["**Your CDPs**\n"];
|
|
53
|
+
for (const cdp of cdps) {
|
|
54
|
+
const status = cdp.ratio > 200 ? "🟢" : cdp.ratio > 150 ? "🟡" : "🔴";
|
|
55
|
+
lines.push(
|
|
56
|
+
`${status} **${cdp.asset}**`,
|
|
57
|
+
`> Collateral: ${cdp.collateral.toLocaleString()} ADA`,
|
|
58
|
+
`> Minted: ${cdp.minted} ${cdp.asset}`,
|
|
59
|
+
`> Ratio: ${cdp.ratio}%\n`,
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
return lines.join("\n");
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function formatSlack(cdps: CDPData[]): string {
|
|
66
|
+
const lines = ["*Your CDPs*\n"];
|
|
67
|
+
for (const cdp of cdps) {
|
|
68
|
+
const status = cdp.ratio > 200 ? ":green:" : cdp.ratio > 150 ? ":yellow:" : ":red:";
|
|
69
|
+
lines.push(
|
|
70
|
+
`${status} *${cdp.asset}*`,
|
|
71
|
+
` Collateral: ${cdp.collateral.toLocaleString()} ADA`,
|
|
72
|
+
` Minted: ${cdp.minted} ${cdp.asset}`,
|
|
73
|
+
` Ratio: ${cdp.ratio}%\n`,
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
return lines.join("\n");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function formatPlain(cdps: CDPData[]): string {
|
|
80
|
+
const lines = ["Your CDPs\n"];
|
|
81
|
+
for (const cdp of cdps) {
|
|
82
|
+
lines.push(
|
|
83
|
+
`${cdp.asset}`,
|
|
84
|
+
` Collateral: ${cdp.collateral.toLocaleString()} ADA`,
|
|
85
|
+
` Minted: ${cdp.minted} ${cdp.asset}`,
|
|
86
|
+
` Ratio: ${cdp.ratio}%\n`,
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
return lines.join("\n");
|
|
90
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenClaw Indigo Formatters
|
|
3
|
+
*
|
|
4
|
+
* Platform-specific message formatters for Telegram, Discord, and Slack.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export { formatCDPMessage } from "./cdp-formatter.js";
|
|
8
|
+
export { formatPriceMessage } from "./price-formatter.js";
|
|
9
|
+
export { formatPortfolioMessage } from "./portfolio-formatter.js";
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Portfolio Message Formatter
|
|
3
|
+
*
|
|
4
|
+
* Formats portfolio summary data for Telegram, Discord, and Slack output.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
type Platform = "telegram" | "discord" | "slack" | "plain";
|
|
8
|
+
|
|
9
|
+
interface PortfolioData {
|
|
10
|
+
address: string;
|
|
11
|
+
adaBalance: number;
|
|
12
|
+
cdpCount: number;
|
|
13
|
+
stakingPositions: number;
|
|
14
|
+
stabilityAccounts: number;
|
|
15
|
+
totalCollateral: number;
|
|
16
|
+
totalMinted: Record<string, number>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function formatPortfolioMessage(
|
|
20
|
+
data: PortfolioData,
|
|
21
|
+
platform: Platform = "plain",
|
|
22
|
+
): string {
|
|
23
|
+
switch (platform) {
|
|
24
|
+
case "telegram":
|
|
25
|
+
return formatTelegram(data);
|
|
26
|
+
case "discord":
|
|
27
|
+
return formatDiscord(data);
|
|
28
|
+
case "slack":
|
|
29
|
+
return formatSlack(data);
|
|
30
|
+
default:
|
|
31
|
+
return formatPlain(data);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function mintedSummary(minted: Record<string, number>): string {
|
|
36
|
+
return Object.entries(minted)
|
|
37
|
+
.map(([asset, amount]) => `${amount} ${asset}`)
|
|
38
|
+
.join(", ");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function formatTelegram(data: PortfolioData): string {
|
|
42
|
+
return [
|
|
43
|
+
"<b>Portfolio Summary</b>\n",
|
|
44
|
+
`<b>Wallet:</b> ${data.address.slice(0, 12)}...${data.address.slice(-8)}`,
|
|
45
|
+
`<b>ADA Balance:</b> ${data.adaBalance.toLocaleString()} ADA\n`,
|
|
46
|
+
`<b>CDPs:</b> ${data.cdpCount}`,
|
|
47
|
+
`<b>Total Collateral:</b> ${data.totalCollateral.toLocaleString()} ADA`,
|
|
48
|
+
`<b>Minted:</b> ${mintedSummary(data.totalMinted)}\n`,
|
|
49
|
+
`<b>Staking Positions:</b> ${data.stakingPositions}`,
|
|
50
|
+
`<b>Stability Accounts:</b> ${data.stabilityAccounts}`,
|
|
51
|
+
].join("\n");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function formatDiscord(data: PortfolioData): string {
|
|
55
|
+
return [
|
|
56
|
+
"**Portfolio Summary**\n",
|
|
57
|
+
`**Wallet:** \`${data.address.slice(0, 12)}...${data.address.slice(-8)}\``,
|
|
58
|
+
`**ADA Balance:** ${data.adaBalance.toLocaleString()} ADA\n`,
|
|
59
|
+
`**CDPs:** ${data.cdpCount}`,
|
|
60
|
+
`**Total Collateral:** ${data.totalCollateral.toLocaleString()} ADA`,
|
|
61
|
+
`**Minted:** ${mintedSummary(data.totalMinted)}\n`,
|
|
62
|
+
`**Staking Positions:** ${data.stakingPositions}`,
|
|
63
|
+
`**Stability Accounts:** ${data.stabilityAccounts}`,
|
|
64
|
+
].join("\n");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function formatSlack(data: PortfolioData): string {
|
|
68
|
+
return [
|
|
69
|
+
"*Portfolio Summary*\n",
|
|
70
|
+
`*Wallet:* \`${data.address.slice(0, 12)}...${data.address.slice(-8)}\``,
|
|
71
|
+
`*ADA Balance:* ${data.adaBalance.toLocaleString()} ADA\n`,
|
|
72
|
+
`*CDPs:* ${data.cdpCount}`,
|
|
73
|
+
`*Total Collateral:* ${data.totalCollateral.toLocaleString()} ADA`,
|
|
74
|
+
`*Minted:* ${mintedSummary(data.totalMinted)}\n`,
|
|
75
|
+
`*Staking Positions:* ${data.stakingPositions}`,
|
|
76
|
+
`*Stability Accounts:* ${data.stabilityAccounts}`,
|
|
77
|
+
].join("\n");
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function formatPlain(data: PortfolioData): string {
|
|
81
|
+
return [
|
|
82
|
+
"Portfolio Summary\n",
|
|
83
|
+
`Wallet: ${data.address.slice(0, 12)}...${data.address.slice(-8)}`,
|
|
84
|
+
`ADA Balance: ${data.adaBalance.toLocaleString()} ADA\n`,
|
|
85
|
+
`CDPs: ${data.cdpCount}`,
|
|
86
|
+
`Total Collateral: ${data.totalCollateral.toLocaleString()} ADA`,
|
|
87
|
+
`Minted: ${mintedSummary(data.totalMinted)}\n`,
|
|
88
|
+
`Staking Positions: ${data.stakingPositions}`,
|
|
89
|
+
`Stability Accounts: ${data.stabilityAccounts}`,
|
|
90
|
+
].join("\n");
|
|
91
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Price Message Formatter
|
|
3
|
+
*
|
|
4
|
+
* Formats price data for Telegram, Discord, and Slack output.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
type Platform = "telegram" | "discord" | "slack" | "plain";
|
|
8
|
+
|
|
9
|
+
interface PriceData {
|
|
10
|
+
asset: string;
|
|
11
|
+
price: number;
|
|
12
|
+
change24h?: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function formatPriceMessage(
|
|
16
|
+
prices: PriceData[],
|
|
17
|
+
platform: Platform = "plain",
|
|
18
|
+
): string {
|
|
19
|
+
if (prices.length === 0) {
|
|
20
|
+
return "No price data available.";
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
switch (platform) {
|
|
24
|
+
case "telegram":
|
|
25
|
+
return formatTelegram(prices);
|
|
26
|
+
case "discord":
|
|
27
|
+
return formatDiscord(prices);
|
|
28
|
+
case "slack":
|
|
29
|
+
return formatSlack(prices);
|
|
30
|
+
default:
|
|
31
|
+
return formatPlain(prices);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function changeIndicator(change?: number): string {
|
|
36
|
+
if (change === undefined) return "";
|
|
37
|
+
return change >= 0 ? `+${change.toFixed(2)}%` : `${change.toFixed(2)}%`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function formatTelegram(prices: PriceData[]): string {
|
|
41
|
+
const lines = ["<b>Indigo Prices</b>\n"];
|
|
42
|
+
for (const p of prices) {
|
|
43
|
+
const change = changeIndicator(p.change24h);
|
|
44
|
+
lines.push(`<b>${p.asset}</b>: $${p.price.toFixed(4)} ${change}`);
|
|
45
|
+
}
|
|
46
|
+
return lines.join("\n");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function formatDiscord(prices: PriceData[]): string {
|
|
50
|
+
const lines = ["**Indigo Prices**\n"];
|
|
51
|
+
for (const p of prices) {
|
|
52
|
+
const change = changeIndicator(p.change24h);
|
|
53
|
+
lines.push(`**${p.asset}**: $${p.price.toFixed(4)} ${change}`);
|
|
54
|
+
}
|
|
55
|
+
return lines.join("\n");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function formatSlack(prices: PriceData[]): string {
|
|
59
|
+
const lines = ["*Indigo Prices*\n"];
|
|
60
|
+
for (const p of prices) {
|
|
61
|
+
const change = changeIndicator(p.change24h);
|
|
62
|
+
lines.push(`*${p.asset}*: $${p.price.toFixed(4)} ${change}`);
|
|
63
|
+
}
|
|
64
|
+
return lines.join("\n");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function formatPlain(prices: PriceData[]): string {
|
|
68
|
+
const lines = ["Indigo Prices\n"];
|
|
69
|
+
for (const p of prices) {
|
|
70
|
+
const change = changeIndicator(p.change24h);
|
|
71
|
+
lines.push(`${p.asset}: $${p.price.toFixed(4)} ${change}`);
|
|
72
|
+
}
|
|
73
|
+
return lines.join("\n");
|
|
74
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenClaw Indigo Plugin
|
|
3
|
+
*
|
|
4
|
+
* Indigo Protocol integration for the OpenClaw platform.
|
|
5
|
+
* Provides CDP management, price alerts, and portfolio tracking
|
|
6
|
+
* through Telegram, Discord, and Slack.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export interface OpenClawIndigoConfig {
|
|
10
|
+
/** Indigo MCP server endpoint */
|
|
11
|
+
mcpEndpoint: string;
|
|
12
|
+
/** Enable Telegram bot integration */
|
|
13
|
+
telegram?: boolean;
|
|
14
|
+
/** Enable Discord bot integration */
|
|
15
|
+
discord?: boolean;
|
|
16
|
+
/** Enable Slack bot integration */
|
|
17
|
+
slack?: boolean;
|
|
18
|
+
/** Enable price alert notifications */
|
|
19
|
+
priceAlerts?: boolean;
|
|
20
|
+
/** Enable portfolio tracking notifications */
|
|
21
|
+
portfolioTracking?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const PLUGIN_NAME = "openclaw-indigo";
|
|
25
|
+
|
|
26
|
+
export const FEATURES = [
|
|
27
|
+
"indigo-mcp-integration",
|
|
28
|
+
"telegram-bot",
|
|
29
|
+
"discord-bot",
|
|
30
|
+
"slack-bot",
|
|
31
|
+
"cdp-management",
|
|
32
|
+
"price-alerts",
|
|
33
|
+
"portfolio-tracking",
|
|
34
|
+
] as const;
|
|
35
|
+
|
|
36
|
+
export type Feature = (typeof FEATURES)[number];
|
|
37
|
+
|
|
38
|
+
export function createPlugin(config: OpenClawIndigoConfig) {
|
|
39
|
+
return {
|
|
40
|
+
name: PLUGIN_NAME,
|
|
41
|
+
config,
|
|
42
|
+
features: FEATURES,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Commands
|
|
47
|
+
export {
|
|
48
|
+
cdpCommands,
|
|
49
|
+
priceCommands,
|
|
50
|
+
stakingCommands,
|
|
51
|
+
portfolioCommands,
|
|
52
|
+
} from "./commands/index.js";
|
|
53
|
+
|
|
54
|
+
// Alerts
|
|
55
|
+
export {
|
|
56
|
+
priceAlerts,
|
|
57
|
+
cdpAlerts,
|
|
58
|
+
stakingAlerts,
|
|
59
|
+
type PriceAlertConfig,
|
|
60
|
+
type CDPAlertConfig,
|
|
61
|
+
type StakingAlertConfig,
|
|
62
|
+
} from "./alerts/index.js";
|
|
63
|
+
|
|
64
|
+
// Formatters
|
|
65
|
+
export {
|
|
66
|
+
formatCDPMessage,
|
|
67
|
+
formatPriceMessage,
|
|
68
|
+
formatPortfolioMessage,
|
|
69
|
+
} from "./formatters/index.js";
|