Title: Reducing Gas Costs in PlotX Prediction Markets
Optimizing PlotX Smart Contracts for reducing gas costs in market creation, participation and reward claiming.
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.
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:
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.
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.
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.
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.
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|
Smart contracts for emulating the above 5 optimizations are being developed and are under testing.
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 and related rights waived via CC0.