Code Monkey home page Code Monkey logo

minswap-stableswap's Introduction

๐Ÿ˜ป Minswap Stableswap Contract

Structure

  • Main contracts:
    • Order & Order Batching Validators /validator/order_validator.ak
    • Pool Validator /validator/pool_validator.ak
    • LP Minting Policy /validator/lp_minting_policy.ak
  • Library: under /lib/stableswap package

Building

Prerequisites

Testing

Setup Stableswap Liquidity Pool

Minswap Stableswap Contracts depends on contract's parameters:

  1. Pool NFT: must be minted by Time-Lock script and its quantity must be 1
  2. Assets: the stable assets which the Pool supports trading
  3. Multiples: is the multiple of stable assets, using for calculation between stable assets with different decimals.
  4. Fee: the numerator of the fee % users need to pay when interacting with the pool
  5. Admin Fee: the numerator of the % of the fee that goes to Admin
  6. Fee Denominator: is the denominator of fee and admin_fee, which help calculation more accurate
  7. License Curreny Symbol: used for minting Batcher License assets.
  8. Admin Asset: is used to identify Admin
  9. Maximum Deadline Range: is the maximum expiration time of Batcher license from now

When these parameters are prepared, the Smart Contract can be built by using buiid-plutus.ts script.

Smart Contract Limitation

1. Batcher

In the Stableswap system, an entity known as the "Batcher" plays a crucial role in processing User Requests (Orders). Batchers are centralized agents, authorized by the Protocol Owner through a Batcher License Asset.

2. Pool NFT

The Pool NFT is a key component in Stableswap, uniquely identifying each Pool and playing a pivotal role. It is responsible for authorizing LP Token Minting. However, if the Pool NFT and the Pool are not configured correctly, it could potentially compromise the LP Minting Policy Contract.

  • Legitimate Initialization:

    • Mint a single Pool NFT using a Time-Lock Script.
    • Utilize the Pool NFT to establish a Stable Pool.
  • Malicious Initialization:

    • Failure to mint the Pool NFT via Time-Lock Script, or minting more than one Asset.
    • Misuse of the Pool NFT to mint LP Tokens prior to the creation of the Stable Pool.

To ensure security and uniqueness, users intending to interact with Stable Pools outside of the Minswap interface must verify that the Pool NFT has been minted correctly. This verification is crucial to ensure that the Pool NFT is unique and cannot be replicated or minted again.

References

  1. Specification
  2. Stableswap Formula
  3. Audit Report

Deployed contract

minswap-stableswap's People

Contributors

h2physics avatar m1n999999 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.