Giter Club home page Giter Club logo

kittyswaps's Introduction

Kittyswaps

Uniswap for ERC-1155.

We are incredibly thankful for the work done by the Uniswap team, without which Kittyswaps wouldn't exists.

Description

Kittyswaps is a fork of Uniswap, a protocol for automated token exchange on Ethereum. While Uniswap is for trading ERC-20 tokens, Kittyswaps is a protocol for ERC-1155 tokens. Both are designed to favor ease of use and provide guaranteed access to liquidity on-chain.

Most exchanges maintain an order book and facilitate matches between buyers and sellers. Kittyswaps smart contracts hold liquidity reserves of various tokens, and trades are executed directly against these reserves. Prices are set automatically using the constant product $x*y = K$ market maker mechanism, which keeps overall reserves in relative equilibrium. Reserves are pooled between a network of liquidity providers who supply the system with tokens in exchange for a proportional share of transaction fees.

An important feature of Kittyswaps is the utilization of a factory/registry contract that deploys a separate exchange contract for each ERC-1155 token contract. These exchange contracts each hold independent reserves of a single fungible ERC-1155 currency and their associated ERC-1155 token id. This allows trades between the Currency and the ERC-1155 tokens based on the relative supplies.

For more details, see Specification.md

Differences with Uniswap

There are some differences compared to the original Uniswap that we would like to outline below:

  1. For ERC-1155 tokens, not ERC-20s
  2. Base currency is not ETH, but needs to be an ERC-1155
  3. Liquidity fee is 0.5% instead of 0.3%
  4. All fees are taken from base currency (Uniswap takes trading fees on both sides). This will lead to some small inneficiencies which will be corrected via arbitrage.
  5. Users do not need to set approvals before their first trade
  6. 100% native meta-tx friendly for ERC-1155 implementations with native meta-tx functionalities
  7. Front-end implementations can add arbitrary fee (in addition to the 0.5%) for tokens with native meta-transactions.
  8. Less functions than Uniswap

There are pros and cons to these differences and we welcome you to discuss these by openning issues in this repository.

Contracts

KittyswapsExchange.sol: The exchange contract that handles the logic for exchanging assets for a given base token. KittyswapsFactory.sol: The exchange factory that allows the creation of nifyswap exchanges for the tokens of a given ERC-1155 token conract and an ERC-1155 base currency.

Usage

Dependencies

  1. Install node v11,
  2. Install yarn : npm install -g yarn
  3. Install Truffle npm package: npm install truffle or yarn add truffle
  4. Install the multi-token-standard npm package npm install kittyswaps or yarn add kittyswaps

Dev / running the tests

  1. yarn install
  2. yarn build
  3. yarn ganache
  4. in another terminal run, yarn test - executes test suite

kittyswaps's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.