[CLOSED]Deploy Pyth’s pull oracle to opBNB

Abstract

KiloEx, a decentralized exchange (DEX) on opBNB, is experiencing significant growth in its user base and trading volume. To ensure continued high-quality execution and security for its users, KiloEx requires access to reliable and trustworthy price data. Integrating Pyth oracles directly on opBNB would provide this essential data source, not only benefiting KiloEx but also other DeFi applications within the opBNB ecosystem.
Rationale

Similar to deployments on BNB Chain and Manta, integrating Pyth oracles on opBNB would offer several advantages for KiloEx users:

  • Enhanced execution quality and security: Pyth’s data feeds are known for their reliability and accuracy, mitigating the risk of price manipulation and front-running attacks.
  • Reduced operational risks: Pyth’s pull-based model, powered by first-party data, minimizes the risk of front-running compared to traditional push-based oracles.

KiloEx’s impressive track record, with over $10 billion in cumulative trading volume and a daily active user base exceeding 15000, underscores the need for robust oracle solutions. Pyth integration would further strengthen KiloEx’s infrastructure and contribute to the overall growth of the opBNB DeFi ecosystem.

Request

KiloEx requests the Pyth DAO’s support for deploying Pyth oracle data on opBNB. This initiative would not only benefit KiloEx users but also empower other DeFi applications within the ecosystem to leverage reliable price data feeds. To ensure the sustainability of this integration, KiloEx proposes that the Pyth DAO establish a competitive price-per-update fee that allows for continuous, high-quality service.

Proposed Plan

KiloEx suggests a deployment timeline with Pyth oracles live on both the opBNB testnet and mainnet by June 15th. Following successful testing, KiloEx would integrate the deployed oracle solution within two weeks.

Questions & Uncertainties

While KiloEx is confident in the value proposition of Pyth integration for opBNB, there remains some uncertainty regarding the level of support from the opBNB community. Open communication and collaboration between KiloEx, the Pyth DAO, and the opBNB community will be crucial for the success of this initiative.

KiloEx References

Website https://www.kiloex.io/

Community Groups

Official Telegram (English):Telegram: Contact @KiloEx

Social media

Official Discord:Discord

Official Twitter:x.com

Official Medium: KiloEx - Medium

79 Likes

I am in agreement of this deployment

19 Likes

i support the deployment to opBNB.
Pyth to every blockchain!

11 Likes

This makes sense, being everywhere and seeing everything is in the DNA of Pyth. opBNB rocks and needs an Oracle that jive !

9 Likes

opBNB has been growing nicely lately and Pyth seems to have an attractive opportunity by expanding there.

8 Likes

KiloEx is a decentralized perpetual protocol on Binance Smart Chain, OpBNB, and Manta. KiloEx offers 31 pairs with up to 100x leverage. The platform utilizes a vault system where USDT stakers act as the counterparty to traders. Traders open synthetic positions, where the pair utilizes the Pyth oracle price to determine PNL. The PNL will then be taken / given to the user counterparty vaults.

Based on analysis of chains, OpBNB is the most active for KiloEx, with 75% of the total value locked. The total value represents the amount staked in the counterparty vaults.

Platform volume shows a similar trend, with OpBNB having 85% dominance of trading volume ($26m / day average in May). However, it should be noted that the OpBNB chain currently has an incentivized trading tournament, which could slightly inflate the volume.

Since Pyth feeds are already live on Manta and Binance Smart Chain, it is a logical step to extend support for Pyth on the OpBNB network. This deployment will improve security for KiloEx and other protocols operating on the OpBNB chain, while also expanding Pyth’s reach and market presence. We consider this deployment a good proof of concept, and believe it would help experiment with the DAOs role in deciding future deployments.

24 Likes

There is no doubt that KiloEx is growing in terms of TVL and has got an organic userbase which has allowed it to be the dominant app on opBNB.

This is a key point as the integration, support and maintenance of the Pyth oracle should be a sustainable one. Would be great to have more input from the community on this point.

