Git Product home page Git Product logo

seed-liquidity's Introduction

Seed liquidity

A contract to pool funds which are then used to boostrap a new Uniswap liquidity pair.

Specification

  1. A new SeedLiquidity contract is deployed for non-existent or non-liquid Uniswap pair. The initial price is specified using target amounts.
  2. Users deposit tokens into the contract until both targets are reached.
  3. A user calls provide to supply liquidity to Uniswap.
  4. Users can claim their pro-rata share of the LP received LP token.
  5. If the target amounts are not raised or the liquidity is not provided before expiry, users can bail their deposits and the contract becomes void.

Interface

__init__(address,address[2],uint256[2],uint256,uint256)

Set up a new seed liquidity contract

  • router UniswapRouter address, e.g. 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
  • tokens Tokens which comprise a pair
  • target Amounts of tokens to provide, also determines the initial price
  • duration Duration over which the contract accepts deposits, in seconds
  • locktime How long the liquidity will stay locked, in seconds

deposit(uint256[2])

Deposit token amounts into the contract.

A user must have approved the contract to spend both tokens. The token amounts are clamped to not exceed their targets. This function only works up to the moment when liquidity is provided or the contract has expired, whichever comes first.

  • amounts Token amounts to deposit

provide()

Bootstrap a new Uniswap pair using the assets in the contract

This function can only be called once and before the contract has expired. Requires the target to be reached for both tokens. Requires the pool to have no liquidity in it.

claim()

Claim the received LP tokens

Can be called after liquidity is provided and the locktime has expired. The token amount is distributed pro-rata to the contribution.

bail()

Withdraw the tokens if the contract has expired without providing liquidity

Can be called after expiry given no liquidity has been provided.

seed-liquidity's People

Contributors

banteg avatar roshanr95 avatar vshvsh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

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.