Smart Contract Design

An overview of the contract structure that makes Pragma secure, robust, and easy to integrate

Contract Structure

The V1 of the Pragma Oracle consists of three smart contracts, that each play a role in making the oracle easy to use and robust.

Publisher Registry

The most static component, designed to be updated extremely infrequently because its state should be permanent (each publisher and their address). Currently an ownable contract but will become permissionless as Pragma decentralizes.

Oracle Proxy

A proxy contract that coordinates the Publisher Registry and the Oracle implementation(s). This is the contract which protocols interact with directly.

Oracle Implementation

Contains the logic for storing and aggregating specific key/value data streams. Designed to be updated only as frequently as absolutely necessary.

Aggregation Mechanism

Our system incorporates multiple publishers, each responsible for providing data from various sources. To determine the price for a given source, we consider the prices submitted by all these publishers. Our approach involves conducting an initial on-chain aggregation based on the median of these prices. This median value then becomes the established price for that particular source.

1

Data Collection

Multiple publishers submit data from various sources to the Oracle

2

Initial Aggregation

For each source, a median price is calculated from publisher-submitted values

3

Final Aggregation

When consuming data, users can select their preferred method to aggregate across sources

This aggregation process is triggered when one of the aggregation functions, as outlined in the Consuming Data section, is called. During this process, users have the flexibility to choose their preferred method of aggregation for the sources. This choice allows them to tailor the final price calculation according to their specific needs or criteria. By utilizing this method of aggregation, we enhance the security of the final price determination, making it less vulnerable to manipulation, as it incorporates a broad and balanced range of data from multiple publishers.

Security Measures

Peer Reviews

Our contracts have thoroughly been peer-reviewed by multiple actors in the Starknet ecosystem

Professional Audit

Complete audit by Nethermind, with the report available here

Bug Bounty

Active bug bounty program through ImmuneFi

Direct Contact

Direct communication channel at matthias@pragma.build

Explore the Data

Interactive Explorer

We have a fully-fledged explorer available on our website. There you can explore what’s happening on and off-chain, who is providing data, and more. If there is any other information you would like to see displayed, let us know!

Deployed Contracts