(RE) Introducing Pragma on Starknet

(RE) Introducing Pragma on Starknet

Pragma is the leading oracle on Starknet. It provides off-chain data to all DeFi happening on Starknet.

Pragma is built from the ground up to remove any trust assumptions in current oracles' design. There isn't any off-chain infrastructure, raw-data is directly pushed on-chain by whitelisted data providers. Then the aggregation happens at the smart contract level.

Pragma's smart contracts first version were built and audited almost a year ago and as you might all know Cairo has undergone massive changes in the meantime. In the past few months, we've been re-designing from scratch the developer experience for Pragma consumers, leveraging the type safety and expressivity of the new Cairo in order to make it easily maintainable and easy for developers to build on top of it.

https://github.com/Astraly-Labs/pragma-oracle

What's new

The documentation has gone through a massive overhaul with a lot more examples, detailed explanations and complete specs of the protocol along with resources for the ones eager to dive deeper into the future of Pragma.

https://docs.pragma.build

Wait that's not all, the SDK has been rewritten from scratch with a complete integration test suite, simplified developer experience and direct compatibility with the new Cairo 1 contracts.

To get started, just install the python package ⚡️

$ pip install pragma-sdk

More Data

We're also thrilled to announce that with this release, Pragma now officially supports Futures data mainly for ETH and BTC with raw data coming from Bybit, Binance, OKX and Market Makers.

In the next few weeks we will also be adding support for new assets such as wstETH, UNI and LORDS 🤫

Next step will be options, expect a lot to come on this 🔜

Examples

Instead of diving into the code itself, we will go through different examples on how you can consume data feeds using new Pragma contracts.

All the examples shown in this article can be found in the template repo https://github.com/Astraly-Labs/pragma-hack

BTC/USD Spot Median Price

SOL/USD Spot Average Price, filtered by sources

BTC/USD Future Price

BTC/USD 1 week Realised volatility

Migration

Currently, Cairo 0 contracts will stay the main one until all of our clients have migrated to Cairo 1 (Nostra, ZkLend, Carmine Options). The estimate is for the old contracts to be fully deprecated and replaced by these new contracts around October 2023, precise dates to be communicated.

Existing Data Providers (Argent, Braavos, Equilibrium, Skynet, Flowdesk..) will also switch to the new contracts as the migration progresses.

A few notes on this migration and why it's a very big step for Pragma on Starknet

  • We've been waiting for this migration to happen before involving new Data Providers, otherwise they would have had the burden of this migration. So, you can expect a lot more Data Providers to join as the migration happens.
  • 10x improvement in Developer Experience, 10x improvement in maintainability.
  • 10x in update frequency with Voliton/EIP 4844 coming Q3 2023.
  • Revamp of the Pragma SDK, the easiest way to interact with Pragma in Python.

Links and Ressources

Documentation / https://docs.pragma.build

Scarb Template / https://github.com/Astraly-Labs/pragma-hack

SDK / https://github.com/pragma-sdk

Contracts / https://github.com/Astraly-Labs/pragma-oracle

Home Page / https://pragma.build