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.
$ brownie accounts import user keystore.json
$ brownie run recycle --network mainnet
- 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, features recycle()
function which converts [DAI, USDC, USDT, TUSD] to yUSD.
Reviewed by:
- @samczsun
- @andrecronje
- @vshvsh
TBD
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.