Skip to content

Bring TWAP/JIT-funding scripts + cow-sdk 9.2.2 upgrade to main#17

Merged
anxolin merged 9 commits into
mainfrom
integrate/twap-jit-sdk9
Jul 23, 2026
Merged

Bring TWAP/JIT-funding scripts + cow-sdk 9.2.2 upgrade to main#17
anxolin merged 9 commits into
mainfrom
integrate/twap-jit-sdk9

Conversation

@anxolin

@anxolin anxolin commented Jul 23, 2026

Copy link
Copy Markdown
Owner

What

Lands the stacked TWAP / JIT-funding work and the SDK upgrade onto main. These reached main only partially before: PR #12 was squash-merged directly to main, while PR #14 (JIT-funded TWAP) and the cow-sdk 9.2.2 upgrade were stacked on post-twap-from-eoa / upgrade-cow-sdk-9 and never propagated.

Merges upgrade-cow-sdk-9 (the superset) into main. Brings:

  • src/scripts/composable-cow/postTwapForEOAWithJitFunds.ts (the missing JIT script)
  • src/scripts/composable-cow/postTwapForEOA.ts updates + cowShed.ts helper
  • src/contracts/composable-cow-poller/
  • @cowprotocol/cow-sdk 6.0.0-RC.42 → 9.2.2 (package.json + yarn.lock), which also fixes the earlier package.json-vs-installed mismatch
  • gnosis token constants

main-only content (e.g. collateralSwapAave.ts from #12) is preserved.

Conflict resolution

The divergence came from main having a squashed #12 vs the branch's unsquashed history. Resolved by taking the branch (9.2.2) versions of package.json / yarn.lock / postTwapForEOA.ts, and unioning src/index.ts (keeps all imports; postTwapForEOAWithJitFunds is the active JOBS entry).

Test plan

yarn install   # picks up cow-sdk 9.2.2 + patch-package postinstall
# .env: PRIVATE_KEY, RPC_URL_100
yarn dev        # runs the active JOBS entry (postTwapForEOAWithJitFunds)

Note: src/scripts/flash-loans/collateralSwapAave.ts still has pre-existing type errors (unrelated to this merge; part of the collateral-swap work).

anxolin and others added 9 commits September 10, 2025 16:42
Follow-up to the TWAP-from-EOA PoC. Instead of moving the full TWAP sell
amount into cow-shed up front, each part is pulled just-in-time from the EOA
via the ComposableCowPoller contract, so capital stays in the user's wallet
between parts.

- New postTwapForEOAWithJitFunds script: a 1-wei sell=buy order carries a
  gasless post-hook that approves the Vault Relayer and creates the TWAP on
  cow-shed; the EOA approves the poller for the full sell amount and registers
  the JIT funding schedule. The watch-tower then pulls each part on demand.
- Add a minimal ComposableCowPoller contract helper and its Gnosis address.
v9 is a modular re-architecture. Migrate the composable-cow TWAP-from-EOA
scripts to it:

- cow-sdk 9.2.2; add sdk-composable (Twap), sdk-cow-shed (CowShedSdk) and
  sdk-ethers-v5-adapter, which were split out of the main package.
- Set a global provider adapter (EthersV5Adapter) — v9 reads it via
  getGlobalAdapter() for ABI encoding, and TradingSdk/CowShedSdk take it too.
- TwapData amounts are now native bigint (were ethers BigNumber).
- Add runtime peer deps: ajv, cross-fetch, multiformats, @openzeppelin/merkle-tree.
- Drop the obsolete 6.0.0-RC.42 patch (its changes ship in v9).
…e/twap-jit-sdk9

# Conflicts:
#	package.json
#	src/index.ts
#	src/scripts/composable-cow/postTwapForEOA.ts
#	yarn.lock
@anxolin
anxolin merged commit 69b7088 into main Jul 23, 2026
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