Track — Chainlink: Best workflow with CRE
Prize: $1.5k. Owner: snehendu098 (#31). Vault receiver: #29. (CCIP prize $3.5k is separate — not targeted. Check if one Chainlink pick covers both.)
Use in our stack
CRE workflow = the rebalancer brain. Decides when vault goes HEDGED ⇄ FLAT.
Flow
- Trigger: cron (1h prod, ~5 min demo).
- Read (external data): HTTP call → Arkiv
arkiv_queryforFundingRateentries per market in window.- Fallback: our gateway REST
/funding. - Optional: CEX funding (e.g. Binance) as sanity benchmark.
- Fallback: our gateway REST
- Decide:
- Per market (BTC, ETH, HYPE, ZEC).
- HEDGED + every funding print in last 3h < 0 → FLAT.
- FLAT + latest funding > 0 → HEDGED.
- Window configurable (short for demo).
- Else no-op.
- Write (blockchain): EVM write → vault
onReport(report)→setMode(market, mode, reasonRef)→ emitsModeChanged. - Execute:
vault-keeperseesModeChanged→ runs legs:- Exit: close perp short first, then sell spot via v4 pool (avoid naked short).
- Enter: buy spot first, then open short.
Why split: CRE can't sign our offchain CLOB orders. CRE = decision + onchain trigger. Keeper = execution.
Contract side
- Vault implements CRE receiver (
onReport), only accepts calls from Chainlink Forwarder. setModeguarded: only viaonReport. Cooldown to prevent flapping.reasonRef= Arkiv entity keys of funding entries used → links decision to public evidence.
Build steps
- Install CRE CLI, start from CRE template (TS or Go).
- Workflow: cron → HTTP (Arkiv query) → decide → EVM write.
- Vault receiver contract + test.
cre workflow simulate→ show in demo. Deploy optional.
Qualification checklist
- CRE workflow used as orchestration layer in project.
- Integrates ≥1 blockchain with external API/system/data source (Arkiv/gateway funding → vault).
- Successful simulation via CRE CLI (or live deploy).
- Meaningfully used (it is the rebalancer).
Links
- CRE docs: https://docs.chain.link/cre
- Intro videos: https://www.youtube.com/playlist?list=PLVP9aGDn-X0S-JmwQKGTao6o_CMitvv2_
- Templates: https://github.com/smartcontractkit/cre-templates/