Git Product home page Git Product logo

cube-protocol's Introduction

Cube tokens

Decentralized leveraged tokens.

Cube tokens such as cubeBTC approximately track P ^ 3, while inverse cube tokens such as invBTC approximately track 1 / P ^ 3, where P is the price of BTC.

Users can deposit ETH into a pool to mint cube tokens and later burn them to withdraw their ETH. If BTC goes up by 1%, cubeBTC's share of the pool will go up by around 3% and invBTC's pool share will go down by 3%. The pool shares are then normalized to sum to 100%.

Governance and guardian privileges

There are two privileged accounts for each pool: governance and a guardian.

The governance account can:

  • Change max pool share of each cube token

  • Change TVL cap

  • Collect fees that have accrued

  • Change trading fee

Both governance and the guardian can:

  • Emergency withdraw all ETH from the contract to the owner. This power can later be revoked if the owner calls finalize(). This is intended to be used in the case of a bug to rescue funds.

  • Pause and unpause deposits, withdrawals and price updates for any cube token. This is intended to be used in the case of a bug or oracle failure.

Repo

CubePool.sol is a pool containing deposited ETH. Users can deposit ETH to mint cube tokens and later burn them to withdraw their ETH.

CubeToken.sol is an ERC20 token representing a cube token. It's deployed from the CubePool when a new cube token is added.

ChainlinkFeedsRegistry.sol is a contract containing a mapping from tokens to their Chainlink price feed.

Usage

Run below as a workaround for this bug in brownie

brownie pm clone OpenZeppelin/[email protected]

Run solidity linter

npm run lint:fix

Run python formatter for unit tests

black .

Run unit tests

brownie test

Run keeper script. You need to set up a brownie account and set environment variables KEEPER_ACCOUNT, KEEPER_PW and WEB3_INFURA_PROJECT_ID

brownie run keep

Deploy

brownie run deploy

cube-protocol's People

Contributors

mxwtnb 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.