amped-defi
DeFi operations plugin for OpenClaw enabling cross-chain swaps, bridging, and money market operations via SODAX. Use when building trading bots, DeFi agents, or portfolio management tools that need cross-chain execution.
- License 许可
- MIT
- 最近更新
- 2026-04-05
- Stars
- ★ 7
- Forks
- 1
01 前言 Front Matter
- name
- amped-defi
- version
- 1.0.0
- description
- DeFi operations plugin for OpenClaw enabling cross-chain swaps, bridging, and money market operations via SODAX. Use when building trading bots, DeFi agents, or portfolio management tools that need cross-chain execution.
02 资源文件 50
- 参考文档_meta.json292 B
- 脚本examples/basic-usage.ts3.5 KB
- 脚本index.js77 B
- 脚本jest.config.js905 B
- 参考文档openclaw.plugin.json1.3 KB
- 参考文档package-lock.json390.8 KB
- 参考文档package.json1.6 KB
- 参考文档README.md21.7 KB
- 脚本src/__mocks__/@sodax/sdk.ts487 B
- 脚本src/__tests__/errors.test.ts7.3 KB
- 脚本src/__tests__/policyEngine.test.ts10.9 KB
- 脚本src/__tests__/positionAggregator.test.ts7.9 KB
- 脚本src/__tests__/setup.ts767 B
- 脚本src/__tests__/sodaxApi.test.ts5.9 KB
- 脚本src/__tests__/walletRegistry.test.ts4.6 KB
- 脚本src/index.ts12.3 KB
- 脚本src/policy/policyEngine.ts11.3 KB
- 脚本src/providers/spokeProviderFactory.ts7.8 KB
- 脚本src/sodax/client.ts2.7 KB
- 脚本src/tools/bridge.ts13.7 KB
- 脚本src/tools/discovery.ts33.4 KB
- 脚本src/tools/moneyMarket.ts40.5 KB
- 脚本src/tools/portfolio.ts22.7 KB
- 脚本src/tools/swap.ts32.8 KB
- 脚本src/tools/walletManagement.ts10.1 KB
- 脚本src/types.ts4.3 KB
- 脚本src/utils/errors.ts12.4 KB
- 脚本src/utils/errorUtils.ts450 B
- 脚本src/utils/positionAggregator.ts18.3 KB
- 脚本src/utils/priceService.ts4.3 KB
- 脚本src/utils/sodaxApi.ts7.3 KB
- 脚本src/utils/tokenResolver.ts11.0 KB
- 脚本src/wallet/backendConfig.ts3.8 KB
- 脚本src/wallet/backends/BankrBackend.ts12.5 KB
- 脚本src/wallet/backends/BankrWalletProvider.ts10.0 KB
- 脚本src/wallet/backends/EnvBackend.ts4.0 KB
- 脚本src/wallet/backends/EvmWalletSkillBackend.ts2.9 KB
- 脚本src/wallet/backends/index.ts487 B
- 脚本src/wallet/index.ts253 B
- 脚本src/wallet/providers/AmpedWalletProvider.ts9.0 KB
- 脚本src/wallet/providers/BankrBackend.ts11.7 KB
- 脚本src/wallet/providers/chainConfig.ts5.3 KB
- 脚本src/wallet/providers/index.ts1.4 KB
- 脚本src/wallet/providers/LocalKeyBackend.ts5.0 KB
- 脚本src/wallet/providers/types.ts4.3 KB
- 脚本src/wallet/skillWalletAdapter.ts10.0 KB
- 脚本src/wallet/types.ts5.6 KB
- 脚本src/wallet/walletManager.ts15.6 KB
- 脚本src/wallet/walletRegistry.ts5.7 KB
- 参考文档tsconfig.json787 B
03 SKILL.md 正文
Amped DeFi Plugin
DeFi operations plugin for OpenClaw enabling cross-chain swaps, bridging, and money market operations via the SODAX SDK.
Features
- ? Cross-Chain Swaps — Execute token swaps across Ethereum, Arbitrum, Base, Optimism, Avalanche, BSC, Sonic
- ? Token Bridging — Bridge assets between spoke chains and the Sonic hub chain
- ? Cross-Chain Money Market — Supply on Chain A, borrow to Chain B (your collateral stays put!)
- ? Unified Portfolio View — Cross-chain position aggregator with health metrics, risk analysis & recommendations
- ? Intent History — Query complete swap/bridge history via SODAX API
- ? Security First — Policy engine with spend limits, slippage caps, allowlists
Installation
openclaw plugins install amped-defi
Verify with:
openclaw plugins list
openclaw tools list | grep amped_oc
Wallet Setup
The plugin works without a wallet for read-only operations (quotes, balances, discovery). To execute transactions, install evm-wallet-skill:
git clone https://github.com/amped-finance/evm-wallet-skill.git ~/.openclaw/skills/evm-wallet-skill
cd ~/.openclaw/skills/evm-wallet-skill && npm install
node src/setup.js # Generate a new wallet
Or use Bankr for managed key infrastructure:
export BANKR_API_KEY=your-bankr-api-key
Available Tools (24 Total)
Discovery
| Tool | Description |
|---|---|
amped_supported_chains |
List all supported spoke chains |
amped_supported_tokens |
Get supported tokens by module and chain |
amped_cross_chain_positions |
⭐ Unified portfolio view across ALL chains |
amped_money_market_positions |
Single-chain position details |
amped_money_market_reserves |
Market reserves, APYs, liquidity |
amped_user_intents |
Query intent history via SODAX API |
amped_portfolio_summary |
Wallet balances + MM positions combined |
Swap & Bridge
| Tool | Description |
|---|---|
amped_swap_quote |
Get exact-in/exact-out swap quote |
amped_swap_execute |
Execute swap with policy enforcement |
amped_swap_status |
Check swap/intent status |
amped_swap_cancel |
Cancel pending swap |
amped_bridge_discover |
Discover bridge routes |
amped_bridge_quote |
Check bridgeability and max amount |
amped_bridge_execute |
Execute bridge operation |
Money Market
| Tool | Description |
|---|---|
amped_mm_supply |
Supply tokens as collateral |
amped_mm_withdraw |
Withdraw supplied tokens |
amped_mm_borrow |
Borrow tokens (cross-chain capable!) |
amped_mm_repay |
Repay borrowed tokens |
Wallet Management
| Tool | Description |
|---|---|
amped_list_wallets |
List all configured wallets |
amped_add_wallet |
Add a new wallet with nickname |
amped_rename_wallet |
Rename existing wallet |
amped_remove_wallet |
Remove wallet from config |
amped_set_default_wallet |
Set default wallet |
amped_wallet_address |
Get wallet address by nickname |
⚠️ Critical: Money Market Architecture
Hub-Spoke Model
SODAX uses a hub-spoke architecture:
- Hub chain: Sonic (chain ID: 146) — where reserves live
- Spoke chains: Base, Arbitrum, Ethereum, Optimism, etc. — user interaction points
Rule: Money market operations (supply, borrow, withdraw, repay) must be initiated from spoke chains, NOT the hub chain (Sonic).
Per-Chain Health Factors
? Each spoke chain maintains its OWN independent health factor.
- Collateral on Base does NOT protect positions on Arbitrum
- Each chain's positions are isolated for liquidation purposes
- You MUST display health factor per chain, not aggregated
Example of dangerous misinterpretation:
❌ WRONG: "Combined health factor: 2.65"
✅ RIGHT: "Base HF: 4.11 ✅ | Arbitrum HF: 1.2 ⚠️ (at risk!)"
When using amped_cross_chain_positions, always check the chainBreakdown array:
{
"chainBreakdown": [
{ "chainId": "base", "healthFactor": "4.11", "supplyUsd": "17.25", "borrowUsd": "4.20" },
{ "chainId": "arbitrum", "healthFactor": "1.20", "supplyUsd": "100.00", "borrowUsd": "83.00" }
]
}
Never show an aggregated health factor — it could mislead users into thinking they're safe when one chain is at liquidation risk.
Example: Cross-Chain Swap
"Swap 1000 USDC on Ethereum to USDT on Arbitrum"
Or via tools:
// Get quote
const quote = await agent.call('amped_swap_quote', {
walletId: 'main',
srcChainId: 'ethereum',
dstChainId: 'arbitrum',
srcToken: 'USDC',
dstToken: 'USDT',
amount: '1000',
type: 'exact_input',
slippageBps: 50
});
// Execute
const result = await agent.call('amped_swap_execute', {
walletId: 'main',
quote: quote
});
Example: Cross-Chain Money Market
Supply on Base, borrow on Arbitrum:
// Supply on Base
await agent.call('amped_mm_supply', {
walletId: 'main',
chainId: 'base',
token: 'USDC',
amount: '1000',
useAsCollateral: true
});
// Borrow to Arbitrum (different chain!)
await agent.call('amped_mm_borrow', {
walletId: 'main',
chainId: 'base', // Where collateral lives
dstChainId: 'arbitrum', // Where borrowed tokens go
token: 'USDT',
amount: '500'
});
Example: Portfolio Display
When displaying portfolio data, always:
- Show balances per chain (not totaled)
- Show health factor per chain (not aggregated)
- Flag at-risk positions (HF < 1.5)
const positions = await agent.call('amped_cross_chain_positions', {
walletId: 'main'
});
// Good display:
positions.chainBreakdown.forEach(chain => {
console.log(`${chain.chainId}: Supply $${chain.supplyUsd} | Borrow $${chain.borrowUsd} | HF: ${chain.healthFactor}`);
});
Supported Chains
Ethereum, Arbitrum, Base, Optimism, Avalanche, BSC, Polygon, Sonic (hub), LightLink, HyperEVM, Kaia
Resources
- npm: https://www.npmjs.com/package/amped-defi
- GitHub: https://github.com/amped-finance/amped-defi
- SODAX Docs: https://docs.sodax.com
- Discord: https://discord.gg/amped
? Agent Gotchas
Bankr Wallet Limitations
Bankr wallets have restricted chain support:
| Chain | As Source | As Destination |
|---|---|---|
| Ethereum | ✅ | ✅ |
| Base | ✅ | ✅ |
| Polygon | ✅ | ✅ |
| Solana | ❌ | ✅ (receive only) |
| Arbitrum | ❌ | ❌ |
| Optimism | ❌ | ❌ |
| Other chains | ❌ | ❌ |
Example: Cross-chain swap from Base to Solana works with Bankr:
await agent.call('amped_swap_execute', {
walletId: 'bankr',
srcChainId: 'base', // ✅ Bankr supports as source
dstChainId: 'solana', // ✅ Solana OK as destination
recipient: '8qguBqM4UHQ...', // Solana base58 address
...
});
Will fail: Trying to swap FROM Arbitrum using Bankr wallet.
Intent-Based Settlement
Swaps and bridges use intent-based execution:
- Transactions are NOT instant
- Settlement typically takes 30-60 seconds
- Use
amped_swap_statusto check completion - The
sodaxScanUrlin responses shows full intent lifecycle
Don't assume completion just because the tool returned success — that means the intent was submitted, not settled.
Solana Address Format
Solana addresses use base58 encoding, not hex:
- ✅ Correct:
8qguBqM4UHQNHgBm18NLPeonSSFEB3RWBdbih6FXhwZu - ❌ Wrong:
0x8qguBqM4UHQ...
When specifying a Solana recipient for cross-chain swaps, use the base58 format.
Slippage in Volatile Markets
Default slippage (50 bps / 0.5%) may cause reverts during high volatility:
- Normal conditions: 50 bps is fine
- Volatile markets: Consider 100-200 bps
- Very volatile: Up to 300 bps
await agent.call('amped_swap_quote', {
...
slippageBps: 150 // 1.5% for volatile conditions
});
Token Decimals
The plugin handles decimals automatically, but be aware:
- USDC, USDT: 6 decimals
- Most ERC20s: 18 decimals
- Native tokens (ETH, MATIC): 18 decimals
When displaying amounts, the plugin returns human-readable values (e.g., "100.5" not "100500000").
? Chain Display Emoji
Use these emoji for consistent chain identification in portfolio displays:
| Chain | Emoji | Hex Code |
|---|---|---|
| LightLink | ⚡ | U+26A1 |
| Base | ? | U+1F7E6 |
| Sonic | ⚪ | U+26AA |
| Arbitrum | ? | U+1F53D |
| Optimism | ? | U+1F534 |
| Polygon | ♾️ | U+267E |
| BSC | ? | U+1F536 |
| Ethereum | ? | U+1F48E |
| Avalanche | ? | U+1F53A |
| HyperEVM | ? | U+1F300 |
| Kaia | ? | U+1F7E2 |
Usage Example:
⚡ LightLink │ 0.002 ETH + 5.49 USDC │ $9.78
? Base │ 0.002 ETH + 0.39 USDC │ $4.55
│ ? Supply $21.93 Borrow $5.00
│ ? HF: 3.51 ?
04 同仓库更多 Skills
zyfai
Earn yield on any Ethereum wallet on Base, Arbitrum, and Plasma. Use when a user wants passive DeFi yield on their funds. Deploys a non-custodial subaccount (Safe) linked to their EOA, enables automated yield optimization, and lets them deposit/withdraw anytime.
zerion-api
暂无简介
zerion-api-skill
暂无简介
zerion-api-mcp
暂无简介
yahoo-finance-forex
Fetches real-time FOREX news and market data from Yahoo Finance for major currency pairs (EUR/USD, GBP/USD, USD/JPY, etc.). Analyzes sentiment and provides trading context.
yahoo-finance
This skill should be used when the user asks to "get stock prices", "check stock quotes", "look up earnings", "get financial data", "find trending stocks", or needs stock market data from Yahoo Finance.