- Notifications
You must be signed in to change notification settings - Fork33
dai/usdc/usdt/tusd/ycrv ➝ yusd
License
yearn/yearn-recycle
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A contract that recycles all your [DAI, USDC, USDT, TUSD, yCRV] into yCRV and further into yUSD vault.
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.
Use the Brownie script to automatically set all approvals and recycle all your coins into yUSD.
$brownieaccountsimportuserkeystore.json$brownierunrecycle--networkmainnet
- Call
approve(0x5F07257145fDd889c6E318F99828E68A449A5c7A, 115792089237316195423570985008687907853269984665640564039457584007913129639935)
for all non-zero balances:
- Call
recycle()
here.
0x5F07257145fDd889c6E318F99828E68A449A5c7A
- Add support for yCRV deposits
- Add a Brownie script to set the needed approvals and recycle
- Honor allowances in
recycle()
, depositmin(balance, allowance)
- Add an ability to recycle custom amounts with
recycle_exact(dai, usdc, usdt, tusd, ycrv)
Reviewed by:
- @iamdefinitelyahuman
0x78e307F6e8584DaA0D85aDD918c0e3e4dD469A9C
Initial release, featuresrecycle()
function which converts [DAI, USDC, USDT, TUSD] to yUSD.
Reviewed by:
- @samczsun
- @andrecronje
- @vshvsh
TBD
Check fortoken.balanceOf(user)
andtoken.allowance(user, recycle)
for each of DAI, USDC, USDT, TUSD, yCRV
For tokens with non-zero balances andbalance > allowance
, calltoken.approve(recycle, MAX_UINT256)
At this point you can callrecycle.recycle()
You can get the exact amounts in and out from the transaction receipt event calledRecycled(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 intorecycle.recycle_exact(dai, usdc, usdt, tusd, ycrv)
Note that USDT is not ERC20-compliant, it doesn't return bool forapprove
and also requires first resetting theallowance
to zero before changing it to another value.
About
dai/usdc/usdt/tusd/ycrv ➝ yusd