Coder Social home page Coder Social logo

abstractpoint / ricochet-lpx Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ricochet-exchange/ricochet-tokens

0.0 1.0 0.0 475 KB

Interest/Fee/Reward-bearing streamable tokens

Home Page: https://ricochet.exchange

License: Other

Solidity 71.58% JavaScript 28.42%

ricochet-lpx's Introduction

Ricochet Super SLP tokens (SLPx)

This project creates streamable SushiSwap LP tokens. These tokens can be used in Ricochet Exchange's DCA system and they support earning SUSHI and MATIC subsidies.

Contract Architecture

alt text

Overview

  • SLPx tokens are wrapped SushiSwap LP tokens
  • Upgrade: SLP tokens are deposited into the MiniChef contract to earn SUSHI and MATIC
  • Harvest: SLPx tokens have a harvest function that harvests the SUSHI/MATIC subsidies from MiniChef and wraps them as SUSHIx/MATICx
  • Downgrade: SLPx tokens are burned, SLP tokens are returned to the user, and any accumulated SUSHIx/MATICx is distributed using Superfluid's InstantDistributionAgreement

Inheritance

  • SLPx inherits from Superfluid's SuperToken
  • SLPx overrides the functionality of upgrade and downgrade methods on SuperToken

Data Structures

  • address lpTokenAddress - The address of the LP token to use
  • address maticxAddress - The address of the MATICx contract
  • address sushixAddress - The address of the SUSHIx contract
  • address miniChefAddress - The address of the MiniChef contract
  • uint256 pid - The pool ID to use for MiniChef deposit and harvest function calls

Methods

Overrides

upgrade(uint256 amount)

  • Parameters
    • amount - the amount of SLP tokens to upgrade
  • Pre-conditions
    • msg.sender has approved SLPx contract to spend their SLP
    • SLPx contract has approved MiniChef to transfer SLP tokens
  • Post-conditions
    • SLP tokens are transferred to SLPx contract
    • Transferred SLP tokens are deposited into MiniChef
    • SLPx tokens are minted to msg.sender
  • ℹī¸ Also need to override upgradeTo method

downgrade(uint256 amount)

  • Parameters
    • amount - the amount of SLP tokens to downgrade
  • Pre-conditions
    • SLPx contract has approved MiniChef to transfer SLP tokens
  • Post-conditions
    • Call harvest method (not shown in arch. diagram)
    • SLPx tokens are burned
    • SLP tokens are transfered to msg.sender
    • SUSHIx is distributed using an IDA to the SLPx holders
    • MATICx is distributed using an IDA to the SLPx holders

harvest()

  • Parameters
    • None
  • Pre-conditions
    • None
  • Post-conditions
    • Calls harvest on Minichef
    • Upgrade MATIC and SUSHI received from MiniChef

end

ricochet-lpx's People

Contributors

mikeghen avatar

Watchers

James Cloos 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.