project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4

DeFuture

Defutures, a decentralized futures trading exchange, meets users expectations to invest in a way it provides back both stability and constant high yield returns. It is designed to be extremely simple and straightforward - any crypto beginners are also able to use easily.

DeFuture

Created At

ETHGlobal Tokyo

Winner of

trophy

📜 Scroll — Just Deploy

trophy

🏊‍♂️ Polygon — Pool Prize

trophy

4️⃣ Linea — Best Use

Project Description

In the recent years, the popularity of futures trading exploded as it returned highest yields, especially in the world of DeFi where high fluctuations exists. Futures trading is proven to provide stability by its hedging mechanism and at the same time maintaining high profit when chosen the right volatility. However, the appearance of futures trading resulted DeFi users to lean more towards profitability in trading that exposes their positions to the heightened price volatility. High gas costs resulted for syncing off-chain data inevitable as well, resulting in a less decentralized dapp, counterfeiting blockchain’s main functions.

We have figured this problem by implementing a fully decentralized futures exchange through integration of on-chain AMM formulas. This easily decides the cost of the position from given amount to buy. This is essential as it solves high gas costs when trying to form a cost in other ways, for instance order book mechanism. Bringing in an existing AMM formula, also helps in deriving a simpler structural mechanism, leading into high scalability and compatibility interchain and layers.

We introduce you Defutures, Decentralized Futures.

Defutures is a fully decentralized futures trading exchange. It is designed simple, easy and stable like no others. It does not support open book, instead integrates with an existing DeFi protocol’s AMM, using it to provide the strike amount for futures positions. An existing spot pair, and futures pair will converge to one another under given circumstances, and when convergence occurs, logic behind futures exchange is fulfilled. Our main audiences are not traders, instead crypto / trading beginners. Thus we have implemented a contract call that does both the staking and hedging using futures trading to provide stability in the investment model.

Defutures is fully flexible as it welcomes multiple chains and layers, and to DeFi protocols with an existing AMM. It is structured to focus solely on providing low-risk investment products to the user, and at the same time guaranteeing constant profits. Therefore being designed in a simple, straightforward manner, scalability throughout the entire blockchain system is relatively easily drawn.

How it's Made

Overall development direction

  • To maximize the user's investment experience, we designed the platform to enable DEX investments and hedging positions with a single ERC20 asset in a single transaction.
  • As the hedging products target users who are new to crypto, we designed a user-friendly interface that clearly shows how the user's actions affect their investment returns and risks.
  • To calculate values such as strike amount, margin ratio, and tolerance in real-time based on the user's input, we chose to perform complex calculations directly on the front-end instead of fetching pre-computed values from the blockchain.
  • We utilized a Typescript-focused technology stack to enable all builders to share their products and provide constructive feedback to each other.

FrontEnd

We worked on a project using React and TypeScript for the frontend. To quickly connect to the blockchain and ensure efficiency and security of the work, We utilized the Metamask SDK for connection. We adopted the immutable function structure of Uniswap and calculated values such as "Strike" and "AmountIn" on the frontend. In this case, We utilized Multicall extensively to obtain the balances of various ERC20 assets across multiple chains. To make our service user-friendly for those who are new to crypto, We designed it with a user-friendly interface. For example, even if there is only one token, users can still set a pair and have the opportunity to engage in future trading. We simplified complex functions such as hedging amount and margin ratio for easy understanding. We believe this will greatly contribute to the expansion of Web3 solutions.

Backend

We utilized a database to track user position creation, changes, and removal. As we aimed to implement a fully decentralized service, we did not use the backend for core trading functionalities. However, we used a database for the convenience of users.

Smart Contract

We developed a smart contract using Hardhat and Solidity language. As the futures market differs from the spot market and can cause arbitrage when the price rises immediately after buying, it was challenging to implement an AMM for the futures market. Therefore, we created our own futures market AMM that is simple yet accurately sets the futures price by modifying Uniswap's CPMM. In addition, we completed the contract development using UniswapV2Router to create the product, and SwapRouter and NonfungiblePositionManager in UniswapV3Router. With the use of the Router, we were able to implement the addLiquidity and Hedge functions for the users. Furthermore, we created our own UniswapV2DefutureRouter and UniswapV3DefutureRouter by modifying the Router and implemented addPosition, clearPosition, and Hedge functions with them. To prove that it can be executed on various networks, we deployed it on Mumbai, Scroll, Linea, Taiko, Celo, and Mantle networks.

background image mobile

Join the mailing list

Get the latest news and updates