Loading...
Loading...
Use when the agent has the settler role and needs to propose or finalize a basket settlement via vara-wallet. Do not use without settler role permissions. Do not use for regular user actions.
npx skill4agent add adityaakr/polybaskets basket-settlevara-wallet config set network mainnetvara-wallet config set network mainnet
BASKET_MARKET="0x702395d43248eaa5f1fd4d9eadadc75b0fb1c7c5ae9ea20bf31375fd4358f403"
_PB="${POLYBASKETS_SKILLS_DIR:-skills}"
IDL="$_PB/idl/polymarket-mirror.idl"settler_role# Check who has settler role
vara-wallet call $BASKET_MARKET BasketMarket/GetConfig --args '[]' --idl $IDL | jq '.settler_role'
# Check agent's address
vara-wallet wallet list | jq -r '.[0].address'settler_role1. Check basket is Active
2. Verify all items have resolved on Polymarket
3. ProposeSettlement → starts 12-minute challenge window
4. Wait for challenge_deadline to pass
5. FinalizeSettlement → basket becomes Settled, users can claimvara-wallet call $BASKET_MARKET BasketMarket/GetBasket \
--args '[<basket_id>]' --idl $IDL | jq '.result.ok.status'"Active"curl -s "https://gamma-api.polymarket.com/markets?slug=<poly_slug>" | jq '.[0] | {closed, outcomePrices}'closed: trueitem_resolutionsItemResolution{
"item_index": 0,
"resolved": "YES",
"poly_slug": "will-btc-hit-100k",
"poly_condition_id": "0xabc123...",
"poly_price_yes": 9900,
"poly_price_no": 100
}item_indexpoly_slugpoly_price_yespoly_price_noresolved"YES""NO"poly_condition_idvara-wallet --account agent call $BASKET_MARKET BasketMarket/ProposeSettlement --voucher $VOUCHER_ID \
--args '[
0,
[
{
"item_index": 0,
"resolved": "YES",
"poly_slug": "will-btc-hit-100k",
"poly_condition_id": null,
"poly_price_yes": 9900,
"poly_price_no": 100
},
{
"item_index": 1,
"resolved": "NO",
"poly_slug": "will-eth-hit-5k",
"poly_condition_id": null,
"poly_price_yes": 200,
"poly_price_no": 9800
}
],
"Resolved via Polymarket API"
]' \
--idl $IDLSettlementPending# Check challenge deadline
vara-wallet call $BASKET_MARKET BasketMarket/GetSettlement \
--args '[<basket_id>]' --idl $IDL | jq '.result.ok | {status, challenge_deadline, proposed_at}'challenge_deadlineliveness_mschallenge_deadlinevara-wallet --account agent call $BASKET_MARKET BasketMarket/FinalizeSettlement --voucher $VOUCHER_ID \
--args '[<basket_id>]' --idl $IDLSettledfinalized_at../basket-claim/SKILL.mdvara-wallet call $BASKET_MARKET BasketMarket/GetSettlement \
--args '[<basket_id>]' --idl $IDL | jq '.result.ok | {status, payout_per_share, finalized_at}'| Error | Cause | Fix |
|---|---|---|
| Not the settler role | Check config for settler_role address |
| Basket already in settlement | Check status |
| Already proposed | Wait and finalize |
| Wrong number of resolutions | Provide one per item |
| Slug doesn't match basket item | Use exact slug from basket |
| Same item_index twice | Make indices unique |
| Index >= items count | Use 0 to items.length-1 |
| Too early to finalize | Wait for challenge window |
| No proposal exists | Propose first |
| Settlement not yet finalized | Call FinalizeSettlement after challenge window |