Giter VIP home page Giter VIP logo

yearn-recycle's Introduction

Yearn Recycle

A contract that recycles all your [DAI, USDC, USDT, TUSD, yCRV] into yCRV and further into yUSD vault.

Usage

You need to grant allowances on up to five tokens to this contract before using it. This needs to be done for all non-zero amount and it only needs to be done once.

Using Brownie

Use the Brownie script to automatically set all approvals and recycle all your coins into yUSD.

$ brownie accounts import user keystore.json
$ brownie run recycle --network mainnet

Using Etherscan

  1. Call approve(0x5F07257145fDd889c6E318F99828E68A449A5c7A, 115792089237316195423570985008687907853269984665640564039457584007913129639935) for all non-zero balances:
  1. Call recycle() here.

Deployments

v0.2.0

0x5F07257145fDd889c6E318F99828E68A449A5c7A

  • Add support for yCRV deposits
  • Add a Brownie script to set the needed approvals and recycle
  • Honor allowances in recycle(), deposit min(balance, allowance)
  • Add an ability to recycle custom amounts with recycle_exact(dai, usdc, usdt, tusd, ycrv)

Reviewed by:

  • @iamdefinitelyahuman

v0.1.0

0x78e307F6e8584DaA0D85aDD918c0e3e4dD469A9C

Initial release, features recycle() function which converts [DAI, USDC, USDT, TUSD] to yUSD.

Reviewed by:

  • @samczsun
  • @andrecronje
  • @vshvsh

Frontends

TBD

Integration caveats

Check for token.balanceOf(user) and token.allowance(user, recycle) for each of DAI, USDC, USDT, TUSD, yCRV

For tokens with non-zero balances and balance > allowance, call token.approve(recycle, MAX_UINT256)

At this point you can call recycle.recycle()

You can get the exact amounts in and out from the transaction receipt event called Recycled(user, sent_dai, sent_usdc, sent_usdt, sent_tusd, sent_ycrv, received_yusd)

You can also allow depositing partial amounts (sliders?) or skipping some of the coins (checkboxes?). For this you need to calculate the exact amounts and pass them into recycle.recycle_exact(dai, usdc, usdt, tusd, ycrv)

Note that USDT is not ERC20-compliant, it doesn't return bool for approve and also requires first resetting the allowance to zero before changing it to another value.

yearn-recycle's People

Contributors

banteg avatar iamdefinitelyahuman avatar 0xalizk 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.