Code Monkey home page Code Monkey logo

bondingcurve's Introduction

Bonding Curve Contract and Derivatives

Bonding Curve and Continuous Token Contracts and Derivative Fungible Tokens

NOTE

  • The BancorFormula contract cannot be implemented as a library since it uses state variables.
  • The BancorContinuousToken contract cannot inherit BancorFormula as a parent class due to the 25kb contract size restriction. Observer how the current implementation just passes the restrictions:
    $ npx hardhat size-contracts
    ·-------------------------|-------------·
    |  Contract Name          ·  Size (KB)  │
    ··························|··············
    |  BancorContinuousToken  ·     18.562  │
    ··························|··············
    |  BancorFormula          ·     18.073  │
    ··························|··············
    |  ERC20                  ·      5.013  │
    ··························|··············
    |  ERC20Restricted        ·      7.730  │
    ··························|··············
    |  Power                  ·      7.980  │
    ··························|··············
    |  SafeMath               ·      0.086  │
    ··························|··············
    |  SimpleToken            ·      5.566  │
    ··························|··············
    |  TransferHelper         ·      0.086  │
    ·-------------------------|-------------·
    
  • Gas prices in general are pretty high. Retiring tokens doesn't cost too much, but the price of minting tokens seems unreasonably hight. But then gain, so are most contract transactions on homestead.
    ·-------------------------------------|----------------------------|-------------|-----------------------------·
    |         Solc version: 0.8.4         ·  Optimizer enabled: false  ·  Runs: 200  ·  Block limit: 12450000 gas  │
    ······································|····························|·············|······························
    |  Methods                            ·               30 gwei/gas                ·       2899.20 usd/eth       │
    ··························|···········|··············|·············|·············|···············|··············
    |  Contract               ·  Method   ·  Min         ·  Max        ·  Avg        ·  # calls      ·  usd (avg)  │
    ··························|···········|··············|·············|·············|···············|··············
    |  BancorContinuousToken  ·  init     ·           -  ·          -  ·    3882306  ·            2  ·     337.67  │
    ··························|···········|··············|·············|·············|···············|··············
    |  BancorContinuousToken  ·  mint     ·      223564  ·     223832  ·     223698  ·            2  ·      19.46  │
    ··························|···········|··············|·············|·············|···············|··············
    |  BancorContinuousToken  ·  retire   ·           -  ·          -  ·     107346  ·            1  ·       9.34  │
    ··························|···········|··············|·············|·············|···············|··············
    |  SimpleToken            ·  approve  ·           -  ·          -  ·      46845  ·            2  ·       4.07  │
    ··························|···········|··············|·············|·············|···············|··············
    |  SimpleToken            ·  mint     ·           -  ·          -  ·      68530  ·            2  ·       5.96  │
    ··························|···········|··············|·············|·············|···············|··············
    |  Deployments                        ·                                          ·  % of limit   ·             │
    ······································|··············|·············|·············|···············|··············
    |  BancorContinuousToken              ·           -  ·          -  ·    4087097  ·       32.8 %  ·     355.48  │
    ······································|··············|·············|·············|···············|··············
    |  BancorFormula                      ·           -  ·          -  ·    3866479  ·       31.1 %  ·     336.29  │
    ······································|··············|·············|·············|···············|··············
    |  SimpleToken                        ·           -  ·          -  ·    1300292  ·       10.4 %  ·     113.09  │
    ·-------------------------------------|--------------|-------------|-------------|---------------|-------------·
    

TODO

  • Fuctions for migration. Tbf, these contracts aren't for production – merely proof-of-concepts that I don't intend to deploy to any public network – so adding migration functionality isn't necessary.

bondingcurve's People

Contributors

slothman3878 avatar

Stargazers

Indy avatar Jorge Miguel Garcia avatar Mimi St Johns avatar  avatar Kanye_'WES'_ avatar Amnot avatar

Watchers

 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.