Giter Club home page Giter Club logo

mammoth_pool's Introduction

mammoth_pool

Starknet pool to provide non-custodial liquidity to order book market makers

Goals:

  • Users can deposit and withdraw any ERC-20 token into the contract any time they want
  • Whitelisted market makers can use the liquidity to call the fill_order function on the zigzag contract
  • Users get credited their yield when they withdraw from the contract
  • The pool earns fees off swaps and some LP tokens may have additional staking rewards.

TODO:

  • Test external MM calling fill_order with liquidity from pool
  • Make "fill_order" method in proxy contract generalized for any potential exchange contract
  • Create market maker vault mechanism
  • test out approved market maker trading

CONTRACTS:

ROUTER CONTRACT

External

  • mammoth_deposit - deposit a single approved ERC20 to receive LP tokens (input Uint256)
  • mammoth_withdraw - withdraw a single ERC20 in exchange for LP tokens (input Uint256)
  • mammoth_swap - swap one ERC20 for another ERC20 (input Uint256)
  • create_pool - create new pool

View

  • is_pool_approved - given pool address returns 1 if valid pool and 0 else

POOL CONTRACT

View

  • view_out_given_in - given amount of ERC20 in and an ERC20 for out returns the amount of the second ERC20 a user would receive for inputing the amount in a swap
  • view_pool_minted_given_single_in - given amount of ERC20 in return amount of LP tokens minted
  • view_single_out_given_pool_in - given amount of LP tokens in and ERC20 address returns amount of given ERC20 received for burning LP tokens
  • get_ERC20_balance - given ERC20 address return balance of ERC20 in pool
  • is_erc20_approved - given pool and ERC20 address returns 1 if ERC20 is approved for said pool else 0
  • IMPLEMENTS ERC20_Mintable_Burnable

INFO

  • Find the current owner account in current_account.json
  • Find the current contract addresses in current_deployment_info.json

DEPLOYMENT INSTRUCTIONS

  • Set STARKNET_NETWORK and PRIV_KEY variables in .env
  • run python scripts/setup_account.py or set current_account.json manually
  • run python scripts/compile.py from root
  • run python scripts/deploy.py from root
  • run python scripts/create_pool.py from root

POOL CREATION INSTRUCTIONS

  • Call create_pool with owner account on proxy contract. Input: lp_address, pool_address, swap_fee, exit_fee
  • NOTE: swap_fee and exit_fee should be structs like (1,2) that represents 1/2 or a .5 fee
  • Call add_approved_erc20_for_pool with owner account on proxy for each ERC20. Input: pool_address, ERC20_address, weight
  • NOTE: weight in same form at swap_fee/exit_fee
  • Create pool through proxy with pool address
  • Add the ERC20 address to approved pool with 1/3 weight each

mammoth_pool's People

Contributors

andrepn avatar pet3ris 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.