5 Likes

pyth for everyone!

7 Likes

[DouroLabs] Proposal for Integration of Pyth Price Feeds on opBNB

Summary

In response to the request made by KiloEx (here), Douro Labs proposes to develop and deploy integration software and services on opBNB, allowing any smart contract application to securely access the Pyth data on both Testnet and Mainnet.

The target completion is June 15, 2024.

Background

Douro Labs is a software development company that helps decentralise data services and enhance access to real-time, once-exclusive market data for all blockchain participants by contributing to some of the most important projects in the space, such as the Pyth Network, where Douro Labs is one of the initial contributors. The company employs close to 30 individuals who previously worked at firms such as Goldman Sachs, Jump Crypto, BNP Paribas, Amazon Web Services and Chorus One. Douro Labs is building oracle tooling, products, and Web3 infrastructure that will expand the Pyth Network’s suite of decentralized data services and enhance access to real-time, once-exclusive market data for all blockchain participants.

To date, Douro Labs has been responsible for the development of Pyth services on 59 chains.

Scope

Douro Labs proposes to perform the following:

  1. The deployment of audited smart contracts related to Pyth’s on-demand oracle to make Pyth data available on opBNB, on both the testnet and mainnet environments. The software associated with the integration of Pyth price feed services is open-source and licensed under the Apache License, Version 2.0. Please refer to the license file: GitHub - pyth-network/pyth-crosschain: Crosschain Pyth programs and utilities. The deployment will be deemed completed at the successful verification of at least 10 price updates on mainnet

  2. Douro Labs will maintain the integration software and make the necessary changes over time related to:

    1. any chain upgrades and/or changes that require smart contract updates
    2. any changes related to the Pyth protocol that the DAO decides to action and that may impact the smart contracts deployed on opBNB

    The duration of the maintenance services would be for 1 year, pending additional proposals to extend the maintenance period

Outcomes and Timeline

  1. Pyth Price feeds integration development, release in the repo GitHub - pyth-network/pyth-crosschain: Crosschain Pyth programs and utilities and deployment on Testnet by June 3, 2024
  2. Operational Improvement Proposal raised to Pythian Council to deploy on Mainnet and Deployment by June 6, 2024
  3. DeFi application integration and testing completed (including KiloEx) by June 15, 2024

Cost

We call on to the Pythian Council to define price per update that is commensurate with the value the Pyth data will add to protocols and applications on opBNB.

Next Step

Douro Labs welcome any comments or feedback below.

20 Likes

Thanks a lot to @Joey for the proposal!

It is amazing to see applications powered by Pyth like KiloEx coming to the Pyth Forum requesting deployment of Pyth data services on other chains including opBNB.

I agree with Douro Labs // @zenyas proposal of deploying the Pyth oracle on opBNB and strive for the implementation of Pyth update fees.

As a reminder, the Pyth Network protocol has been designed to allow for the optional enablement of data fees in order to update the state of an on-chain price feeds. Until now, such fee has been set to the smallest denomination of the blockchain’s native token (e.g., 1 wei on Ethereum) and are collected every time an application updates one/multiple price feeds onchain.

When reviewing the DeFi landscape and potential Pyth usage on opBNB (and also BNB), pricing of Pyth updates should consider KiloEx’s usage and the value provided given that it is the clear leader of the opBNB DeFi ecosystem — over 50% of opBNB TVL is from KiloEx (DeFiLlama).

APX is the only other derivatives protocol on opBNB, with about 10% market share.

Another potential user of Pyth price feeds could be Kinza — the borrow-lending protocol with over $500K TVL on opBNB. Kinza is also deployed on BNB Chain. Kinza currently supports only 2 assets on its opBNB markets: USDT & BNB. Given the liquidity currently available, Kinza could, with the help of the Pyth Price Feeds, reach up to 5 assets listed in total.

KiloEX charges users/traders in various ways on opBNB:

  • Commission is uniformly charged at 0.1% of the position size

