본문으로 건너뛰기
cccskills
무료GitHub에 공개

31third-safe-rebalancer

Policy-aware Safe portfolio rebalancing assistant for 31Third ExecutorModule.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(26)

  • SKILL.md5.1 KB
  • abi/AssetUniversePolicy.json64.3 KB
  • abi/ExecutorModule.json139.6 KB
  • abi/IBatchTrade.json7.1 KB
  • abi/SlippagePolicy.json72.6 KB
  • abi/StaticAllocationPolicy.json120.9 KB
  • abi/TokenFeedRegistry.json40.7 KB
  • index.ts21.6 KB
  • package-lock.json60.0 KB
  • package.json995 B
  • scripts/cli.ts7.1 KB
  • scripts/smoke.ts8.1 KB
  • skill.json1.6 KB
  • skill.yaml105 B
  • src/balancer.ts11.9 KB
  • src/contracts.ts1.9 KB
  • src/executor.ts5.6 KB
  • src/policies.ts4.1 KB
  • tests/balancer-plan.test.ts2.5 KB
  • tests/cli.test.ts4.2 KB
  • tests/contracts.test.ts1.1 KB
  • tests/executor.test.ts4.1 KB
  • tests/policies.test.ts5.0 KB
  • tests/rebalance.test.ts28.1 KB
  • tests/smoke.test.ts2.1 KB
  • tsconfig.json390 B

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

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 help first (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 ExecutorModule in the wizard. This private key is required by the skill for execute_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-execution checkPoliciesVerbose validation and one retry on unknown execution failures.
  • Accepts SDK plan_rebalance output directly for execution (txData + requiredAllowances) and decodes batch trade calldata internally.
  • Fast-fails execution if scheduler != registry on the ExecutorModule, printing both addresses.
  • Generates SDK-based policy-aware trade plans (plan_rebalance) using current Safe balances (bounded by Asset Universe when present) as baseEntries.
  • 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 publicClient for all reads.
  • Viem walletClient for execution.

Execution Contract (Important)

When using SDK/trading-api rebalancing output, execution must follow this exact pattern:

  1. Build approvals from requiredAllowances as (tokenAddress, neededAllowance).
  2. Decode txData as batchTrade(trades, config).
  3. Re-encode encodedTradeData as ABI tuple:
    • tuple(string,address,uint256,address,uint256,bytes,bytes)[]
    • tuple(bool,bool)
  4. Run checkPoliciesVerbose(tradesInput, configInput) before submitting.
  5. Read scheduler and registry from ExecutorModule.
  6. Ensure the signing executor wallet address equals registry (required by onlyRegistry).
  7. Only execute immediate path (executeTradeNow(approvals, encodedTradeData)) when scheduler == registry.
  8. 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.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

name: 4d-compression-core version: 1.0.2 description: "把长内容压缩成结构化向量——节省 60-80% Token,保留核心信息" metadata: { "openclaw": { "emoji": "🌀", "requires": { "bins": ["jq", "awk"] }, "triggers": ["压缩", "4d",...

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

modbender/skill-library-mcp172026년 9월 28일 업데이트

Use cheap, TEE-verified AI models from the 0G Compute Network as OpenClaw providers. Discover available models and compare pricing vs OpenRouter, verify provider integrity via hardware attestation (Intel TDX), manage your 0G wallet and sub-accounts, and configure models in OpenClaw with one workflow. Supports DeepSeek, GLM-5, Qwen, and other models available on the 0G marketplace.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

modbender/skill-library-mcp172026년 9월 28일 업데이트

Send and receive P2P messages using disposable numbers and PINs. No servers, no accounts. Use for human notifications, approval flows, and agent-to-agent communication.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

modbender/skill-library-mcp172026년 9월 28일 업데이트

0xarchive

무료

Query historical crypto market data from 0xArchive across Hyperliquid, Lighter.xyz, and HIP-3. Covers orderbooks, trades, candles, funding rates, open interest, liquidations, and data quality. Use when the user asks about crypto market data, orderbooks, trades, funding rates, or historical prices on Hyperliquid, Lighter.xyz, or HIP-3.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

modbender/skill-library-mcp172026년 9월 28일 업데이트

0xwork

무료

Find and complete paid tasks on the 0xWork decentralized marketplace (Base chain, USDC escrow). Use when: the agent wants to earn money/USDC by doing work, discover available tasks, claim a bounty, submit deliverables, check earnings or wallet balance, or set up as a 0xWork worker. Task categories: Writing, Research, Social, Creative, Code, Data. NOT for: posting tasks (use the website), managing the 0xWork platform, or frontend development.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

modbender/skill-library-mcp172026년 9월 28일 업데이트

Patterns and practices that dramatically accelerate development velocity. Covers parallel execution, automation, feedback loops, workflow optimization, and anti-pattern avoidance. Use when starting projects, planning sprints, optimizing workflows, or onboarding developers.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

modbender/skill-library-mcp172026년 9월 28일 업데이트

modbender의 스킬 모두 보기

이 스킬의 문제 신고