Liquidity Mining Season 2 — Orchestrator Update — Batch Swap Technology

Materia
4 min readApr 15, 2021

--

  • Liquidity Mining Season 2
  • Orchestrator Update
  • Batch Swap Technology

The first liquidity mining season of Materia’s $GIL has come to an end and it is time to look at the future of the project.

The Materia team would like to thank our growing community. We have been gathering suggestions, new ideas, and contributions from many of you. As you know, Materia is an open-sourced R&D, community-based initiative; made for the community by the community. So, thank you again for your participation and support in its evolution.

Let us recap a bit of the current situation. The circulating supply of $GIL is:

  • 10M as Initial Liquidity on Materia
  • 2,5M airdropped to uSD, BUIDL, ARTE, UNIFI holders (as of 31/01/2021 and still available via claim)
  • 15M as a reward for Season One Liquidity Miners

We believe that the first step of token distribution was a success, but the underlying goal of granting true community governance is not completed yet. That is why we are unveiling Liquidity Mining Season Two starting in the next few days!

Materia Liquidity Mining: Season 2

Materia will activate the second season of Liquidity Mining, rewarding to participating liquidity providers 1.5M $GIL over 60 days.

The second season will target the following pairs on Materia:

  • WUSD/GIL -> 66,67% (1M $GIL)
  • WUSD/ETH -> 33,33% (0.5M $GIL)

We are happy to announce that Season Two will start next week!

Orchestrator Update

The Orchestrator contracts will receive a major update to enable the following functionalities:

  • Wrapped721, Wrapped1155 and Native-ITEM pairs support: Users will be able to create pairs on Materia, summoning the true power of the protocol.
  • Batch Swap: further details below

Batch Swap/Lego Swap

Let us talk about this new functionality.

The goal of the Batch Swap feature is to allow users to exchange multiple tokens at the same time, across multiple ERC standards. This significantly reduces Ethereum network fees, allows for enhanced trade functionality, and improved efficiency in each transaction.

The Smart Contracts of the batch swap functionality will allow maximum versatility in the execution of transfers and Materia’s user-interface will drive users in the realization of this new technology.

Item and ERC20

The enabling technology for the Batch Swap is the ERC1155 safeTransferBatch() functionality. By implementing the native support of the Ethitem protocol (https://ethitem.com/) which merges ERC20s, ERC721s and ERC1155s into a single super standard we can grant this new feature inside Materia DEX.

Materia supports any input token; both ITEM and ERC20, by automatically wrapping them into ITEM.

How does it work?

Some technical stuff

The operations required to implement the Batch Swap functionality are related to the nature of the Tokens exchanged, as follow:

  • EthItem: In case of exchange between tokens belonging to the same collection, all the ITEMs will be moved through an efficient ERC1155 batch transfer. In the case of ITEMs belonging to heterogeneous collections, an offchain EIP712 permit will be performed to allow the Materia Orchestrator contract to execute the transfers.
  • ERC20: An approval will be required before wrapping them into ITEM and moving towards the Materia Orchestrator contract for the proper execution.
  • Ether: First the Ether will be moved through the msg.value property of the transaction, in a second stage, they will be wrapped into IETH and moved to the Materia Orchestrator contract for the proper execution.

From a technical perspective, the Smart Contract will utilize two ways to perform a batch swap, according to the conditions defined above:

  • Calling the provided batchSwap() method if the input values are not EthItems;
  • Moving tokens with a ERC1155 safeTransferBatch() call on an EthItem collection (passing an appropriate payload).
    Note: it is required to call the safeTransferBatch() function, even when there is only a single token to move.

To get the cheapest transaction and properly use the safeTransferBatch() function, both the INPUT and OUTPUT tokens must belong to the same collection.

For every input token (not moved by safeTransferBatch()), if the contract has the required allowance() it performs a transferFrom(), otherwise the UI will ask the user to perform an EIP712 off chain signature.

Users will specify the (exact) input amounts and the desired output amounts, the UI calculates the minimum output amounts (according to a prefixed tolerance). All the actual output amounts must be greater than the minimum amounts.

All the input tokens will be swapped for the bridge token (WUSD) and then the bridge token is swapped for the output amounts, according to the output amounts specified.

Conclusion

In Q2 we look forward to sequentially releasing the presented new features, starting with Liquidity Mining Season 2.

Stay tuned!

💡 Links:

--

--

Responses (2)