Inspiration
The growing demand of defi encouraged me to learn about it and build a project which could provide some real world value rather than just a copy-paste defi project for resume. I was planning to build something in defi space and the constellation hackathon gave me the right opportunity to show my skills and enthusiasm to finally bring it to reality.
What it does
It is a Decentralized Futures Market trading dapp. It could be used by traders who trades over defi. Here, any user can create their trading account and buy/sell the asset(WETH) at the current future's price. They would have to provide the margin money for buying or selling the asset. After a fixed amount of time, all the traders net assets would be settled and they would be returned their security money after the consideration of their profit or loss. After all this process is done, new slot will be initiated for traders to trade again.
How we built it
First, I explored the defi space, its working and applications. After understanding it, I built it by using Chainlink's data feed to get the current price of the asset. All the functions were created including the buyAsset, sellAsset, settleContract and startNewSlot. Frontend was built using vite+react and ethers.js library. At the end, when the final contract seemed ready(just 5 hours before the deadline, lol), I set up the Chainlink automations for calling settleContracts and startNewSlot functions. This completed the project building project.
Challenges we ran into
Understanding defi was not an easy task. Over that, futures was even more confusing. I've built a completely wrong dapp thinking it being futures market. While building this market, figuring out how to update the price of future contract based on current demand was challenging. I also struggled on getting the historic data through events due to which I had to ultimately shift to rely over the storage variables for historic data. And the ultimate challenge is the time limit due to which cross-chain linking has not been implemented over it.
Accomplishments that we're proud of
Ultimately, completed the project before the deadline matter a lot to me. I don't know even if my project would cross the first level of judging criteria or not, but I am satisfied that I finally did it alone and on time. It was my first hackathon where I jumped without any teammate or mentorship.
What we learned
I learnt defi and meaning and working of futures market, improved my hands on with smart contracts, some new stuff in react and ethers.js and the most important thing, to complete the assigned work on time.
What's next for FutureFi
1) Can be made compatible to handle multiple slots rather than just immidiate one. 2) Better Algorithm can be used to calculate the futures price which will be in correspondance with the actual price of the asset in outer market as well 3) Integration of cross chain protocols like ccip, which will make it accessible through multiple chains. 4) Improving the UI/UX and frontend part of the code so as to make it easier for everyone to use it.
Built With
- ethers.js
- hardhat
- javascript
- react.js
- solidity
- vscode
Log in or sign up for Devpost to join the conversation.