PIP: Reducing Gas Costs in PlotX Prediction Markets

Preamble

Title: Reducing Gas Costs in PlotX Prediction Markets

Simple Summary

Optimizing PlotX Smart Contracts for reducing gas costs in market creation, participation and reward claiming.

Abstract

This proposal details an optimization strategy for PlotX Smart Contracts to reduce the cost of interaction with the smart contracts i.e. the gas cost spent in PlotX market creation, prediction participation and reward claiming.

Motivation

Current Cost of Operationalizing the PlotX protocol on Ethereum

The current cost of operationalizing the PlotX protocol on Ethereum can be noted at 4 major steps as highlighted below:

Head Average Gas Amount Cost (assuming: gas price = 30 gwei, 1 ETH = $370)
Creation of Markets 650,000 $7.22
Participation in Markets 350,000 $3.89
Claiming the Participation Rewards 110,000 $1.22
Claiming the Market Creation Rewards 37,000 $0.41

It is important that these gas costs are reduced to a minimum in order to open up the protocol to a wider user base and attract better liquidity. A longer-term solution would be to evaluate an L2 scaling solution, however, in the immediate term, it is prudent to optimize the existing smart contracts on Ethereum.

Optimizing the smart contracts while being on Ethereum

The following areas are identified for optimization on the existing smart contracts:

  1. Converting multiple market contracts to a single market contract
    At present, whenever a market is created on PlotX, a new market smart contract is deployed on Ethereum. This is a ‘high-on-gas’ activity. The idea is to change this concept such that there is one single market contract.
  2. Removing Leverage Functionality
    The leverage (or deleverage) functionality available as on date adds substantial complexity in the smart contracts resulting in high gas cost of predicting. The leverage functionality has been repeatedly called out in the community as well - a lot of the existing users haven’t liked the functionality. Removing the leverage function will substantially reduce the gas fee.
  3. Implementing Deposit & Predict
    This is a new feature - it will allow users to deposit their ETH or PLOT in the PlotX Market smart contract, in a non-custodial manner. This deposit can be used in predictions without having to transfer funds every time. It is important to note that the deposits can only be used on transaction signing by the User’s wallet (metamask or walletconnect) and hence all deposits remain completely non-custodial.
    The transfer function adds ~25000 in gas every time. Having the “deposit & predict” feature will cut down the gas costs as it removes the friction of transferring ETH / PLOT each time.
  4. Circling Back Rewards
    Another feature that was continuously asked by the community was to allow for usage of “rewards” in making predictions. This is now being developed and will assist in reducing cumulative participation & reward claiming gas costs.
    Users who earn rewards will be able to use their rewards for making predictions etc, without having to claim the rewards in a separate transaction.
  5. Option pricing
    One of the factors for option pricing was the value of ETH/PLOT staked on the option vs other options. This is now being changed to the number of positions purchased in option vs other options.

If we implement the above 5 optimizations, we would be able to reduce the gas cost substantially. The table below is an indication of the potential reduction in gas cost:

Head Current Gas Amount Gas Amt After Optimization Approx. %age reduction New Cost (assuming: gas price = 30 gwei, 1 ETH = $370)
Creation of Markets 650,000 250,000 61% $2.78
Participation in Markets 350,000 227,000 35% $2.51
Claiming the Participation Rewards 110,000 40,000 63% $0.41
Claiming the Market Creation Rewards 37,000 31,000 16% $0.34

Specification

Smart contracts for emulating the above 5 optimizations are being developed and are under testing.

Rationale

These 5 optimizations will reduce the gas costs for participation in PlotX markets - which is one of the biggest challenges in increasing the liquidity of markets. These optimizations should be done with immediate effect to improve the liquidity and user experience.

Copyright

Copyright and related rights waived via CC0.

3 Likes

I support all of these changes. Keen to see them implemented as soon as possible! Great job Ish and team!

2 Likes

I like the progress the team is going to make. Anyway the gas problem is crucial and any steps, which are going to solve this problem are welcomed by me. I’m sorry to know about the leverage removal. It had several interesting features to use, like installed multipliers. I especially appreciate steps 3 and 4. this is what I was waiting for all this time! And this is what the Project really needs. I still don’t get option 5. I mean it’s hard to estimate the change without the example with numbers (like you did here with charts, which illustrate very clearly the benefits of the new system) or untill it’s possible to see it on prediction markets. So in general, the changes are positive and I hope it will help PlotX platform to attract more users.

2 Likes

This is much needed and will help adoption of the platform. Plot X team well done and keep up the good work

1 Like

Hey @congress-man, appreciate your support. Yes, it’s a bit sad that the leverage needs to be removed - the feature isn’t worthy in comparison to the gas cost impact it has. So we need to live without it for now I guess.

On the 5th point, let me come back with some illustrations to make it more clearer.

Thanks!

1 Like

3 & 4 along with the market creation rewards PIP should enable a significant liquidity creation action from KOLs to get new and repeat participants into the markets.

What about directly deploying on xDAI for now? How will this affect the oracle system you guys have?

Imo for the short term we can deploy on xDAI and use Binance price feeds to get it going.
For the staking, You can build your own bridge for PLOT tokens so you are in control of it + deploy the xPLOT tokens on the same address.

Just a thought. :slight_smile:

I have used xdai on Perpetual Protocol exchange. And I can’t say what I liked - transactions freeze, sometimes do not work and are not confirmed very quickly. We need a different solution.
Regarding the current proposal - I fully support it.

2 Likes