23

How Perpetual Protocol Uses Chainlink to Bring a Perpetual Contract to Every Ass...

 3 years ago
source link: https://perpetualprotocol.medium.com/how-perpetual-protocol-uses-chainlink-to-bring-a-perpetual-contract-to-every-asset-564ba5ac773e
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Responses

There are currently no responses for this story.

Be the first to respond.

Image for post
Image for post

How Perpetual Protocol Uses Chainlink to Bring a Perpetual Contract to Every Asset

Since the launch of Perpetual Protocol, we’ve received lots of questions regarding how we use Chainlink and what the future holds for this collaboration. To better inform our users, we wrote this definitive guide that goes into the integration in more detail.

The Perpetual Protocol + Chainlink Integration

A perpetual contract is a kind of derivative similar to a futures contract but without the expiry date. For conventional futures contracts such as WTI, the contract’s price will gradually converge with the underlying asset’s spot market price as the expiry date of the contract approaches. For a perpetual contract to converge its price with the spot market, the most effective method used in the industry is called “funding”.

In the case of Perpetual Protocol, our system pulls the spot price of each underlying asset once every 1 hour from Chainlink (this price is also known as the ‘index price’). Next, our smart contract calculates the difference between the time-weighted average price (TWAP) of Perpetual’s current market price and the TWAP of the index price. If the result is positive (Market Price > Index Price), long position holders need to pay a funding payment to the short position holders to negate the excessive demand for longs on Perpetual, vice versa if the difference is negative.

Image for post
Image for post

Please check here to see the formula we use to calculate the funding payment on Perpetual Protocol

Even though Perpetual Protocol’s system design is flexible enough to support any asset with a price feed on the Ethereum blockchain as the underlying asset for a perpetual contract, at launch, we only use BTC/USD and ETH/USD price feeds from Chainlink’s Price Reference Data. The reason being that we take security very seriously and want to make sure everything works as expected before expanding to additional assets.

One thing worth mentioning is that Perpetual Protocol uses xDai Chain to offer an enhanced trading experience with faster finality and no gas fees for trades. Native Chainlink integration with the xDai chain is under active development and Perpetual Protocol looks forward to being among the first users of price feeds on xDai. Until then, we are able to leverage a Chainlink External Adapter to read Chainlink Price Feed updates on Ethereum and write them on xDAI so they can be used by Perpetual. Learn more here.

As PERP, Perpetual Protocol’s native token, becomes more distributed among different holders, we will kick-start our governance process and let stakers vote on which underlying assets supported by Chainlink’s large collection of on-chain price feeds we should use to create the next tradable perpetual contract. As such, one can expect that Perpetual Protocol will consume more and more Chainlink Price Feeds as time goes by.

“We’re excited to be working with Perpetual Protocol by providing them with secure and reliable decentralized price oracles to ensure they have a well-functioning funding payment system,” said Johann Eid, Chainlink Product Manager. “This allows users to trust in the automated rebalancing of the network, ultimately bringing more security to user funds.”

We selected Chainlink as our go-to oracle solution because it’s a proven solution on mainnet currently securing $5B+ in total value for DeFi. Its decentralized architecture ensures highly available and tamper-resistant price oracles. It also provides accurate price data sourced from high-quality data aggregators, which maintain volume-adjusted market coverage across all trading environments as opposed to any single or small group of exchanges. This is key to protecting Perpetual against data manipulation vulnerabilities such as the recent flash loan attacks on DEX-based price oracles.

Image for post
Image for post
The Chainlink ETH/USD Price Reference Data feed used by Perpetual Protocol.

As Yenwen Feng, founder of Perpetual Protocol, puts it, “DeFi has seen tremendous growth thanks to the proliferation of derivatives protocols. We’re excited to integrate with the industry leader in oracles to ensure that our funding system is highly secure and rebalances according to accurate prices that represent aggregated global market prices. By integrating Chainlink, we accelerated our launch date and will ultimately be able to scale quickly to support more assets in the future.”

About Perpetual Protocol

Perpetual Protocol is a decentralized perpetual contract protocol that lets traders trade long-tail futures with up to 20X leverage without counterparty risk.

Perpetual Protocol’s unique, maker-free vAMM (virtual automated market maker) guarantees on-chain liquidity for new and emerging futures and sets predictable prices using a tailormade constant product curve. $PERP, the native token of Perpetual Protocol, backs the protocol’s Staking Pool, which collectively secures each market and enables maker-less trading.

To open your first trade, visit https://perp.exchange/.

Website | Testnet | Twitter |Telegram |Discord| Documentation | Governance

About Chainlink

Chainlink is the most widely used and secure way to power universal smart contracts. With Chainlink, developers can connect any blockchain with high-quality data sources from other blockchains as well as real-world data. Managed by a global, decentralized community of hundreds of thousands of people, Chainlink is introducing a fairer model for contracts. Its network currently secures billions of dollars in value for smart contracts across the decentralized finance (DeFi), insurance and gaming ecosystems, among others.

Chainlink is trusted by hundreds of organizations to deliver definitive truth via secure, reliable data feeds. To learn more, visit chain.link, subscribe to the Chainlink newsletter, and follow @chainlink on Twitter.

Docs |Discord | Reddit | YouTube | Telegram | Events | GitHub | Price Feeds | DeFi | VRF


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK