Mobile and desktop interfaces of the Mantra DAO platform
Return

Mantra DAO

Community-governed DeFi platform

About the client

Our client, Mantra DAO, is developing a community-governed DeFi platform aimed at giving financial control back to users through a transparent and decentralized ecosystem. The platform is focused on lending, staking, governance, and launchpad services.

Details

PixelPlex helped the client build an efficient DeFi solution by developing smart contracts, deploying new staking pools, performing a migration to the Solana blockchain — and delivering a range of other enhancements.

Team

  • Solidity developer
  • Backend developer
  • Frontend developer
  • Rust developer
  • Go developer
  • Project manager

Business opportunity

Initially, the client brought in a third-party service provider to assist them with the development of their DeFi platform. However, the resulting platform had inefficiencies such as bugs in existing smart contracts that needed to be fixed.

Aiming to continually improve the platform, the client wanted to enhance it with new functionality by implementing new smart contracts and adding new platforms, including Binance Smart Chain and Polygon (being built as a Polkadot-first project, the platform only supported Ethereum when the customer approached PixelPlex). These changes would allow Mantra DAO to offer services on different blockchains.

The client chose PixelPlex to complement their in-house team and join their project as a trustworthy technology services provider with extensive experience in blockchain and smart contracts development.

Project goals

Together with the client, we established the key project goals:

  • 1

    Improve the performance of the Mantra DAO platform and eliminate inefficiencies

  • 2

    Add new smart contracts and staking pools

  • 3

    Incorporate multi-chain support

  • 4

    Add new functionality to the existing platform

Work done

  • check-icon

    Development of smart contracts

  • check-icon

    Deployment of new staking pools

  • check-icon

    Migration from staking pool V1 to staking pool V2

  • check-icon

    Extension of the existing functionality to new platforms (Binance Smart Chain, Polygon)

  • check-icon

    Bug fixes, UI enhancements, and inefficiencies resolution

Project features

A blue and green icon of a chain

Multi-chain support, including Ethereum, Binance Smart Chain and Polygon

A blue and green icon of a three layers

Multiple staking pools on different networks

A blue and green icon of a gear

The ability to manage assets staking and governance in one place

A blue and green icon of a segmented circle

The platform’s own token – OM token

A blue and green icon of a bullet list

Secure smart contracts for staking pools

A blue and green icon of a light bolt

Zendit launchpad solution offering all the necessary tools and resources for organizations to launch their tokens

Details

he interface of a home page of the Mantra DAO platform
The interface of a dealings page of the Mantra DAO platform
The interfaces of exchange pages of the Mantra DAO platform

* The design of layouts was provided by the client.

Smart contracts development

One of the largest of Mantra DAO’s modules is Staking, which allows users to stake tokens and receive token rewards. The company offers both single asset and LP staking pools. The client had already developed staking smart contracts when we joined the project, but they had bugs that could lead to potential security issues in the production environment.

To prevent security problems, our team resolved the bugs in the LP staking smart contract and followed up with unit tests. We also developed a smart contract for single asset staking from scratch. The logic we introduced makes it easy to roll out new staking pools.

Staking pools deployment

Mantra DAO regularly partners with different organizations and adds further new tokens to staking pools. For each partnership our specialists deploy new staking pools based on the parameters provided by the customer (for example, token owner or token rewards).

To begin with, our team implemented new staking pools on the Ethereum network. In order to offer a chain-agnostic solution, the client extended their staking to Binance Smart Chain and Polygon, so our team is now also responsible for deploying new staking pools for these platforms.

Throughout the project we deployed 60+ staking pools on different networks (Ethereum, Binance Smart Chain, Polygon).

Security audit

Focusing on enhanced security, the customer approached SlowMist – a company engaged in blockchain ecological security – to perform security audits of smart contracts developed by our team. After a detailed analysis and testing, our smart contracts successfully passed the audit with no major issues found.

Zendit launchpad implementation

PixelPlex assisted the client with the development of Zendit launchpad. It uses a decentralized fixed swapping protocol which provides transparency with regard to the number of tokens offered during a token launch. Zendit offers the client’s partner organizations the necessary resources and support to launch their tokens.

