Skip to content

Latest commit

 

History

History
137 lines (98 loc) · 6.96 KB

README.md

File metadata and controls

137 lines (98 loc) · 6.96 KB

SmartSwap

Note - All Contracts are deployed on Matic Test V2 Network

Introduction

  • Exchanging has been part of human civilization right from when humans began trading, in the early phase, it was Barter system which was used to exchange goods between two parties, fast forward to the modern age we have blockchain to trade goods(represented by monetary units of tokens).

  • Now it's possible to trade without trusting the opposite part thanks to guarantees provided by blockchain

  • First, we have Order-Book based Dexes for transacting between multiple parties, They had their weaknesses such as :

  1. No fair pricing
  2. multiple transactions just to do a simple exchange of two tokens
  3. Bad UI/UX and many more
  4. Then we had introduction of AMM by vitalik which led to creation of bancor and uniswap
  5. This solved quick exchange swap for many users

Issues we face with Ethereum :

  1. 15 sec transaction confirmation
  2. High gas prices which makes transacting anytime you want difficult
  3. Waiting for hours due to high gas prices which can affect price you get when trading(Makerdao black thursday is such a example)
  4. We need a place for fast exchange
  • Thankfully we have plasma sidechain binded to main etherum network which solves much problems with scalability without scarificing much decentralization.

  • We have come up with plasma exchange solution with fast exchange and less gas fees

  • Users can visit test website link and login using wallet of their choice by clicking on connect

  • They can transfer thier assets from mainet to matic network using bridge

  • If Users want to buy Land Tokens they can select NFT

  • If Users want to buy any ERC20 Token they can buy using swap page by selecting tokens from dropdown

  • They can addLiquidity for their Exchange, create an ERC20 Uniswap Exchange

  • They can swap and send tokens to another address using send page

  • They can provide their assets to be available for exchange and collect fees

Functionality

  1. Token(ERC20)-Token(ERC20) conversion
  2. Dai->Cdai(Compound Dai) conversion
  3. Token(mana)->NFT(Land) conversion
  4. Login using multiple wallets(Portis,Torus,Fortmatic,walletconnect,metamask)
  5. ETH-Token(ERC20,ERC721) conversion

Installation Steps

  1. Clone the Repo
  2. Do npm install/yarn install
  3. Now run yarn start
  4. Naviagte to http://localhost:3000 and start swapping:) (Note -> The Addresses used mentioned in the Contract Addresses Section below are our own so you need to replace those to run the dapp for your self, we have mentioned below in which files do you need to change address, if you face any trouble contact [email protected]/[email protected]/[email protected] as there are a few files where you need to change the addresses)

Set Up NFT Market

  1. As the NftMarket Contract has admin level permissions so you will need to set up your own.
  2. Refer this guide to get started. Note - You can find the Nft Test Contract mentioned in the above link for minting here

Matic Bridge

  1. Go to depositerc20.js

  2. Create a ropsten custom token on matic using this address 0xe2B7a0c7bC21E000B8327713513b9D4d2620A414 (TERC20)

  3. Create a matic custom token on matic using this address 0xe2B7a0c7bC21E000B8327713513b9D4d2620A414 (TERC20)

  4. Enter your metamask address in from field in the script

  5. Enter your private key in SetWallet function

  6. run node depositerc20.js in cmd

(We're facing some issues , while integrating Matic.js with Reactjs's forms without the private key, we had discussions with matic guys and they gave the go ahead for scripts)

Screenshots

1 2 3 4 7 8 wallets

Video

Smart Swap Demo

Website

Smart Swap NOTE - This is hosted with our own pair of addresses, please check the Contract Addresses section below and replace with your addresses

Sample Transaction Links For Reference

  • ETH<->MANA -> 0x003b9b872b81b0b9ad0f4745eb61c196a813a1ef7501c1a058aec5a817e9fad6

  • DAI<->ETH -> 0xb770cca7949d3a353edff6f7ade40cc32bd57a314d11b40e90cb8759089ebd7

  • DAI<->CDAI -> 0xbed4ff336ef8e2337b369702398d11f7881f5969c0eaa62af227c8e33694e3ea

  • CDAI<->DAI -> 0xe52737c9049db16ad05f21592dda422a076ec3f797273d65e480d3140f79b89c

  • ETH-LAND -> 0x75d4c19afa3a521fc0043b5889a5d122ce34743cfd4c5625cc543406cab00420

  • MANA<->LAND -> 0x645e317d67bc65daaa902d48abaa92c308a9eeb4ec693e9b03330778351d16e4

  • Adding Liquidity -> 0x16a0f0a1f32ba3eb6ca6c52f11dbee4400b5f78d05adb66187eb2c0cd70c79c6

    Copy the Tx Hash and check out here
    [NOTE - We Would recommend checking out the demo video first]

Contract Addresses

  • Please replace with your own set of addresses at the following locations
  • You can find the ERC20, NFT(LAND) and Uniswap Exchange addresses here
  • All Compound Contract Addresses are here
  • NFT MarketPlace Address -> 0x1b5666b40f30231879f8a5dedfc78cdda7cacf77
  • In Addition to there are some specific Components of the Dapp that requires you own set of addresses
  • LAND Address here
  • LAND Address here
  • NFT Market Address here
  • CDAI Address here

Tools Used

  1. Compound protocol
  2. Uniswap protocol
  3. Kyber protocol
  4. NFT markerplace exchange
  5. Matic bridge
  6. Truffle
  7. React
  8. Web3react library

Authors

  1. Viraz
  2. snaketh4x0r
  3. Aveesh