In Magicswap v2, each pool has its own contract instance, and NFT pools have an associated NftVault which handles all the underlying implementation details around fractionalization.

Magicswap v2 is built with following modules:

  • NftVault
  • DEX
  • Router
  • Rewards

Magicswap Architecture Diagram

NftVault

NftVault wraps NFTs (ERC-721 and ERC-1155) into a ERC-20 representation. There can be an unlimited amount of vaults with varying configurations. One can deploy a vanilla vault for a single ERC-721 collection, or a more complex vault that contains multiple collections with a curated list of allowed tokens. Every vault redeems a NFT for a single ERC-20, e.g. 1 NFT = 1 ERC-20.

DEX

DEX is a UniswapV2 modified fork with support of custom LP fees, volume based royalties and UniswapV3 style oracle. This allows for smooth NFT/ERC-20 and NFT/NFT trading with real-time automated royalties payments. Each trading pair has a secure decentralized on-chain oracle implemented which opens doors for safe NFT lending at scale.

Router

Router contract is based on Uniswap’s router and its main purpose is to streamline NFT operations within the DEX. Liquidity providing/removal and NFT/ERC-20 and NFT/NFT swaps to name a few. Users can swap between multiple ERC-721/ERC-1155/ERC-20 tokens within a single transaction.

Rewards

Rewards is a fork of Sushi Staking Rewards contract that allows staking of LP tokens to earn multiple reward tokens at the same time.