With a general trade size of $2,000, it means average fees are $4 ($2 to enter and close the trade)

  • Execution fee is charged by the blockchain itself (cost to send the keeper tx)

On opBNB it is set at 0.000014 BNB (or $0.01)

With the implementation of fees on opBNB for the Pyth price updates this cost will be an additional cost either to the app (if it does not change the commission or execution fees) or the end users (if the app indirectly charged back the new cost to its users) ; therefore while it is important for Pyth to maximize its revenues, it shouldn’t be at the detriment of KiloEX.

Thus, I would suggest for the Pyth update fee to be set at 0.000186 BNB (or about $0.09 at 27/05/24 price).

Re-using the above example, KiloEx could consider various solutions:

  • Increase its Execution fee from 0.000014 BNB (or $0.01) to 0.0002 BNB (or about $0.10)

Doing so would mean having the users/traders directly paying for the full costs and usage of the oracle

  • Use part of its commission fees to pay for the oracle usage and cost

In regards to the value generated for the Pyth DAO, we can look at KiloEx recent activity to estimate what this would bring to the network.

KiloEx has constantly gathered over 5,000 daily active users on opBNB since the beginning of 2024 — KiloEx Trade

Even with just assuming a single trade per user would mean, at minimum, 5,000 price update requests, and so 5,000 the collection of the 0.000186 BNB fee.

All in all, this deployment (with fees) makes sense and I’d be for Pyth expanding its oracle network to opBNB.

14 Likes

A deployment on opBNB would be great to serve a new DeFi ecosystem, more apps, and keep supporting KiloEx which has been a great partner and consumer of Pyth Data.

Setting a competitive fee to make this deployment attractive for dApps to use Pyth and guaranteeing support of the Oracle setup is crucial for long-term success. Aligned with @KemarTiti fee proposal which keeps updates cheap for dapps to keep updating feeds at the frequency it needs to operate smoothly.

11 Likes

seems like this makes sense to support KiloEx and other builders on opBNB.

the fees seem slightly high and might limit some use cases (or cause people to seek other ways of pulling pythnet data). But if KiloEx is happy with this fee level I think we could just revisit later if another app needed lower fees to function.

5 Likes

Thanks @KemarTiti, for your insightful recommendations regarding the proposed fee tier.

Revenue Perspective

Implementing the recommended fee tier would generate significant revenue for Pyth DAO, extending well beyond the initial deployment costs. Based on our backtesting assumptions, where each daily active user executes one trade per day, the average daily revenue for Pyth in 2024 would be $1,010. This would have resulted in cumulative revenue of $156,000, with $150,000 of that amount being generated in 2024 alone.

User Perspective

Based on @KemarTiti comments, we consider a general trade size of $2,000, with the current average fee being approximately $4 ($2 to enter and $2 to exit the trade).

Introducing a fee of $0.09 per price update would result in a slight increase to an average fee of $4.18 (21 basis points of $2,000). This represents a 5% rise in fees, which we believe is relatively small in comparison to the overall transaction costs. Additionally, it is possible that KiloEX may subsidize these costs, resulting in no change to the end user.

Conclusion

Considering both the revenue perspective and user perspective, we find the proposed fee of 0.000186 BNB (approximately $0.09) to be reasonable and appropriate. While we support this fee tier, we still welcome other opinions and are open to considering alternative suggestions presented by the DAO.

13 Likes

Agree with @KemarTiti analysis. An increase of $0.09 in fees is quite negligible compared to total amount and the value added from Pyth oracle feeds can be considered to be much higher. Thus this would be a great bargain for the opBNB ecosystem - this will allow KiloEx and others access to 500+ realtime price feeds via the on demand pull model. This will be a shot in the arm for the opBNB ecosystem.

I would request the Pythian Council to consider 9c as protocol fee per update.

10 Likes

GM Pythians,

Thanks for a solid proposal from the KiloEx team and a solid execution plan from Douro Labs!

While opBNB’s TVL is relatively small as of the time of writing this, I believe there are some catalysts, such as direct withdrawal from Binance to the opBNB chain (which is currently live), that could fuel its growth. Being deployed as a first mover on a chain that has the potential to grow usually brings unique competitive advantages and also makes it a go-to choice when new apps deploy there. Hence, I support and am excited to see Pyth deploy on opBNB.

In regard to the ‘price per update’ parameter left for the Pythian Council to determine, without delving into KiloEx’s codebase as their contracts are currently closed-source, typically there are two key actions that involve oracles for most pool-based perp dex platforms: adding/removing liquidity, and trading. I believe we could work backward to determine how many prices each of these actions needs to be updated and find a middle ground between Pyth, KiloEx, and users.

Based-on my guess on how KiloEx contracts work, here is what I think:

1. Adding and removing liquidity: This action will require updating prices for all listed markets to calculate the kUSDT value on-chain. Currently, KiloEx has listed fifty markets. Based on transactions I’ve tried on KiloEx, it seems that KiloEx is currently pushing these prices to the oracle contract and allowing the pool contract to query prices from the oracle contract, as the add liquidity transaction is atomic and doesn’t rely on any keeper. Assuming KiloEx pushes prices every ten seconds to ensure the kUSDT value on-chain is always updated, and considering KiloEx currently has a trading volume of $26 million per day on average in May (thanks to @0xkeyrock.sol for the data!), that equates to $26,000 in topline protocol revenue (before distribution to kUSDT s. Let’s say a fair oracle cost for KiloEx is approximately 1% of the topline protocol revenue, which is $260 maximum per day for oracle costs. Given this number, the fair ‘price per update’ should be 260 / ((86400 / 10) * 50), approximately $0.0006 if KiloEx will be the only one that pushes prices on opBNB.

2. Trading: Currently, KiloEx charges 0.000014 BNB (or $0.01) for an execution fee, which I assume should cover everything on KiloEx’s end. I’m wearing a trader hat and quickly looked into data and compared this to other perps in the market. See the table below:

Perps Execution Fee ($)
GMX ~$0.33
HMX ~$0.16
Synthetix v2 ~$1.38

Given @KemarTiti’s suggested ‘price per update’ fee of ~$0.09 and combined with the existing base fee, the total execution fee from a user’s perspective will be ~$0.1. I think it is still economically sound and competitive compared to other leading pool-based perp dexes.

However, this is based on the assumption that KiloEx contracts update only one single price per trade. If this assumption turns out to be false, I suggest we work backward from the execution fee target that is compatible with other perp dexes and come up with a final ‘price per update’ fee from that.

I personally don’t have access to the number of trades per day on KiloEx. However, taking 5,000 trades per day from @KemarTiti as a reference, this would mean, on average, Pyth prices on opBNB will get updated every 17.28 seconds by traders on KiloEx, which should keep prices fresh enough for ‘add and remove liquidity.’ Hence, passing costs to traders while still maintaining an overall execution fee compatible with other perps is preferable.

All in all, I’m leaning towards the logic behind what @KemarTiti suggested. However, I would like to get confirmation from KiloEx on how many price updates your contracts need per trade, so that we can agree on how much the ‘price per update’ should be.

16 Likes

I agree with this based on the examples given. Seems to be a logical approach, and @0xkeyrock.sol illustrating how comparatively small the extra cost to users will look like, with the potential for kiloEx to subsidise this.

13 Likes

The more blockchains the better! I stand for deployment to opBNB.that chain is advancing good

7 Likes

I agree with this deployment! PYTH should be on every blockchain!

3 Likes

This makes a lot of sense to me. opBNB is growing which will introduce a traditionally Binance user base to pyth, and at the same time with pyth’s support interoperability will increase exponentially for opBNB

5 Likes

I agree, this deployment makes a lot of sense. The pricing is also extremely favorable to the PYTH community.

3 Likes