Disclaimer: I am a contributor to the Pyth network protocol through my work for the Pyth Data Association — more details on the association here.
Rationale
To further secure its users’ assets and the overall platform, Venus needs to build a more resilient and comprehensive pricing mechanism to avoid relying on a single source of truth which may very well become a “single point of failure” in certain scenarios.
Summary
This is a proposal to integrate (when possible) the Pyth network oracle price feeds as a secondary source for asset pricing on Venus Protocol.
Motivations
Deposited assets on Venus are gathered into a single pool: a single erroneous instance of pricing information used by Venus protocol can open the door to an attack and cause significant losses of users’ or protocol’s funds. Unwarranted liquidations of users’ positions is another important risk if the program were to be served erroneous pricing information.
Venus designing a highly robust system to accurately and fairly value every asset it supports (regardless of any situation) will generate even greater confidence from existing users and may attract new Venus users which will, in turn, increase the general amounts deposited and borrowed (and thus protocol revenue).
Timeliness of pricing information is also an important safety consideration for Venus’ design: not receiving a price may be just as bad as receiving an inaccurate one.
The motivation is to never ever again have these unfortunate events: (Venus Statement on) LUNA Incident #1 #2 #3
Pyth Network Background
What is Pyth?
The Pyth network is a first-party financial oracle network designed to publish continuous real-world data on-chain in a tamper-resistant, decentralized, and self-sustainable environment.
The network incentivizes market participants — exchanges, market makers, and financial services providers — to share directly on-chain (on Solana) the price data collected as part of their existing operations. The network then aggregates this first-party price data with a robust algorithm (still on-chain) and makes it available for free to either on- or off-chain applications. End-users of Pyth data will later be able to voluntarily pay data fees to gain protection against a potential oracle failure as well as attract additional publishers to make the network more robust.
Launched on Solana mainnet in August 2021, Pyth finished the year securing over $1B in Value (TVS), facilitated over $7B in trading (including perpetual and synthetics platforms), and with 38 announced mainnet integration partners and 41 data publishers. Since then, Pyth TVS reached about $2B spread over 50 integrations and welcomed more than 15 new data publishers. Find out about our users on the Pyth website.
While most Pyth users are on Solana and the Pyth smart contract (to generate prices) is also on Solana, our goal has always been to make previously inaccessible data available to all projects and users regardless of their blockchain base.
Thanks to Wormhole and the BNB Chain team, the BNB Chain will be the first blockchain outside of Solana to receive Pyth pricing data. We hope to empower leading BNB projects such as Venus into building more robust systems thanks to Pyth’s powerful data.
For more details on the Pyth network and how it will work once it becomes features-complete, I recommend the following: Pyth Whitepaper, Pyth Whitepaper Summary, Pyth Whitepaper Walkthrough, and Pyth Wiki.
Pyth Today
Rather than going into things not yet live, I will just focus on the current state of the network and highlight what is already live and working:
Pyth already supports 70+ price feeds for crypto, FX, equities, and metals. As Pyth goes live on the BNB Chain, we will look to support more assets that are popular on the BNB Chain. For reference, the BTC/USD price is derived from the inputs of 32 publishers directly interacting with the Pyth smart contract. Smaller (crypto) assets have for now about 8 publishers but we are actively working on increasing this number.
In addition to a high-quality set of publishers and a sophisticated aggregation algorithm, Pyth price feeds also come with extra features like a confidence interval and EMA prices.
The confidence interval represents the width around a price estimate in which publishers believe the true price probably lies. Each Pyth publisher reports both a price estimate and confidence interval (for that estimate) to be aggregated, and the aggregated price will have its own aggregated confidence interval value. More information is available here. We look forward to producing recaps of Pyth’s performance in the highly volatile periods.
Pyth also offers an exponentially-weighted moving average (EMA) price and exponentially-weighted moving average (EMA) confidence. These values are time-weighted averages of the aggregate price and confidence. Both the EMA price and confidence are natively available from Pyth price accounts. More information on this here.
More details can be found here: Pyth Publishers, Pyth Consumers, Pyth Metrics. Pyth Docs.
Pyth x Wormhole x BNB Chain
Pyth prices are published on Solana and relayed to EVM chains using Wormhole Network as a cross-chain message passing bridge. Wormhole Network observes when Pyth prices on Solana have changed and publishes an off-chain signed message attesting to this fact. (A more detailed explanation can be found here).
This signed message can then be submitted to the Pyth contract on the EVM networks, which will verify the Wormhole message and update the Pyth contract with the new price.
Price updates are not submitted on the EVM networks automatically: rather, when a consumer needs to use the value of a price, they should first submit the latest Wormhole update for that price to the Pyth contract on the EVM network they are working on. This will make the most recent price update available on-chain for EVM contracts to use. Updating the price needs to be done in an off-chain program, using the pyth-evm-js package.
The Pyth oracle is currently live on the BNB Chain Testnet — Contract address: 0x621284a611b64dEa837924092F3B6C12C03C386E
— and we are looking forward to deploying it on Mainnet once we receive a positive security audit. BNB Chain Testnet currently receives pricing information for 6 assets (ALGO, BTC, ETH, LUNA, USDC, UST), but all Pyth price feeds will be deployed once we release on Mainnet.
It’s still early days in terms of making Pyth data available on other chains. There are many exciting developments to be made, and we would be honored to work alongside Venus and other BNB Chain dApps to create the best experience of using Pyth from BNB Chain. An example of such developments includes a ‘decentralized’ vault where dApps could collectively allocate funds to trigger frequent updates at a marginal cost to each dApp. Other improvements being looked at are failsafes for periods of Solana congestions.
Specification
Venus x Pyth Supported Pair
Venus currently supports the following assets on its platform: UST, DOT, DAI, CAKE, MATIC, AAVE, TRX, USDC, FIL, BNB, TUSD, ADA, USDT, BUSD, BCH, LTC, LINK, BETH, XRP, BTCB, DOGE, ETH, SXP, XVS, LUNA, and VAI
Not all these Venus markets have corresponding Pyth price feeds yet. What’s currently missing: DAI, CAKE, AAVE, TRX, FIL, TUSD, BUSD, LINK, (BETH), XRP, (BTCB), SXP, XVS, and VAI
Alongside our deployment to the BNB Chain, work is already being done to onboard new assets such as BUSD and TUSD. If this proposal is positively received by the community, we would look to rapidly supporting more of the Venus platform-supported assets (XVS and VAI especially).
In turn, Venus could expand the assets supported on its platform and further boost its deposited assets and TVL by integrating with Pyth. Solana protocols would also be able to easily leverage BNB Chain assets, which would increase their overall utility.
Discussion
How can Venus’ oracle module be the most accurate and resilient in cases of prolonged and intense market volatility as well as be robust to any operational issues experienced by its selected sources of pricing information?