Inspiration

Gas fees can often pose a significant hurdle for traders when utilizing automated market maker (AMM) pool swaps, and often time liquidity pools have a limited range of tokens available for trading.

Named after the legendary Queen of Sheba, known for her wisdom and prowess in fostering trade, Makeda embodies a decentralized space that aims to foster direct interaction and decentralized exchange.

Just as peer trading has stood the test of time, Makeda allows adopters to deploy multi-purpose swap contracts on Fantom Mainnet that leverage a priority-based matching system for automated trade execution.

Workflow

Users submit trade orders, which are then matched with existing orders based on their priority level. The contract supports both partial and complete trades, enabling users to specify the desired quantity of tokens for each trade. Counterparty trades with higher amounts to offer are prioritized first. Then, among trades with the same priority, the one with the earliest timestamp is selected and matched

How we built it

  • Smart Contracts:
  • Makeda Contract Factory is deployed on Fantom mainnet at: 0xf32c229DA711cb288ae2FdF16FCB36aEfdcf5ba3
  • Mock BTC : 0x24991417174bD27052656F4e9e2B6cA0e18F9A60
  • Mock ETH: 0x3b70652cB79780cA1bf60a8b34cc589BbeDc00B2
  1. The Factory Contract deploys new instances of the escrow trade-contract using create 2 deployer library everytime a developer/user creates a space.
  2. The PriorityQueue is a helper contract implementing a priority queue data structure to sort trades based on their priority (size and time).
  3. Other core functionalities of the escrow contract are implemented in the TradeHelper contract. This includes; i. Enqueueing trades ii. Finding matches based on priorities iii. Performing trades iv. Updating trade states.
  • Frontend: A simple client implementation using Next.js to demonstrate deployment of new escrow contract and swap testing with mock tokens minted on mainnet.

Challenges

-Due to the limited coverage of mainanet costs to test and pay for gas fees, I couldn't freely test the contract interactions on the Fantom Opera mainnet as extensively as I would have liked. Most initial test were carried out fantom testnet before deploying to mainnet

Accomplishments that we're proud of

Smart Contract Complexity: Developing a complex logic of prioritization, sorting, and matching trades into scalable logic and data structures. Despite the challenges of limited team members and resources, overcoming the constraints and delivering at the due deadline is something I'm proud of.

What we learned

Participating in the hackathon itself was a valuable learning experience.

What's next for Makeda

  • Scalability: Rollup integrations and off-chain computabilities in matching to reduce gas costs and implement batching transactions.
  • Token Standard Adaptability: Supporting multiple token standards like ERC721 for non-fungible tokens (NFTs). -Contract Upgradability: Enabling contract upgrades while maintaining the storage and functionality of the existing ones.
  • Open-source auditing
  • Project Roadmap design and Team Formation

Built With

Share this project:

Updates