Loading...
Loading...
Use when the agent needs to claim payout from a settled basket via vara-wallet. Do not use before settlement is finalized.
npx skill4agent add adityaakr/polybaskets basket-claimvara-walletvara-wallet config set network mainnetvara-wallet config set network mainnet
BASKET_MARKET="0x702395d43248eaa5f1fd4d9eadadc75b0fb1c7c5ae9ea20bf31375fd4358f403"
BET_LANE="0xf5aa436669bb3fc97c1675d06949592e8617f889cbd055451f321113b17bb564"
_PB="${POLYBASKETS_SKILLS_DIR:-skills}"
IDL="$_PB/idl/polymarket-mirror.idl"
BET_LANE_IDL="$_PB/idl/bet_lane_client.idl"vara-wallet call $BASKET_MARKET BasketMarket/GetSettlement \
--args '[<basket_id>]' --idl $IDLstatus: "Finalized"status: "Proposed"../basket-settle/SKILL.mdproposed_atSettlementNotFound# Parse settlement status
vara-wallet call $BASKET_MARKET BasketMarket/GetSettlement \
--args '[<basket_id>]' --idl $IDL | jq '.result.ok.status'MY_ADDR=$(vara-wallet balance | jq -r .address)# VARA lane
vara-wallet call $BASKET_MARKET BasketMarket/GetPositions \
--args '["'$MY_ADDR'"]' --idl $IDL | jq '.[] | select(.basket_id == <basket_id>)'
# BET lane
vara-wallet call $BET_LANE BetLane/GetPosition \
--args '["'$MY_ADDR'", <basket_id>]' --idl $BET_LANE_IDLclaimed: falseasset_kind: "Vara"vara-wallet --account agent call $BASKET_MARKET BasketMarket/Claim --voucher $VOUCHER_ID \
--args '[<basket_id>]' --idl $IDLu128# Claim from basket 0
PAYOUT=$(vara-wallet --account agent call $BASKET_MARKET BasketMarket/Claim --voucher $VOUCHER_ID \
--args '[0]' --idl $IDL)
echo "Payout: $PAYOUT"asset_kind: "Bet"vara-wallet --account agent call $BET_LANE BetLane/Claim --voucher $VOUCHER_ID \
--args '[<basket_id>]' --idl $BET_LANE_IDLu256# Claim from basket 1 via BET lane
vara-wallet --account agent call $BET_LANE BetLane/Claim --voucher $VOUCHER_ID \
--args '[1]' --idl $BET_LANE_IDLpayout = shares * (settlement_index / entry_index)payout_per_share# 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'../references/index-math.md# Check position is now claimed
vara-wallet call $BASKET_MARKET BasketMarket/GetPositions \
--args '["'$MY_ADDR'"]' --idl $IDL | jq '.[] | select(.basket_id == <basket_id>) | .claimed'
# Check VARA balance increased
vara-wallet balance| Error | Cause | Fix |
|---|---|---|
| Settlement not yet finalized | Wait for finalization |
| Already claimed this basket | No action needed |
| No position in this basket | Verify position exists |
| No settlement proposed | Wait for settler to propose |
| VARA transfer failed | Check contract balance, retry |