Git Product home page Git Product logo

tapioca-bar's Introduction

Tapioca Bar🍹 & Mixologist 🤙

The gist of it

YieldBox : Serves as a vault to store assets/collaterals, strategies can later be used on those vaults to yield farm.

  • deposit(uint256 assetId, address from, address to, uint256 amount, uint256 share) Used to deposit, it’s the first step to enter a market.
  • withdraw(uint256 assetId, address from, address to, uint256 amount, uint256 share, bool withdrawNative) Used to withdraw asset from YieldBox , if the asset if the wrapped native, the last parameter is to decide to unwrap or not the asset.
  • setApprovalForAll(address operator, bool approved) Used to allow a Mixologist market to use the user’s YieldBox assets.
  • toShare(uint256 assetId, uint256 amount, roundUp) Convert from an asset amount to a YieldBox share.
  • toAmount(uint256 assetId, uint256 share, roundUp) Convert from a YieldBox share to an asset amount.
  • amountOf(address user, uint256 assetId) The amount in underlying token that a user has stored in.
  • balanceOf(address user, uint256 assetId) The amount of shares a user has.

Mixologist : Users can deposit / withdraw from YieldBox to Mixologist to enter / exit markets.

  • addCollateral(address to, bool skim, uint256 share) Users can add collateral from the YieldBox deposit to the Mixologist market.
  • removeCollateral(address to, uint256 share) Users can remove collateral and exit their position, if they are solvent.
  • addAsset(address to, bool skim, uint256 share) Users can lend YieldBox deposited asset with it.
  • removeAsset(address to, uint256 fraction) Users can exist lending position with this.
  • borrow(address to, uint256 amount) Users can borrow the lent asset of the market, they need to addCollateral first.
  • repay(address to, bool skim, uint256 part) Users can repay their positions with it. Since we’ll have self-repaying loans technically it’s not gonna be used but it’s good to have it.
  • mix(uint8[] calldata actions, uint256[] calldata values, bytes[] calldata datas) Used to make multiple actions in one Tx.
  • balanceOf(address user) The balance in fraction unit of a user, we can use MixologistHelper to compute the real asset amount.

MixologistHelper : A helper contract for Mixologist .

  • getCollateralSharesForBorrowPart(Mixologist mixologist, uint256 borrowPart) Used to compute the amount of shares needed for an amount of asset to be borrowed.
  • getAmountForAssetFraction(Mixologist mixologist, uint256 fraction) Used to compute the amount of assets based on a fraction. Can be used to get asset amounts from Mixologist.balanceOf.

tapioca-bar's People

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.