basket-claim
Use when the agent needs to claim payout from a settled basket via vara-wallet. Do not use before settlement is finalized.
What this skill does
# Basket Claim
Claim payout from a settled PolyBaskets basket via `vara-wallet`.
## Setup
**MAINNET ONLY.** Run `vara-wallet config set network mainnet` before anything else. NEVER switch to testnet — there are no contracts there.
```bash
vara-wallet config set network mainnet
BASKET_MARKET="0xea8373e8b4441ef6e95325c1044d23ebf615b43fdef60a48623836a15ca7a25a"
BET_LANE="0x35848dea0ab64f283497deaff93b12fe4d17649624b2cd5149f253ef372b29dc"
FREEBET_LEDGER="0x6b4ad81d13194f8e27f71f4046c6e489b2af2b0b1ce835f390899941034fd979"
_PB="${POLYBASKETS_SKILLS_DIR:-skills}"
IDL="$_PB/idl/polymarket-mirror.idl"
BET_LANE_IDL="$_PB/idl/bet_lane_client.idl"
FREEBET_LEDGER_IDL="$_PB/idl/freebet-ledger.idl"
```
## Pre-Check Workflow
### 1. Verify settlement is finalized
```bash
vara-wallet call $BASKET_MARKET BasketMarket/GetSettlement \
--args '[<basket_id>]' --idl $IDL
```
Check the result:
- `status: "Finalized"` — ready to claim
- `status: "Proposed"` — challenge window not yet passed, or nobody has finalized yet. Anyone can call `FinalizeSettlement` after `challenge_deadline`; before that, wait.
- Error `SettlementNotFound` — not yet settled
```bash
# Parse settlement status
vara-wallet call $BASKET_MARKET BasketMarket/GetSettlement \
--args '[<basket_id>]' --idl $IDL | jq '.result.ok.status'
```
Get your hex address first (SS58 won't work for actor_id args):
```bash
MY_ADDR=$(vara-wallet balance | jq -r .address)
```
### 2. Verify position exists and is unclaimed
```bash
# VARA lane
vara-wallet call $BASKET_MARKET BasketMarket/GetPositions \
--args '["'$MY_ADDR'"]' --idl $IDL | jq '.result[] | select(.basket_id == <basket_id>)'
# native VARA freebet lane
vara-wallet call $BASKET_MARKET BasketMarket/GetFreebetPositions \
--args '["'$MY_ADDR'"]' --idl $IDL | jq '.result[] | select(.basket_id == <basket_id>)'
# BET lane
vara-wallet call $BET_LANE BetLane/GetPosition \
--args '["'$MY_ADDR'", <basket_id>]' --idl $BET_LANE_IDL
```
Check `claimed: false`.
## Claim (VARA Lane)
For baskets with `asset_kind: "Vara"`:
```bash
vara-wallet --account agent call $BASKET_MARKET BasketMarket/Claim --voucher $VOUCHER_ID \
--args '[<basket_id>]' --idl $IDL
```
Returns `u128` — payout amount in minimal VARA units (divide by 10^12 for VARA).
For native VARA freebet positions, use the same `BasketMarket/Claim` method. The contract returns the freebet principal to `FreebetLedger` and sends only profit above the original stake to the user's wallet.
### Example
```bash
# Claim from basket 0
PAYOUT=$(vara-wallet --account agent call $BASKET_MARKET BasketMarket/Claim --voucher $VOUCHER_ID \
--args '[0]' --idl $IDL)
echo "Payout: $PAYOUT"
```
## Claim (BET Token Lane)
For baskets with `asset_kind: "Bet"`:
```bash
vara-wallet --account agent call $BET_LANE BetLane/Claim --voucher $VOUCHER_ID \
--args '[<basket_id>]' --idl $BET_LANE_IDL
```
Returns `u256` — payout amount in BET token units.
### Example
```bash
# Claim from basket 1 via BET lane
vara-wallet --account agent call $BET_LANE BetLane/Claim --voucher $VOUCHER_ID \
--args '[1]' --idl $BET_LANE_IDL
```
## Payout Calculation
```
payout = shares * (settlement_index / entry_index)
```
The `payout_per_share` is pre-computed in the Settlement struct during proposal. You can preview your expected payout before claiming:
```bash
# Get settlement payout_per_share
SETTLEMENT=$(vara-wallet call $BASKET_MARKET BasketMarket/GetSettlement \
--args '[<basket_id>]' --idl $IDL)
echo $SETTLEMENT | jq '.result.ok.payout_per_share'
```
See `../references/index-math.md` for detailed formula and examples.
## Verify After Claim
```bash
# Check position is now claimed
vara-wallet call $BASKET_MARKET BasketMarket/GetPositions \
--args '["'$MY_ADDR'"]' --idl $IDL | jq '.result[] | select(.basket_id == <basket_id>) | .claimed'
# Check native freebet position is now claimed, when applicable
vara-wallet call $BASKET_MARKET BasketMarket/GetFreebetPositions \
--args '["'$MY_ADDR'"]' --idl $IDL | jq '.result[] | select(.basket_id == <basket_id>) | .claimed'
# Check freebet principal was returned to ledger, when applicable
vara-wallet call $FREEBET_LEDGER FreebetLedger/BalanceOf \
--args '["'$MY_ADDR'"]' --idl $FREEBET_LEDGER_IDL
# Check VARA balance increased
vara-wallet balance
```
## Common Errors
| Error | Cause | Fix |
|-------|-------|-----|
| `SettlementNotFinalized` | Settlement not yet finalized | Wait for finalization |
| `AlreadyClaimed` | Already claimed this basket | No action needed |
| `NothingToClaim` | No position in this basket | Verify position exists |
| `SettlementNotFound` | No settlement proposed | Wait for settler to propose |
| `TransferFailed` | VARA transfer failed | Check contract balance, retry |
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.