Repository navigation
feat: add Agent Data APIs action provider (x402-paid token risk, counterparty and sanctions checks) - #1657
Open
dagu3371 wants to merge 2 commits into
Open
feat: add Agent Data APIs action provider (x402-paid token risk, counterparty and sanctions checks)#1657dagu3371 wants to merge 2 commits into
dagu3371 wants to merge 2 commits into
Conversation
Adds x402-paid pre-trade and pre-payment safety checks: check_token_risk, check_payment_counterparty and screen_sanctions.
🟡 Heimdall Review Status
|
The token check now simulates on the deepest ETH/WETH pool across Uniswap V2, V3 and V4 plus Aerodrome (Base), detects V4 hooks that confiscate sells, and reports round-trip cost.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds an
agentDataApisActionProviderwith three safety checks that agents can call before they trade or pay. Each check is paid per call with x402 (USDC on Base) from the agent's own wallet, so no API key or account is needed.check_token_riskavoid/caution/ok; buy/sell tax and round-trip cost from a simulated buy then sell on the token's deepest ETH/WETH pool (Uniswap V2, V3 and V4 plus Aerodrome on Base; Uniswap V2, V3 and V4 on Ethereum), catching honeypots including V4 hooks that confiscate sells; owner powers (mint, pause, blacklist, fee changes, trading switch); upgradeable proxy; liquidity; sanctioned owner; EIP-191 signed receiptcheck_payment_counterpartypayToaddressesblock/review/clear; sanctioned crypto address match (OFAC, UK, EU lists); x402 seller reputation; live on-chain facts; optional name screening; signed receiptscreen_sanctionsSafety
PAYMENT-REQUIREDchallenge and refuses to pay if it exceedsmaxPaymentUsdc(default 0.05 USDC, orAGENT_DATA_APIS_MAX_PAYMENT_USDC) or if no USDC-on-Base option is offered.@x402/fetch+registerExactEvmSchemepattern as the existing x402 action provider.supportsNetworkis limited tobase-mainnet, since payment is in USDC on Base.Update: the token check now simulates on the deepest pool across Uniswap V2/V3/V4 and Aerodrome (previously Uniswap V2 only). README and action description updated accordingly; provider code and tests are unchanged.
Tests
Unit tests in
agentDataApisActionProvider.test.ts(6/6 passing): network support, paid success path, spending-limit refusal, refusal when no USDC-on-Base option is offered, parameter passing, network-error handling.eslint,prettier --checkandtscpass for the changed files.Manual end-to-end test calling the provider directly (not through an example chatbot/LLM):
Happy to run it through one of the example chatbots and add the transcript if that would help review.
Checklist