Giter Site home page Giter Site logo

curvefi / tricrypto-ng Goto Github PK

View Code? Open in Web Editor NEW
67.0 7.0 22.0 4.23 MB

Automatic Market Maker (AMM) for three unpegged assets, written in Vyper.

License: Other

Vyper 48.14% Python 22.57% Jupyter Notebook 29.12% Solidity 0.16%
amm ethereum smart-contracts vyper-contracts

tricrypto-ng's Introduction

Curve TriCrypto Factory

This github contains smart contracts (and accompanying tests) on an optimised version of Curve Finance Tricrypto pool deployed on Ethereum.

The AMM (automatic market maker) infrastructure involves the following parts:

  1. Factory
  2. AMM blueprint contract
  3. Math
  4. Views
  5. Liquidity Gauge blueprint contract

The Factory can accommodate multiple blueprints of the AMM contract (deployed on chain). These blueprints are then specified by the user while deploying the pool. Similarly, liquidity gauges can be deployed through the factory contract as well for a specific pool, through liquidity gauge blueprint contracts.

The AMM is a 3-coin, auto-rebalancing Curve Cryptoswap implementation with several optimisations that make the contract cheaper for the end user. Also, unlike the older version: the pool contract is an ERC20-compliant LP token as well.

The Math contract contains the different math functions used in the AMM.

The Views contract contains view methods relevant for integrators and users looking to interact with the AMMs. Unlike the older tricrypto contracts. The address of the deployed Views contract is stored in the Factory: users are advised to query the stored views contract, since that is upgradeable by the Factory's admin.

The Factory AMMs have a hardcoded ADMIN_FEE, set to 50% of the earned profits. Factory admins can also implement parameter changes to the AMMs, change the fee recepient, upgrade/add blueprint contract addresses stored in the factory. Unlike the original tricrypto contracts, Factory tricrypto contracts cannot be killed by the admin.

In case of any issues that result in a borked AMM state, users can safely withdraw liquidity using remove_liquidity at balances proportional to the AMM balances.

For developers

To run tests:

> python -m pytest

To contribute

In order to contribute, please fork off of the main branch and make your changes there. Your commit messages should detail why you made your change in addition to what you did (unless it is a tiny change).

If you need to pull in any changes from main after making your fork (for example, to resolve potential merge conflicts), please avoid using git merge and instead, git rebase your branch

Please also include sufficient test cases, and sufficient docstrings. All tests must pass before a pull request can be accepted into main

Smart Contract Security Vulnerability Reporting

Please refrain from reporting any smart contract vulnerabilities publicly. The best place to report first is [email protected].

Deployments

Please check [./deployments.yaml][the deployments file to get addresses for deployed contracts.]

License

(c) Curve.Fi, 2023 - All rights reserved.

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.