Giter VIP home page Giter VIP 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 paid a variable yield that can be updated by the owner of the contract
  • Users get credited their yield when they withdraw from the contract

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 balancer pools with multiple pools
  • test out approved market maker trading
  • Convert everything to Uint256

NOTE: testing currently incomplete

CONTRACTS:

PROXY CONTRACT

External

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

View

  • get_token_address_for_pool - given pool address returns LP token address
  • get_swap_fee_for_pool - given pool address returns current swap fee
  • get_exit_fee_for_pool - given pool address returns current exit fee
  • is_pool_approved - given pool address returns 1 if valid pool and 0 else
  • is_erc20_approved - given pool and ERC20 address returns 1 if ERC20 is approved for said pool else 0
  • get_weight_for_token - given pool and ERC20 address returns weight of ERC20 token in pool
  • 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

POOL CONTRACT

View

  • get_ERC20_balance - given ERC20 address return balance of ERC20 in pool

LP Token CONTRACT

View

  • all normal methods for ERC 20

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 deploy_account.py or set current_account.json manually
  • run python compile_contracts.py from root
  • run python deploy_contracts.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

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.