Context
resolver currently decodes two protocols: Across (src/intents/across.rs, landed in PR #3) and UniswapX (src/intents/uniswapx.rs). The Protocol enum in src/intents/types.rs already lists CowProtocol as a variant, but there is no decoder implementation. CoW Protocol's GPv2 orders (https://docs.cow.fi) are the third major intent source and need the same IntentDecoder shape as the other two so the solver engine can ingest them uniformly.
Scope
- Create
src/intents/cow.rs implementing IntentDecoder for CoW:
CowDecoder::new(chain: Chain) constructor.
fetch_open_intents — hits the CoW API (https://api.cow.fi/mainnet/api/v1/auction for mainnet; the CoW orderbook API endpoint list is in their docs).
decode(raw: &[u8]) — initially return ResolverError::Intent("raw CoW decoding not yet implemented") (mirroring UniswapXDecoder).
protocol() returns "CoW".
- Parse the CoW auction JSON into
Intent (token in/out, amount in, minBuy as min_amount_out, deadline from validTo, receiver → recipient).
- Re-export
CowDecoder from src/intents/mod.rs.
- Add at least 2 unit tests using a golden CoW auction JSON fixture (save as
tests/fixtures/cow_auction.json) — offline, no network.
Acceptance criteria
cargo test green including new tests.
cargo clippy --all-targets -- -D warnings clean.
- Fixtures committed, not fetched at test time.
- Protocol enum usage: a decoded
Intent has protocol == Protocol::CowProtocol.
Reference: src/intents/uniswapx.rs for the full shape (API parse → Intent); src/intents/across.rs (PR #3) for how offline-parse unit tests are structured.
Estimated effort
S (3–5 hours)
— kcolbchain / Abhishek Krishna
Context
resolvercurrently decodes two protocols: Across (src/intents/across.rs, landed in PR #3) and UniswapX (src/intents/uniswapx.rs). TheProtocolenum insrc/intents/types.rsalready listsCowProtocolas a variant, but there is no decoder implementation. CoW Protocol's GPv2 orders (https://docs.cow.fi) are the third major intent source and need the sameIntentDecodershape as the other two so the solver engine can ingest them uniformly.Scope
src/intents/cow.rsimplementingIntentDecoderfor CoW:CowDecoder::new(chain: Chain)constructor.fetch_open_intents— hits the CoW API (https://api.cow.fi/mainnet/api/v1/auctionfor mainnet; the CoW orderbook API endpoint list is in their docs).decode(raw: &[u8])— initially returnResolverError::Intent("raw CoW decoding not yet implemented")(mirroringUniswapXDecoder).protocol()returns"CoW".Intent(token in/out, amount in, minBuy asmin_amount_out, deadline fromvalidTo,receiver→recipient).CowDecoderfromsrc/intents/mod.rs.tests/fixtures/cow_auction.json) — offline, no network.Acceptance criteria
cargo testgreen including new tests.cargo clippy --all-targets -- -D warningsclean.Intenthasprotocol == Protocol::CowProtocol.Reference:
src/intents/uniswapx.rsfor the full shape (API parse →Intent);src/intents/across.rs(PR #3) for how offline-parse unit tests are structured.Estimated effort
S (3–5 hours)
— kcolbchain / Abhishek Krishna