Add redeem_positions tool for claiming resolved market winnings#40
Add redeem_positions tool for claiming resolved market winnings#40Royal-lobster merged 4 commits intomainfrom
Conversation
Add a new tool to redeem (claim) winnings from resolved Polymarket prediction markets. This enables users to collect USDC from positions in markets that have been settled. - Add redemption service with CTF and NegRiskAdapter support - Add redeem_positions tool with conditionId, tokenId, outcomeIndex params - Support both regular CTF markets and negative risk markets - Verify market resolution and token balance before redemption Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary of ChangesHello @Royal-lobster, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a crucial feature enabling users to redeem their winnings from settled Polymarket prediction markets. It provides a robust service to manage the complexities of on-chain redemption, ensuring that market resolution and token balances are correctly verified before transactions are executed. The new tool integrates seamlessly, offering a straightforward way to interact with both standard and negative risk market redemption processes. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request introduces a valuable redeem_positions tool for claiming winnings from resolved markets. The implementation is well-structured with a dedicated redemption service. My review focuses on enhancing the robustness of the error handling and improving input validation. I've identified several areas where errors are suppressed, which could lead to confusing behavior for the user. I've also highlighted a high-severity issue where a fallback mechanism could cause users to waste gas on transactions that are guaranteed to fail. Finally, I've suggested improvements to the tool's input schema to provide clearer and faster feedback. Addressing these points will make the new feature more reliable and user-friendly.
- Remove try/catch blocks that swallow errors and return misleading defaults in getCTFBalance, isMarketResolved, getWinningIndexSets, isNegRiskAdapterApproved - Let errors propagate to main redeemPositions handler for accurate feedback - Add schema validation requiring tokenId and outcomeIndex when negRisk=true - Add default(false) to negRisk parameter Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Closes #39
Summary
redeem_positionstool to claim winnings from resolved Polymarket prediction marketsChanges
src/services/redemption.ts- New redemption service with:src/tools/redeem-positions.ts- New MCP tool with parameters:conditionId(required) - Market condition IDtokenId(optional) - Position token ID, required for negRisk marketsoutcomeIndex(optional) - 0 for Yes, 1 for NonegRisk(optional) - Boolean for negative risk marketsTest plan
pnpm run build🤖 Generated with Claude Code