Authors
Summary
The purpose of this proposal is to introduce a number of improvements and new features for the Idle protocol. This upgrade comprehends flash loan support, improved integration tools and methods, gas optimization, and stkAAVE farming support.
Motivation
The rationale for this proposal is motivated by the following objectives:
-
Boosted APYs for users thanks to flash loans fees
-
General gas optimization redeems
-
Improved integration experience and set up for integrators
-
stkAAVE implementation as new farmed token for users
-
Re-enable COMP rewards for WBTC strategy and migrate to the new Compound pool because the old one will be deprecated in few days
Background
For the last month, the Idle Labs team has been developing, testing, and reviewing different new features that are needed for improving protocol UX for both retail and businesses, adding flash loans support, Aave/Compound compatibility upgrades, and general gas optimization. Most of these improvements have been already audited by Quantstamp (latest audit report here) and would be ready to be proposed on-chain and voted by our community.
Flash loans are part of the Idle Community Roadmap, and some aspects have already been discussed in the forum. Compound cTokens architecture migration has been already examined by the community, and so does Aave LM program implementation. Community sentiment about these initiatives has been positive so far.
High level overview:
Upgrade of IdleTokenGovernance contract to include the following changes:
-
support for EIP 3165 flashLoans (fee is set to 0.08% of the flash loaned amount redistributed to LP)
-
support for stkAAVE distribution
-
support for new cWBCT distribution
-
other minor updates for gas and redeems (see more below)
Specification
-
New IdleTokenGovernance contract proposed: 0x2854a270fe9c839ffe453e9178d1cfef109d6b8e
-
Ancillary IdleTokenHelper proposed: 0x5b7400cc634a49650cb3212d882512424fed00ed
On a technical side, the audit covered the following changes (that can be found here):
-
Add EIP-3165 compliant flash loan support, default fee set at 0.08%
-
Add new methods:
flashFee
,maxFlashLoan
,flashLoan
-
Integrated Emiliano Bonassi’s price helper in the main IdleToken contract directly with the
tokenPriceWithFee
view method (refactored a bit) -
updated
setAllAvailableTokensAndWrappers
method to allow setting -
supported governance tokens in a single call (useful for updating cWBTC to the new version and also the new version of cUSDC and cETH)
-
added
setCToken
method that allows to change the cToken address associated with COMP distribution (always for supporting the new version of cTokens) -
added
redeemIdleTokenSkipGov
which allow to not redeem specific gov tokens in exchange for a gas reduction (estimated gas cost reductions in fork: 10-20% compared to a normal redeem, based on how many gov tokens (ie 1 or 2 for now for COMP or IDLE) one is willing to forfeit) -
added
getGovTokens
view method -
added
getAllAvailableTokens
view method -
added
getProtocolTokenToGov
view method -
removed
userNoFeeQty
-
removed setGovTokens (integrated in
setAllAvailableTokensAndWrappers
) -
removed all GST2 methods
-
removed
rebalanceWithGST
-
removed
setIsRiskAdjusted
-
removed
openRebalance
-
added IdleTokenHelper contract (referenced inside the main IdleTokenGovernance contract for some view methods to reduce the bytecode size of the main contract)
-
code refactoring for reducing bytecode size and gas costs where possible (estimated gas cost reductions in fork: 2-5% on mint, 40% when redeeming only governance tokens)
The only component that has not been included in the latest audit scope is the stkAAVE support. The required changes for the main contract are minimal and fully tested and can be found here for IdleTokenGovernance and here for IdleTokenHelper, and can be summarized as follow:
-
Added
setAToken
method -
snippet to support stkAAVE distribution in IdleTokenHelper and PriceOracle
-
Updating the oracle address added with the new PriceOracle (deployed here, added a
getStkAaveApr
here)
Regarding stkAAVE distribution schedule, more information can be found in Aave’s AIP-16.
Proposal Process
The actual implementation and full deployment of IIP-7 would need to take place with 2 different on-chain proposals (as the required actions are more than 10).
The first on-chain proposal will include [Github link]:
-
upgrade DAI, USDC, USDT, WBTC, WETH Best yield strategies with the new implementation (5 actions)
-
support for new cWBTC distribution + stkAAVE distribution + disable cWBTC v1 (2 actions)
-
support for stkAAVE distribution in DAI, USDC, USDT (3 actions)
(WETH will accrue stkAAVE but will not redistribute them to the user until the next proposal is passed).
The second on-chain proposal will include (implementation link TBD):
-
support for stkAAVE distribution in WETH (1 action)
-
upgrade SUSD, TUSD Best yield strategies with the new implementation (2 actions)
-
_setPriceOracle in IdleController **
** in order to support the stkAAVE distribution a new priceOracle has been deployed here, this will be automatically set upon the IdleToken upgrade, but it should be updated also in the IdleController (the contract used for IDLE distribution). A separate proposal is needed probably to call _setPriceOracle
there because it triggers a refreshIdleSpeeds
which is really costly and should be associated with low-gas actions. Few more tests are needed on this.
cWBTC v1 has already been paused and the rebalancer will no longer allocate new funds there until the proposal 1 is passed with the new cWBTC v2. The rebalancer already also started including the stkAAVE apr in the rebalances so allocations now consider also stkAAVE rewards.
Those rewards will accrue to the contract until proposal 1 is passed, and at that point, rewards will be redistributed to users on mint and redeem events as with COMP and IDLE.
Next Steps
We are going to leave this thread open for comments regarding this implementation, and in about 24/48hrs, if there are no objections, we will proceed with the on-chain proposal and the voting phase.