Dutch Auction mechanism

The distinctive feature of the implemented launchpad is that it offers the opportunity to use a Dutch Auction style of launch in addition to standard fixed swap protocols. The major benefit of the Dutch Auction mechanism lies in it being a decentralized and democratic way of determining the price of a company’s coin, where bidding for an item begins with a high asking amount which is systematically lowered until a user makes the winning bid and the item is sold.

Migration to staking pool V2

PixelPlex assisted the client in implementing the logic for migration from staking pool V1 to staking pool V2 and token swap to OM V2.

OM V2 is an enhanced version of the OM token, which has many important advantages, including but not limited to:

  • auto-compounded staking rewards
  • immediate unstaking for a fee
  • the ability to cancel unstaking and automatically re-stake
  • improved countdown timer (seconds, minutes, hours, days).

Thanks to the implemented logic, Mantra DAO end users can migrate to a new version in only a few clicks and start staking OM V2 tokens.

Development of a migration mechanism

The major problem was that the first version of the staking pool developed by the client didn’t have migration functionality. It was essential that users’ existing assets could be seamlessly migrated to staking pool V2 so that users who had tokens in staking pool V1 could easily receive rewards in the new staking pool.

Our team conducted technical research to make the required migration possible. We made changes to the existing architecture of the solution and implemented a migration mechanism. As a result, the platform’s users were able to easily move to staking pool V2 without losing their existing tokens and rewards.

Got an idea? Let’s work together

Moving from Ethereum to Solana

Benefits of using Solana

Having initially built their DeFi platform on Ethereum the client decided to switch to Solana. Solana has multiple benefits over the Ethereum blockchain, such as:
  • A green checkmark

    The use of PoS consensus algorithm

  • A green checkmark

    Frequent transactions (more than 65,000 per second)

  • A green checkmark

    Better scalability

  • A green checkmark

    Lower transaction cost ($0,00025)

Prepared research

Our blockchain consultants prepared research, which covered multiple aspects and the various peculiarities of the Solana blockchain. It included details such as a high-level overview of the platform, the ownership of accounts, a guide on how to create a coin in Solana, and returning values from cross-program invocations.

When the final decision to move to Solana was made, the client asked our team to choose the optimal migration strategy and then proceed with the chosen variant. PixelPlex tech specialists researched different migration options, evaluating the pros and cons of each scenario.

Choosing the best migration strategy

  • 1st strategy

    Use Neon virtual machine to run Solidity contracts directly in Solana

    • Dependency on the Neon project
    • This approach offers less flexibility due to the dependency on a third-party tool
    • A simple solution as it may not require writing any code
    • Neon is very immature, which results in bugs and limitations (e.g. we faced many issues trying to deploy a simple Ethereum contract)
    • It is a whole new ecosystem with its own coins (which are now sold to private investors)
    • It can only be used for Solana
  • 2nd strategy

    Rewrite everything in Rust

    • There is no dependency on any project
    • Better overall flexibility
    • It will take more time compared to using a virtual machine, yet the performance can be tuned to fit the client’s need
    • The maintenance burden
  • 3rd strategy

    Compile Solidity contracts into Solana’s blockchain using Solang

    • Compile Solidity contracts into Solana’s blockchain using Solang
    • Better flexibility as some of the contracts may be rewritten completely while others will be recompiled by Solidity compiler
    • A simple solution as there is no need to completely rewrite all the contracts
    • Solidity contracts must be tuned to circumvent restrictions of Solang
    • Assembly language can't be compiled (but it is used in the MANTRA Dao stake contracts)
    • Sizes of integers must not be higher than 64 bit (whereas they are bigger in the project)
    • Need to write code in order to trigger these smart contracts, which will add to the maintenance burden

Initially, we considered taking advantage of the Solang compiler due to its flexibility and time-efficiency. However, after reviewing the limitations associated with Solang, we decided to go with rewriting everything in Rust. This approach allowed us to achieve increased flexibility and performance. Currently our team is in the process of migrating to the Solana blockchain.

Results

  • 60+

    staking pools deployed

  • $23M

    total value of stacked assets (as of April 2022)