
Project Stable
Project Stable is a decentralized, on-chain, price-history and inflation dashboard. It tracks price change of various daily-use products and commodities and allow users to see true inflation rates.
It also allow users to mint an anti-inflationary asset called STABLE token.
Demo: https://inflation.netlify.app/
Repo: https://github.com/saleel/stable
Subgraph: https://thegraph.com/hosted-service/subgraph/saleel/stable-price-history
Inspiration
Prices of daily-use products and services has been increasing drastically in the last couple of months. Many claims that govt. reported inflation numbers are not accurate.
Project stable aims to solve this problem by creating a global, decentralized, on-chain price history and inflation dashboard. The starting idea for this was inspired by this tweet
What it does
- Track prices of daily-use products and services, in multiple countries, on the chain.
- Prices collected from users.
- Tracks Price Index (weighted average of all prices) - measure of true inflation.
- Products to track and weightage chosen by DAO.
- Project token Stabilizer $SZR - used for governance and rewards.
- Allow users to mint an anti inflationary crypto-currency
$STABLE, that is pegged to the Global Price Index, and is "stable" in terms of purchasing power.
How it works

Stableis the main smart contract deployed on Aurora blockchain. A gas efficient chain like Aurora is optimal for a public facing application like this.- The product details are stored on IPFS and the hash/CID is stored in the contract.
Stablecontract create child contracts calledCountryTrackerto track prices within a country.
- Users submit prices to the
CountryTrackercontract (which only emits an event). - Aggregators watch for price submission event and aggregate all submissions made in a day, calculate aggregated price for each product and the Price Index, and submit them back to the contract. The rule (logic name) to be used for aggregation is set in the contract.
- Aggregators need to lockup
SZRto get claims for aggregation rounds - the more they lock, more rounds they can get. DAO can slash their locked SZR if they don't do aggregations properly. - The price submission events are indexed by a subgraph in the
TheGraphprotocol, which aggregators can use to query submission data. CountryTrackercontract stores the latest prices of all products and the price index.- The subgraph also index price and price index history - which powers the web app.
- Aggregators receive rewards in
SZR(amount set by DAO) for completing each agg. round. Users with winning submissions are also rewarded at the same time. Rules to chose winners is also decided by the DAO. - There is also a Global Price Index in
Stablewhich is the weighted average of Price Index of each participating country. The weightage for each country is stored inStablecontract and is again, set by the DAO.
StableToken
- StableToken (
STABLE) is a token pegged to the Global Price Index. - The peg is maintained using the
SZRtoken. Users can exchange 1 USD worth ofSZRfor 1 USD worth ofSTABLE. This is similar to how Terra/Luna works. - If a user mint 1000USD worth
STABLEby exchanging 1000USD worth ofSZR, and if the inflation increase by 10%, then they can burn theirSTABLEtokens and get 1100USD (10% extra) worth ofSZR.
Suppliers
- StableToken is backed by another entity in the ecosystem called by Suppliers
- Suppliers (super-market chains for example) stake their reputation, and promise to redeem $STABLE in exchange of the goods in the product basket - and borrow equivalent $SZR.
- Instead of paying an interest, they would pay/redeem the product basket even if the price increase in the future.
- Suppliers are approved and added to the contract by DAO. DAO also set a limit on the percentage of
SZRthey can withdraw with respect to theSTABLEthey promise to redeem. DAO can slow increase these limited based on the behavior of the supplier. - The incentive for the Supplier is they can borrow money without any interest, which they can use to run their business. Even when a user redeem their Stable token with the supplier, they make profits on the sales. In addition to that they get rewards in
SZRfor each redemption they do. - Suppliers are added to the contract by DAO after verification. Suppliers will have to show their identity publicly in the proposal they create for adding them. If they don't redeem the
STABLESthey promised, it can lead to bad reputation on the brand.
Exchange

- Users can only exchange
SZRforSTABLEif there are suppliers backing theSTABLE. However, there is aover-collateralization ratioin the contract which can be set by the DAO to allow mining of moreSTABLEthan that are in the contract. - As the ecosystem grows, more
STABLEthan that are backed can be minted because all users wont redeem them at once. - Also, users can always choose to burn
STABLEto mintSZRinstead of redeeming with a supplier. This would increase the supply ofSZRand reduces its value. - When users exchange
SZRforSTABLE,SZRequivalent to over collateralization is burned, as this amount is seignorage. This will also makeSZRa deflationary asset as the ecosystem grows.
Tech stack
- Contract deployed on Aurora -
0xaFB36003d119b3976D915D74887F9568ca635854(deployed to mainnet as TheGraph has trouble indexing testnet). - TheGraph for indexing - to track price submission, price and price index history, etc.
- IPFS for storing product meta - CID stored in contract.
- React for the UI.
Challenges I ran into
- Coming up with a cost effective way of collecting prices and aggregating them.
- Finding an economic method for
STABLEtokens to derive their their value. - Getting the contract optimal.
Accomplishments that I am proud of
- Deploying my first smart contract to a mainnet.
- Building and deploying (to hosted service) the subgraph which tracks all major on-chain activity.
- Elegant and simple web-app for viewing price history, and allowing users to interact with the contract.
What I learned
- Improve my skills on Solidity.
- Building subgraphs - with indexing IPFS data as well.
Things that can be done
- Suppliers backing STABLE token is only one model. DAO can have a smart contract where users can lock BTC, ETH as collateral and borrow STABLE (i.e equivalent SZR).
- Instead of paying interest, they would be paying the inflation rate as excess when they return.
- The contract can also act as an Oracle feed for the Defi apps. And also can bridge the tokens to other chains.
TODOs:
- Allow users to view inflation based on their choice of products and weightage.
- Improve overall quality - fix bugs, test for security/errors.
- Implement the DAO functionality - proposal and voting features. Currently the
ownerof the contract is one address, but the ownership can be transferred to the DAO. - The contract to derive the price of SZR from an oracle. It is currently simulated (based on supply) in the contract as the token is not traded on any exchange.
subgraphto also index the price submissions made through IPFS.- Implement a better logic to select one/few winners from price submissions. Currently all submissions which equal aggregated price is decided as winner.
- A lot of these would depend on the direction of this project.
Testing
Please contact me if you would like to test the app. I can transfer SZR tokens and also add you as a supplier if you would like to.
Contracts
Deployed to Aurora mainnet during POC/testing phase, as TheGraph has trouble indexing testnet
Contract on Aurora: 0xaFB36003d119b3976D915D74887F9568ca635854
SZR Token: 0x2f6ee7ee17647ed9cd0e449d893b5f2a285ef316
STABLE Token: 0x264cA4C59e24Dc7424CDf75f57ac14B2cc2eF3F3
Icons and logo from icons8


Log in or sign up for Devpost to join the conversation.