Skip to content

fix agentTokenV3._autoswap() uniswap invalidTo error#154

Closed
koo-virtuals wants to merge 2 commits intomainfrom
fix/uniswap-invalid-to
Closed

fix agentTokenV3._autoswap() uniswap invalidTo error#154
koo-virtuals wants to merge 2 commits intomainfrom
fix/uniswap-invalid-to

Conversation

@koo-virtuals
Copy link
Copy Markdown
Contributor

@koo-virtuals koo-virtuals commented Apr 11, 2026

Note

Medium Risk
Changes the on-chain tax autoswap path for AgentTokenV3 by introducing a new adapter contract and additional approvals/external calls; misconfiguration (unset adapter) or integration issues with routers/tax recipients could block autoswaps or leave funds temporarily held on the adapter.

Overview
Fixes AgentTokenV3 autoswap failures caused by Uniswap V2 pair INVALID_TO by routing tax swaps through a new upgradeable TaxAccountingAdapter that receives swap output and then calls depositTax on the tax recipient.

AgentTokenV3._swapTax now requires taxAccountingAdapter to be set, delegates swap+deposit to the adapter (with allowance reset), and factors the pending-tax accounting into a helper. The Uniswap router mock was enhanced to actually move tokens for swapExactTokensForTokensSupportingFeeOnTransferTokens, and tests were refactored/extended with a shared fixture plus a new E2E suite covering adapter-based autoswap + depositTax attribution.

Reviewed by Cursor Bugbot for commit 26f8632. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 69f1890. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant