The power sector of India is responsible for 49% of greenhouse gas emissions. India's target to achieve net-zero emissions by 2070 is ambitious but faces significant challenges in terms of the scale and speed of the transition to renewable energy sources. The lack of current infrastructure and slow pace of technology adoption remains a major barrier to achieving this goal.
The lack of a sustainable revenue and profit model for the grid, independent companies, and MSMEs in the renewable energy sector has hindered the growth of the sector. The absence of clear policies and frameworks for the energy exchange platforms such as IEX/IPX has also made it difficult for these companies to operate and generate revenue.
What we have come up with is a Revenue cum trading model for people to trade power such that consumers get the best rates possible. These rates will be decided after speculation on a Decentralized Exchange. This exchange is special since it works on an order book-based model instead of the traditional (at least in Defi terms) AMM-based model.
The solution tackles multiple prevalent and potential problems in the current energy infra. All power distribution is currently controlled by centralized authorities and is thus vulnerable to hacks and price manipulation. Our system aims to provide small companies with an equal footing to these large companies. By small companies, I also mean the homeowners with solar panels on their roofs who generate surplus energy during the day. Such people can now make revenue off their investments. The price of the energy will be speculated upon by distributors of energy as well as producers of energy. This will converge the price to the economic efficient point, just like stocks.
As there weren’t many precedents to implementing an OrderBook in solidity, we had problems on how to start. After searching for quite a while we came across some implementations in other languages but they used data structures which were far too complex to be implemented in Solidity.
After reading through the desired functionalities of an OrderBook, we decided to go with separate self-balancing binary search trees for bid and ask orders in which each node depicted price and also contained a linked lists of orders for that given price.
Searching for pricing and matching algorithms was also difficult as they generally contained math too complicated to implement in Solidity. We settled on a matching algorithm which matched highest bid with lowest ask at any given time with separate matching done for taker orders.
This presented us with its own set of problems, like taking care of slippage which was done in the takerMatching function.
One of the first problems we faced was that Solidity does not allow recursive structure definitions. This meant that we could not define Linked lists and self-balancing binary search trees as we wished and had to rely on other indirect ways of implementing them.
Tracks Applied (5)
Polygon
Polygon
Filecoin
Replit
Discussion