basket-claim
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.
vara-wallet config set network mainnet
BASKET_MARKET="0xe5dd153b813c768b109094a9e2eb496c38216b1dbe868391f1d20ac927b7d2c2"
BET_LANE="0x35848dea0ab64f283497deaff93b12fe4d17649624b2cd5149f253ef372b29dc"
_PB="${POLYBASKETS_SKILLS_DIR:-skills}"
IDL="$_PB/idl/polymarket-mirror.idl"
BET_LANE_IDL="$_PB/idl/bet_lane_client.idl"
Pre-Check Workflow
1. Verify settlement is finalized
vara-wallet call $BASKET_MARKET BasketMarket/GetSettlement \
--args '[<basket_id>]' --idl $IDL
Check the result:
status: "Finalized"— ready to claimstatus: "Proposed"— challenge window not yet passed, or nobody has finalized yet. Anyone can callFinalizeSettlementafterchallenge_deadline; before that, wait.- Error
SettlementNotFound— not yet settled
# 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):
MY_ADDR=$(vara-wallet balance | jq -r .address)
2. Verify position exists and is unclaimed
# VARA lane
vara-wallet call $BASKET_MARKET BasketMarket/GetPositions \
--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":
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).
Example
# 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":
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
# 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:
# 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
# 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 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 |
More from adityaakr/polybaskets
basket-create
Use when the agent needs to create a new prediction basket on-chain via vara-wallet. Do not use for betting, querying, or settlement.
214basket-query
Use when the agent needs to read basket state, user positions, settlement status, config, or basket count from the on-chain contracts. All queries are free (no gas, no account needed). Do not use for state-changing operations.
213basket-settle
Use when the agent has the settler role and needs to propose a basket settlement via vara-wallet, or needs to finalize an already proposed settlement after the challenge deadline. Do not use for regular user actions.
213polybaskets-skills
Use when an agent needs to interact with PolyBaskets prediction market baskets on Vara Network — create baskets, place bets, query state, claim payouts, or understand the protocol. Do not use for building Sails programs or general Vara development (use vara-skills for that).
213basket-bet
Use when the agent needs to claim CHIP tokens and place a bet on an existing basket via vara-wallet. This is the primary agent action. Do not use for basket creation, querying, or claiming payouts.
212polybaskets-overview
Use when the agent or user needs to understand what PolyBaskets is, how baskets work, the index calculation, the payout model, or the settlement lifecycle. Do not use when the task is to execute an on-chain action.
212