From d2ee85dd96fe7b0de0040702f327976c9858c63d Mon Sep 17 00:00:00 2001 From: James Lawton Date: Mon, 27 Apr 2026 18:13:12 +0100 Subject: [PATCH 1/3] docs(polygon-defi): add proactive session prerequisites for DeFi contracts When the polygon-defi skill is invoked, the agent now knows to ensure the wallet session was created with the CLI (which auto-whitelists USDC, Aave V3 Pool, and Morpho vault contracts). Previously the skill only told the agent to fix a missing contract after a 400 rejection. --- skills/SKILL.md | 2 +- skills/polygon-defi/SKILL.md | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/skills/SKILL.md b/skills/SKILL.md index 77e515f..dddb00a 100644 --- a/skills/SKILL.md +++ b/skills/SKILL.md @@ -141,7 +141,7 @@ polygon-agent agent feedback --agent-id --value [--tag1 ] [--tag - **`balances --chains`** — comma-separated chains (max 20); two or more return JSON with `multiChain: true` and a `chains` array (same wallet address on each) - **Fee preference** — auto-selects USDC over native POL when both available - **`fund`** — returns `https://wallet.polygon.technology` as the `fundingUrl`. Always run `polygon-agent fund` to get the URL and wallet address — never hardcode or construct manually. -- **`deposit`** — picks highest-TVL pool via Trails `getEarnPools` and deposits directly. If the session rejects the call, re-create the wallet with `--contract --contract ` (the dry-run output shows both addresses). Full deposit reference: https://agentconnect.polygon.technology/polygon-defi/SKILL.md +- **`deposit`** — picks highest-TVL pool via Trails `getEarnPools` and deposits directly. `wallet create` auto-whitelists USDC, Aave V3 Pool (`0x794a61358d6845594f94dc1db02a252b5b4814ad`), and all standard DeFi contracts — if the user has an older session, re-run `wallet create --usdc-limit 5` before depositing. Full deposit reference: https://agentconnect.polygon.technology/polygon-defi/SKILL.md - **`withdraw`** — `--position` = aToken or ERC-4626 vault; `--amount` = `max` or underlying units (Aave / vault). Dry-run JSON includes `poolAddress` / `vault`. Broadcast needs session on the **same chain** as `--chain`, with pool/vault + underlying token whitelisted where the relayer touches them - **`x402-pay`** — probes endpoint for 402, smart wallet funds builder EOA with exact token amount, EOA signs EIP-3009 payment. Chain auto-detected from 402 response - **`send-native --direct`** — bypasses ValueForwarder contract for direct EOA transfer diff --git a/skills/polygon-defi/SKILL.md b/skills/polygon-defi/SKILL.md index 3aee20f..ad02c53 100644 --- a/skills/polygon-defi/SKILL.md +++ b/skills/polygon-defi/SKILL.md @@ -5,6 +5,27 @@ description: DeFi operations on Polygon using the Polygon Agent CLI. Covers same # Polygon DeFi Skill +## Session Prerequisites + +**Before any DeFi operation, the wallet session must include the token contracts and pool contracts.** `polygon-agent wallet create` auto-whitelists all required contracts. If the user has not yet created a session, or has an older session that predates this list, run: + +```bash +polygon-agent wallet create --usdc-limit 5 +``` + +This automatically includes: +- USDC (native): `0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359` +- USDT: `0xc2132D05D31c914a87C6611C10748AEb04B58e8F` +- WETH: `0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619` +- Aave V3 Pool (all markets): `0x794a61358d6845594f94dc1db02a252b5b4814ad` +- Morpho Compound USDC: `0x781fb7f6d845e3be129289833b04d43aa8558c42` +- Morpho Compound WETH: `0xf5c81d25ee174d83f1fd202ca94ae6070d073ccf` +- Morpho Compound POL: `0x3f33f9f7e2d7cfbcbdf8ea8b870a6e3d449664c2` + +If the user already has a session but deposit/swap calls are rejected with a permission error, re-create the session with the above command to pick up all current contracts. + +--- + ## Swap Tokens (Same-Chain) ```bash From 49caffbd5447d9198f23e88db567484446167040 Mon Sep 17 00:00:00 2001 From: James Lawton Date: Mon, 27 Apr 2026 18:13:49 +0100 Subject: [PATCH 2/3] chore(connector-ui): trigger rebuild --- packages/connector-ui/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/connector-ui/package.json b/packages/connector-ui/package.json index 32b4a47..a124c17 100644 --- a/packages/connector-ui/package.json +++ b/packages/connector-ui/package.json @@ -1,7 +1,7 @@ { "name": "@polygonlabs/agent-connector-ui", "private": true, - "version": "1.6.4", + "version": "1.6.5", "type": "module", "description": "Wallet connector UI for Polygon Agent Kit - creates secure encrypted wallet sessions", "repository": { From 0b3057a66bd09baef2083cbaa156373f3319ce97 Mon Sep 17 00:00:00 2001 From: James Lawton Date: Mon, 27 Apr 2026 18:15:51 +0100 Subject: [PATCH 3/3] docs(skill): one-pass session setup for DeFi intent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tell the agent to include all DeFi contracts in the initial wallet create when the user's goal involves deposit, yield, swap, Aave, or Morpho — so the user approves once instead of going through a second auth round-trip when the deposit is later attempted. --- skills/SKILL.md | 12 +++++++++++- skills/polygon-defi/SKILL.md | 11 +++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/skills/SKILL.md b/skills/SKILL.md index dddb00a..9e3a60c 100644 --- a/skills/SKILL.md +++ b/skills/SKILL.md @@ -59,7 +59,16 @@ polygon-agent setup --name "MyAgent" # → all subsequent commands auto-load the access key from disk — no export needed # Step 2: Create ecosystem wallet (opens browser, waits for 6-digit code) -polygon-agent wallet create --usdc-limit 100 --native-limit 5 +# If the user's goal involves DeFi (deposit, yield, swap, Aave, Morpho), include all DeFi +# contracts now so the user only approves once — not again when the deposit is attempted. +polygon-agent wallet create --usdc-limit 100 --native-limit 5 \ + --contract 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359 \ + --contract 0xc2132D05D31c914a87C6611C10748AEb04B58e8F \ + --contract 0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619 \ + --contract 0x794a61358d6845594f94dc1db02a252b5b4814ad \ + --contract 0x781fb7f6d845e3be129289833b04d43aa8558c42 \ + --contract 0xf5c81d25ee174d83f1fd202ca94ae6070d073ccf \ + --contract 0x3f33f9f7e2d7cfbcbdf8ea8b870a6e3d449664c2 # → opens https://agentconnect.polygon.technology/link?rid=&... # → user approves in browser, browser shows a 6-digit code # → enter the 6-digit code in the terminal when prompted @@ -147,6 +156,7 @@ polygon-agent agent feedback --agent-id --value [--tag1 ] [--tag - **`send-native --direct`** — bypasses ValueForwarder contract for direct EOA transfer - **Session permissions** — without `--usdc-limit` etc., session gets bare-bones defaults and may not transact - **Session expiry** — 6 months from creation +- **One-pass session setup** — if the user's intent involves DeFi (deposit, yield, swap, Aave, Morpho), include all required DeFi contracts in the initial `wallet create` call. Never create a bare session and then ask the user to re-approve when a deposit is later attempted. See the Complete Setup Flow above for the full contract list. ## Wallet Creation Flow (v2 Relay) diff --git a/skills/polygon-defi/SKILL.md b/skills/polygon-defi/SKILL.md index ad02c53..e12b5b4 100644 --- a/skills/polygon-defi/SKILL.md +++ b/skills/polygon-defi/SKILL.md @@ -7,10 +7,17 @@ description: DeFi operations on Polygon using the Polygon Agent CLI. Covers same ## Session Prerequisites -**Before any DeFi operation, the wallet session must include the token contracts and pool contracts.** `polygon-agent wallet create` auto-whitelists all required contracts. If the user has not yet created a session, or has an older session that predates this list, run: +**Before any DeFi operation, the wallet session must include the token contracts and pool contracts.** If the user does not yet have a session, or has an older session that predates this list, create one now — do not wait until a deposit fails: ```bash -polygon-agent wallet create --usdc-limit 5 +polygon-agent wallet create --usdc-limit 5 \ + --contract 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359 \ + --contract 0xc2132D05D31c914a87C6611C10748AEb04B58e8F \ + --contract 0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619 \ + --contract 0x794a61358d6845594f94dc1db02a252b5b4814ad \ + --contract 0x781fb7f6d845e3be129289833b04d43aa8558c42 \ + --contract 0xf5c81d25ee174d83f1fd202ca94ae6070d073ccf \ + --contract 0x3f33f9f7e2d7cfbcbdf8ea8b870a6e3d449664c2 ``` This automatically includes: