You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/connector-ui/public/SKILL.md
+7-2Lines changed: 7 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
name: Polygon Agent
3
-
description: "Complete Polygon agent toolkit for on-chain operations on Polygon. Use this skill whenever helping an agent set up a wallet, check balances, send or swap tokens, bridge assets, deposit to earn yield, register on-chain identity, submit or query reputation/feedback, or make x402 micropayments. Covers the full lifecycle: Sequence smart contract wallets, Trails DeFi actions, ERC-8004 identity + reputation, x402 payments. Single CLI entry point (`polygon-agent`), AES-256-GCM encrypted storage."
3
+
description: "Complete Polygon agent toolkit for on-chain operations on Polygon. Use this skill whenever helping an agent set up a wallet, check balances, send or swap tokens, bridge assets, deposit or withdraw from yield (Aave aTokens, ERC-4626 vaults), register on-chain identity, submit or query reputation/feedback, or make x402 micropayments. Covers the full lifecycle: Sequence smart contract wallets, Trails DeFi actions, ERC-8004 identity + reputation, x402 payments. Single CLI entry point (`polygon-agent`), AES-256-GCM encrypted storage."
-**Fee preference** — auto-selects USDC over native POL when both available
132
133
-**`fund`** — reads `walletAddress` from the wallet session and sets it as `toAddress` in the Trails widget URL. Always run `polygon-agent fund` to get the correct URL — never construct it manually or hardcode any address.
133
134
-**`deposit`** — picks highest-TVL pool via Trails `getEarnPools`. If session rejects (contract not whitelisted), re-create wallet with `--contract <depositAddress>`
135
+
-**`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
134
136
-**`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
135
137
-**`send-native --direct`** — bypasses ValueForwarder contract for direct EOA transfer
136
138
-**Session permissions** — without `--usdc-limit` etc., session gets bare-bones defaults and may not transact
@@ -163,6 +165,7 @@ CLI commands output JSON (non-TTY). After running a command, always render the r
163
165
|`send` / `send-token` / `send-native`| One-liner summary: amount, symbol, recipient. If broadcast, show tx hash as a code span and explorer URL as a link. |
164
166
|`swap`| Summary: `X FROM → Y TO` with chain. If broadcast, show deposit tx hash + explorer link. |
165
167
|`deposit`| Summary: amount, asset, protocol, pool address. If broadcast, show tx hash + explorer link. |
168
+
|`withdraw`| Summary: `kind` (aave / erc4626), position, amount, pool or vault. If broadcast, show tx hash + explorer link. |
166
169
|`fund`| Show the `fundingUrl` as a clickable link with a brief instruction to open it. |
167
170
|`wallet create` / `wallet list`| Wallet name, truncated address, chain in a small table or bullet list. |
168
171
|`agent register`| Show agent name and tx hash as a code span with Polygonscan link. Remind user to retrieve `agentId` from the Registered event on the Logs tab. |
@@ -183,7 +186,7 @@ For specific workflows, fetch and load the relevant sub-skill:
|`Relay request not found`| Session expired or already used — re-run `wallet create` (or `wallet create --print-url`) |
203
206
| Deposit session rejected | Re-create wallet with `--contract <depositAddress>`|
207
+
|`withdraw` / broadcast: wrong chain or session rejects | Use `wallet create --chain <same as --chain>` and `--contract` for pool/vault + underlying ERC-20 on that chain; omit tight `--usdc-limit` if it blocks fee transfers |
208
+
|`Stored explicit session is missing pk`| Re-link: `wallet import --code …` after `wallet create`|
204
209
| Wrong recipient in Trails widget | Run `polygon-agent fund` (do not construct the URL manually) |
205
210
|`x402-pay`: no 402 response | Endpoint doesn't require x402 payment, or URL is wrong |
206
211
|`x402-pay`: payment token mismatch | Chain/token in the 402 response differs from wallet — check `--wallet` points to the right chain |
Copy file name to clipboardExpand all lines: packages/connector-ui/public/skills/SKILL.md
+7-2Lines changed: 7 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
name: Polygon Agent
3
-
description: "Complete Polygon agent toolkit for on-chain operations on Polygon. Use this skill whenever helping an agent set up a wallet, check balances, send or swap tokens, bridge assets, deposit to earn yield, register on-chain identity, submit or query reputation/feedback, or make x402 micropayments. Covers the full lifecycle: Sequence smart contract wallets, Trails DeFi actions, ERC-8004 identity + reputation, x402 payments. Single CLI entry point (`polygon-agent`), AES-256-GCM encrypted storage."
3
+
description: "Complete Polygon agent toolkit for on-chain operations on Polygon. Use this skill whenever helping an agent set up a wallet, check balances, send or swap tokens, bridge assets, deposit or withdraw from yield (Aave aTokens, ERC-4626 vaults), register on-chain identity, submit or query reputation/feedback, or make x402 micropayments. Covers the full lifecycle: Sequence smart contract wallets, Trails DeFi actions, ERC-8004 identity + reputation, x402 payments. Single CLI entry point (`polygon-agent`), AES-256-GCM encrypted storage."
-**Fee preference** — auto-selects USDC over native POL when both available
132
133
-**`fund`** — reads `walletAddress` from the wallet session and sets it as `toAddress` in the Trails widget URL. Always run `polygon-agent fund` to get the correct URL — never construct it manually or hardcode any address.
133
134
-**`deposit`** — picks highest-TVL pool via Trails `getEarnPools`. If session rejects (contract not whitelisted), re-create wallet with `--contract <depositAddress>`
135
+
-**`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
134
136
-**`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
135
137
-**`send-native --direct`** — bypasses ValueForwarder contract for direct EOA transfer
136
138
-**Session permissions** — without `--usdc-limit` etc., session gets bare-bones defaults and may not transact
@@ -163,6 +165,7 @@ CLI commands output JSON (non-TTY). After running a command, always render the r
163
165
|`send` / `send-token` / `send-native`| One-liner summary: amount, symbol, recipient. If broadcast, show tx hash as a code span and explorer URL as a link. |
164
166
|`swap`| Summary: `X FROM → Y TO` with chain. If broadcast, show deposit tx hash + explorer link. |
165
167
|`deposit`| Summary: amount, asset, protocol, pool address. If broadcast, show tx hash + explorer link. |
168
+
|`withdraw`| Summary: `kind` (aave / erc4626), position, amount, pool or vault. If broadcast, show tx hash + explorer link. |
166
169
|`fund`| Show the `fundingUrl` as a clickable link with a brief instruction to open it. |
167
170
|`wallet create` / `wallet list`| Wallet name, truncated address, chain in a small table or bullet list. |
168
171
|`agent register`| Show agent name and tx hash as a code span with Polygonscan link. Remind user to retrieve `agentId` from the Registered event on the Logs tab. |
@@ -183,7 +186,7 @@ For specific workflows, fetch and load the relevant sub-skill:
|`Relay request not found`| Session expired or already used — re-run `wallet create` (or `wallet create --print-url`) |
203
206
| Deposit session rejected | Re-create wallet with `--contract <depositAddress>`|
207
+
|`withdraw` / broadcast: wrong chain or session rejects | Use `wallet create --chain <same as --chain>` and `--contract` for pool/vault + underlying ERC-20 on that chain; omit tight `--usdc-limit` if it blocks fee transfers |
208
+
|`Stored explicit session is missing pk`| Re-link: `wallet import --code …` after `wallet create`|
204
209
| Wrong recipient in Trails widget | Run `polygon-agent fund` (do not construct the URL manually) |
205
210
|`x402-pay`: no 402 response | Endpoint doesn't require x402 payment, or URL is wrong |
206
211
|`x402-pay`: payment token mismatch | Chain/token in the 402 response differs from wallet — check `--wallet` points to the right chain |
Vault/pool addresses are resolved dynamically from Trails — they are not hardcoded. The dry-run output includes `depositAddress` so you can inspect the exact contract before broadcasting.
131
131
132
+
## Withdraw (Aave aToken or ERC-4626 vault)
133
+
134
+
Pass the **position token** you hold: an **Aave aToken** address, or a **Morpho / ERC-4626 vault** (share) address. The CLI resolves the Aave **Pool** via `POOL()` on the aToken, or uses `redeem` on the vault. Dry-run by default.
135
+
136
+
```bash
137
+
# Full exit from an Aave position (aToken from balances output)
138
+
polygon-agent withdraw --position 0x68215b6533c47ff9f7125ac95adf00fe4a62f79e --amount max --chain mainnet
139
+
140
+
# Partial Aave withdraw (underlying units, e.g. USDC)
# ERC-4626: max redeems all shares; partial amount is underlying units (convertToShares)
144
+
polygon-agent withdraw --position <vault> --amount max --chain polygon --broadcast
145
+
```
146
+
147
+
Whitelist the **pool** (Aave) or **vault** contract on the session if the wallet rejects the call (`polygon-agent wallet create --contract <poolOrVault>`).
148
+
149
+
**Same chain as the transaction:** if you use `withdraw --chain mainnet`, create or refresh the session with **`wallet create --chain mainnet`** (not only Polygon defaults). Include **`--contract`** for the **pool** and for the **underlying ERC-20** on that chain (e.g. mainnet USDC `0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`) so fee / helper transfers are allowed. Tight **`--usdc-limit`** can block those — omit or relax for yield exits.
150
+
132
151
### Session Whitelisting
133
152
134
153
If the deposit is rejected with a session permission error, the pool's contract address needs to be whitelisted when creating the wallet session:
**`withdraw`** exits **Aave v3** positions using your **aToken** address (`POOL()` + `UNDERLYING_ASSET_ADDRESS()` → `Pool.withdraw`), or **ERC-4626** vaults (e.g. Morpho) via `redeem`. Dry-run prints `poolAddress` / `vault` and calldata.
187
+
188
+
For **`--broadcast`**, the session must allow the **pool or vault** and (on that chain) **fee / underlying ERC-20** touches — use `wallet create --chain <same-as-tx> --contract <pool> --contract <underlying-USDC-or-asset>`. If your default session is Polygon but you transact on **mainnet**, create or extend a **mainnet** session for that chain.
0 commit comments