31Third Safe Rebalancer:感知策略的 Safe 投资组合再平衡 - Openclaw Skills
作者:互联网
2026-04-17
什么是 31Third Safe Rebalancer?
31Third Safe Rebalancer 是一款专门用于维护 Gnosis Safe 账户目标资产配置的工具。通过利用 31Third ExecutorModule,它在投资组合策略与链上执行之间提供了安全桥梁。该技能是 Openclaw Skills 去中心化金融的核心组件,使用户能够自动化监控投资组合偏离并生成符合策略的交易计划。
该工具专注于安全性和合规性,通过读取活跃的链上策略,确保每笔交易都符合定义的滑点边界和资产范围。对于需要严格验证和自动化心跳监控以保持投资组合与投资指令一致的基金管理人和 DAO 库库来说,它具有极高的价值。
下载入口:https://github.com/openclaw/skills/tree/main/skills/phips0812/31third-safe-rebalancer
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install 31third-safe-rebalancer
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 31third-safe-rebalancer。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
31Third Safe Rebalancer 应用场景
- 自动化 Gnosis Safe 金库的投资组合偏离监控。
- 执行符合预定义链上安全策略的批量交易。
- 根据滑点和资产范围限制验证复杂的 DeFi 交易计划。
- 作为更广泛的 Openclaw Skills 自动化工作流的一部分,实施基于心跳的再平衡警报。
- 通过单一命令简化从偏离检测到交易执行的再平衡生命周期。
- 该技能使用 Viem 连接到区块链,从 31Third ExecutorModule 读取当前余额和活跃的链上策略。
- 它计算当前投资组合状态与目标分配权重之间的偏离。
- 如果偏离超过阈值,该技能将使用 31Third SDK 生成交易计划,确保所有操作都感知策略。
- 它执行详细的策略检查,以验证拟议的交易不会违反任何智能合约限制。
- 获得批准后,它会准备必要的代币授权,并通过执行者钱包执行再平衡批量操作。
31Third Safe Rebalancer 配置指南
确保您已安装 Node.js 22+ 和 npm。按照以下步骤将其集成到您的 Openclaw Skills 环境中:
npm install
npm run build
在 .env 文件中配置您的环境变量:
SAFE_ADDRESS=0xYourSafe
CHAIN_ID=8453
TOT_API_KEY=your_api_key
RPC_URL=https://mainnet.base.org
EXECUTOR_MODULE_ADDRESS=0xYourExecutorModule
EXECUTOR_WALLET_PRIVATE_KEY=0xYourPrivateKey
在运行再平衡器之前,您必须通过 31Third 仪表板部署您的策略栈。
31Third Safe Rebalancer 数据架构与分类体系
该技能管理与投资组合状态、交易配置和执行元数据相关的数据。使用以下架构作为 Openclaw Skills 处理此类数据的指南:
| 组件 | 格式 | 描述 |
|---|---|---|
| 投资组合偏离 | 百分比 (BPS) | 计算出的与目标权重的偏离度。 |
| 交易计划 | JSON 对象 | 包含批次的 txData 和 requiredAllowances。 |
| 策略元数据 | 链上数据 | 活跃限制,包括资产范围和滑点。 |
| 执行结果 | 交易哈希 | 链上完成再平衡的记录。 |
| 心跳有效载荷 | JSON | 当满足偏离阈值时触发的警报数据。 |
name: 31third-safe-rebalancer
description: Policy-aware Safe portfolio rebalancing assistant for 31Third ExecutorModule.
homepage: https://31third.com
31Third Safe Rebalancer
This skill helps you monitor portfolio drift and prepare/execute policy-compliant rebalances on a Gnosis Safe through the 31Third ExecutorModule.
Best-practice usage:
- Use one-step execution by default:
npm run cli -- rebalance-now. - Only use separated tools (
check_drift,plan_rebalance,execute_rebalance, etc.) if you explicitly understand each step and want manual control. - If unsure, run
helpfirst (npm run cli -- help) and follow that guidance.
Prerequisites
- Node.js 22+
- npm
Local Setup
npm install
npm run build
Getting Started
If you have not deployed your policy stack yet, deploy it first: https://app.31third.com/safe-policy-deployer
Set required environment variables:
SAFE_ADDRESS=0xYourSafe
CHAIN_ID=8453
TOT_API_KEY=your_api_key
RPC_URL=https://mainnet.base.org
EXECUTOR_MODULE_ADDRESS=0xYourExecutorModule
EXECUTOR_WALLET_PRIVATE_KEY=0x...
ORACLE_MAX_AGE_SECONDS=3600
HEARTBEAT_INTERVAL_SECONDS=21600
TOT_API_KEY (31Third API key) can be requested via https://31third.com/contact or by emailing dev@31third.com.
Wallet model and key handling:
- Safe owner wallet: controls Safe ownership/governance operations. Never share this private key with the skill.
- Executor wallet: configured as executor on
ExecutorModulein the wizard. This private key is required by the skill forexecute_rebalance. - The final step of the 31Third wizard provides an overview of all required environment variables. Use that as source of truth when configuring this skill.
What This Skill Does
- Reads active on-chain policies from
ExecutorModule. - Computes current-vs-target drift (
check_drift). - Validates trades against Asset Universe + Slippage boundaries (
validate_trade). - Runs a configurable heartbeat monitor (
automation) and returns an alert payload when drift exceeds threshold. - Simulates and executes approved rebalance batches (
execute_rebalance) with pre-executioncheckPoliciesVerbosevalidation and one retry on unknown execution failures. - Accepts SDK
plan_rebalanceoutput directly for execution (txData+requiredAllowances) and decodes batch trade calldata internally. - Fast-fails execution if
scheduler != registryon theExecutorModule, printing both addresses. - Generates SDK-based policy-aware trade plans (
plan_rebalance) using current Safe balances (bounded by Asset Universe when present) asbaseEntries. - Provides one-command execution (
rebalance_now) for non-technical users: drift check -> SDK plan -> execution. - Returns setup and capability guidance (
help).
Execution Safety
Before execution, the agent provides a clear reason, for example:
BTC is at 54.00%, target is 50.00% (drift 400 bps). Rebalance required.
The skill uses:
- Viem
publicClientfor all reads. - Viem
walletClientfor execution.
Execution Contract (Important)
When using SDK/trading-api rebalancing output, execution must follow this exact pattern:
- Build approvals from
requiredAllowancesas(tokenAddress, neededAllowance). - Decode
txDataasbatchTrade(trades, config). - Re-encode
encodedTradeDataas ABI tuple:tuple(string,address,uint256,address,uint256,bytes,bytes)[]tuple(bool,bool)
- Run
checkPoliciesVerbose(tradesInput, configInput)before submitting. - Read
schedulerandregistryfrom ExecutorModule. - Ensure the signing executor wallet address equals
registry(required byonlyRegistry). - Only execute immediate path (
executeTradeNow(approvals, encodedTradeData)) whenscheduler == registry. - If
scheduler != registry, fail fast and show both addresses.
This is the required execution semantics for this skill and should not be changed to raw passthrough calldata execution.
CLI
Run the bundled CLI:
npm run cli -- help
npm run cli -- check-drift
npm run cli -- automation --last-heartbeat-ms 0
npm run cli -- plan-rebalance --signer 0xYourSigner --min-trade-value 100
npm run cli -- rebalance-now
npm run cli -- validate-trade --trade '{"from":"0x...","to":"0x...","fromAmount":"1000000000000000000","minToReceiveBeforeFees":"990000000000000000"}'
npm run cli -- execute-rebalance --trades '[{"exchangeName":"0x","from":"0x...","fromAmount":"1000000000000000000","to":"0x...","minToReceiveBeforeFees":"990000000000000000","data":"0x...","signature":"0x..."}]' --approvals '[{"token":"0x...","amount":"1000000000000000000"}]'
npm run cli -- execute-rebalance --rebalancing '{"txData":"0x...","requiredAllowances":[{"token":{"address":"0x..."},"neededAllowance":"1000000000000000000"}]}'
Read-only smoke preflight:
npm run smoke -- --signer 0xYourSigner
npm run smoke -- --trades '[...]' --approvals '[...]'
Notes
- This skill is automation infrastructure, not investment advice.
- Validate behavior in test/staging before running in production.
相关推荐
专题
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
最新数据
相关文章
Bear Notes: 自动化 macOS 笔记管理 - Openclaw Skills
ClawHub CLI: 高级 AI 智能体技能管理 - Openclaw Skills
NervePay Identity:加密 AI 智能体身份验证 - Openclaw Skills
高频复购小商品电商运营 - Openclaw 技能库
cfshare: 通过 Cloudflare 安全共享本地端口和文件 - Openclaw Skills
Webhook 路由器:安全自动化 Webhook 管理 - Openclaw Skills
代发货导师 Nick:电子商务策略与增长 - Openclaw Skills
巨鲸追踪器:链上聪明钱分析 - Openclaw Skills
TikTok 爆款标题生成器:利用 Openclaw Skills 提升参与度
收益监测器:跟踪下载量与收益 - Openclaw Skills
AI精选
