Add bridge-then-deploy action provider#3
Conversation
Composes an Across bridge with a destination lending/vault supply so an agent can express "move this capital to chain X and put it to work" as one intent. Honest about the EOA constraint: Across destination execution only reaches a handler contract, never an EOA, so the flow is two-step and non-atomic (bridge -> poll status -> supply on arrival). Actions: - bridge_and_deploy: initiates the Across deposit and records the pending destination supply; never claims the supply has happened. - bridge_deploy_status: polls the Across deposit-status API and auto-runs the recorded supply once the bridge is filled. - deploy_on_destination: supplies an already-bridged token into Compound or Morpho on Base, with a balance preflight so it is safe to retry. Destination deploy is gated to Base; origin can be any EVM chain Across supports. Includes unit tests (mocked wallet + Across SDK), README documenting the non-atomic semantics, and a changeset. https://claude.ai/code/session_013rnmDYrKDMctusY33uneiy
|
@claude start review |
|
Claude finished @zaryab2000's task in 2m 59s —— View job Code Review —
|
| Rule | Status |
|---|---|
All actions return Promise<string>; errors returned not thrown |
✅ |
Zod v4 schemas with .describe() on every field; no .strip() |
✅ |
supportsNetwork is an arrow-function property |
✅ |
Factory bridgeDeployActionProvider exported and re-exported from index.ts |
✅ |
README.md present |
✅ |
pnpm run changeset — patch, past tense, correct package |
✅ |
| Tests present and mocking wallet provider | ✅ |
super("bridgeDeploy", []) constructor call |
✅ |
Network.chainId compared as string |
✅ |
Summary: The implementation is clean and well-documented. The two blocking issues before upstream merge are the Compound supplyTo vs supply recipient bug (#2) and the in-memory state loss documentation (#1). The URL encoding (#4) and slippage arithmetic (coinbase#6) are simple one-liners to fix. The missing test coverage (#5) should be added before the PR goes out.
- Compound: use supplyTo(dst, asset, amount) so the position is credited to the recipient instead of msg.sender (silent divergence from Morpho). - Auto-deploy: supply the amount that actually landed when a fill comes in under the quoted output, instead of failing the stale-quote preflight; deploy_on_destination stays strict for explicit calls. - getDepositStatus: build the status URL with URLSearchParams. - Slippage check now uses bigint arithmetic to avoid float rounding. - Document the in-memory pending-deploy state (lost on re-instantiation) in the README and on the field; clarify token is an address (not symbol) for deploy_on_destination. - Add tests for the filled-without-pending-record and supply-fails-retry paths. https://claude.ai/code/session_013rnmDYrKDMctusY33uneiy
|
Thanks for the review — addressed in Fixed
Intentionally deferred (with rationale)
Generated by Claude Code |
Summary
Adds a new bridge-then-deploy ActionProvider (
bridgeDeploy) that composes an Across bridge with a destination lending/vault supply, letting an agent express "move this capital to chain X and put it to work" as a single intent.Central design constraint (honest by design)
Across destination-side execution only delivers to a deployed handler contract that implements
handleV3AcrossMessage(...)— never to a plain EOA. Agent wallets are EOAs, so this flow is deliberately two-step and non-atomic: bridge → poll status → supply on arrival. The provider never claims the supply has happened before the bridge fills.Actions
bridge_and_deploy— initiates the Across deposit and records the pending destination supply; returns adepositIdandstatus: "bridging". Does not supply yet.bridge_deploy_status— polls the Across deposit-status API; oncefilled, auto-runs the recorded destination supply and returns the deploy tx hash. Reportspending/refundedotherwise.deploy_on_destination— supplies an already-bridged token into Compound (Cometsupply) or Morpho (vaultdeposit) on Base. Performs a balance preflight, so it is safe to retry to recover from a partial failure.Scope
8453/84532); origin can be any EVM chain Across supports.Conventions
Promise<string>; errors are returned, not thrown..describe()on every field; no.strip().approveutil and mirrors the in-treeacrossprovider's SDK wiring (privateKeyconstructor config, fully mocked in tests).src/action-providers/index.ts.Checks
pnpm test— full agentkit suite green (875 tests, incl. 11 new for this provider, mocked wallet + Across SDK).pnpm run lint,pnpm run format,pnpm build— all clean.@coinbase/agentkit, patch, past tense).https://claude.ai/code/session_013rnmDYrKDMctusY33uneiy
Generated by Claude Code