Skip to main content

Onchain interest rate, funding rate and volatility feeds

What it is

Onchain rate and volatility feeds publish benchmarks such as lending rates, perpetual funding rates and asset volatility to smart contracts, so lending and derivatives protocols can settle against a value everyone can read.

Oracle networks, index providers and DeFi protocols run them because a contract can only use data that’s been written onchain, and a wrong or stale value moves money.

Goldsky streams the onchain rate updates to a scheduled task that also fetches your offchain inputs, applies your methodology and writes the result to each chain, recording every input it used; the methodology and the contracts that consume the feed stay with you.

Who it’s for

Oracle networks, index and benchmark providers, and lending and perpetuals protocols that publish their own reference rates.

How an onchain rate or volatility feed gets published

The diagram follows one update from the rate changes on lending and perpetuals markets to the contracts that settle against the published benchmark. Your setup may differ.

Goldsky, step 2: TurboStream rate updatesDecoded into the task’s database
Blockchains, step 1: Markets moveBorrow rates and funding update onchain
Your business, step 4: Calculate the benchmarkYour methodology, run in the task
Goldsky, step 3: ComposeGather inputs on a scheduleOnchain rows plus your offchain sources
Goldsky, step 5: ComposePublish the benchmarkYour methodology’s value, written to each chain
Blockchains, step 6: Contracts read itLending and perps protocols settle against it
  • Goldsky

How to publish rate and volatility feeds onchain

A pipeline delivers onchain rate updates to a TypeScript task that Goldsky hosts, and the task runs on a schedule to fetch your offchain inputs, apply your methodology and write the benchmark to a contract on each chain. Every input and transaction is recorded with the run that used it.

What you’ll need

  • Goldsky Compose
  • Goldsky Turbo
  • A written methodology for the benchmark
  • Offchain data sources reachable over HTTPS
  • A feed contract deployed on each chain you publish to
  • Funds for transaction fees, or a sponsored wallet
  1. Let the markets move

    Lending rates and perpetual funding rates change onchain whenever traders and borrowers act.

    Lending markets emit an event each time their borrow or supply rate updates, and perpetuals exchanges emit one when funding is settled. These events are the onchain inputs to your benchmark.

  2. Stream the rate updates to your task

    Handled by Goldsky Compose

    Your methodology needs the latest onchain rates on hand when it runs.

    Each rate update has to be decoded and stored where the task can read it, with its block number. If updates are missed, the benchmark is worked out from stale rates.

    A Compose task can declare its own Turbo Pipelines pipeline as an onchain trigger: a compose_task sink delivers each decoded rate update to the task, which stores it in the app’s database with ctx.db.

    Trigger a task from a pipeline (opens in a new tab)
  3. Gather every input on a schedule

    Handled by Goldsky Compose

    A benchmark is published at a set rhythm, so each run collects all of its inputs at once.

    The run reads the stored onchain rates and fetches offchain inputs such as exchange prices or option quotes. Every input has to be kept with the run that used it, so anyone can check later how a published value was reached.

    Goldsky Compose runs the task on a cron trigger, and each ctx.fetch call, with its URL and response, is recorded on the run, so the inputs behind every value can be audited afterwards.

    Make auditable HTTP requests (opens in a new tab)
  4. Calculate the benchmark

    Your methodology turns the inputs into one number, such as an average rate or a volatility index.

    The calculation is code you write and own, including what happens when an input is missing or looks wrong. A run that publishes anyway with bad inputs can move money on every protocol that reads the feed, so decide in advance when to skip.

  5. Publish the benchmark to each chain

    Handled by Goldsky Compose

    Contracts can only read values written onchain, so the benchmark is sent to a feed contract on every chain that uses it.

    Each write is a signed transaction that has to confirm, and one chain failing shouldn’t block the others. A write undone by a reorg has to be sent again, or contracts on that chain read an older value.

    With Goldsky Compose, the task writes to each chain’s contract from a managed wallet and waits for the confirmations you set, resending if a reorg drops the transaction.

    Wait for confirmations and reorgs (opens in a new tab)
  6. Let contracts read the feed

    Lending and perpetuals protocols read the latest value when they settle interest, funding or liquidations.

    The feed contract exposes the value and the time it was updated. Consumers should check that time and refuse a value older than they accept, because a stale rate settles positions at the wrong price.

What you control

Your team
  • Calculate the benchmark

Security and deployment

  • SOC 2 Type IIIndependently audited security controls.
  • Dedicated infrastructureSingle-tenant options for production workloads.
  • Data residencyCloud, on-premises or co-located.

Publish rate and volatility feeds onchain with Goldsky

We’ll map it to your systems and show you what Goldsky runs, so your team builds the product, not the pipelines underneath it.

© Endless Sky Inc. All rights reserved.

PrivacyTermsSecurity

System status